@tonconnect/ui 2.3.0-beta.2 → 2.3.0-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 +239 -240
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +114 -47
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.mjs +115 -48
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -475,6 +475,11 @@ declare class TonConnectUI {
|
|
|
475
475
|
signData(data: SignDataPayload, options?: {
|
|
476
476
|
onRequestSent?: (redirectToWallet: () => void) => void;
|
|
477
477
|
}): Promise<SignDataResponse>;
|
|
478
|
+
/**
|
|
479
|
+
* Gets the current session ID if available.
|
|
480
|
+
* @returns session ID string or null if not available.
|
|
481
|
+
*/
|
|
482
|
+
private getSessionId;
|
|
478
483
|
private redirectAfterRequestSent;
|
|
479
484
|
/**
|
|
480
485
|
* TODO: remove in the next major version.
|
package/lib/index.mjs
CHANGED
|
@@ -50,7 +50,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
53
|
-
import { TonConnectError, isWalletInfoCurrentlyInjected, toUserFriendlyAddress, CHAIN, TonConnect, isTelegramUrl, encodeTelegramUrlParameters, WalletMissingRequiredFeaturesError, isWalletInfoRemote, checkRequiredWalletFeatures, isWalletInfoCurrentlyEmbedded, BrowserEventDispatcher, createVersionInfo, createResponseVersionEvent, createRequestVersionEvent, createConnectionStartedEvent, createConnectionCompletedEvent, createConnectionErrorEvent, createConnectionRestoringStartedEvent, createConnectionRestoringCompletedEvent, createConnectionRestoringErrorEvent, createDisconnectionEvent, createTransactionSentForSignatureEvent, createTransactionSignedEvent, createTransactionSigningFailedEvent, createDataSentForSignatureEvent, createDataSignedEvent, createDataSigningFailedEvent, WalletNotSupportFeatureError } from "@tonconnect/sdk";
|
|
53
|
+
import { TonConnectError, isWalletInfoCurrentlyInjected, toUserFriendlyAddress, CHAIN, TonConnect, isTelegramUrl, encodeTelegramUrlParameters, WalletMissingRequiredFeaturesError, isWalletInfoRemote, checkRequiredWalletFeatures, isWalletInfoCurrentlyEmbedded, BrowserEventDispatcher, createVersionInfo, createResponseVersionEvent, createRequestVersionEvent, createConnectionStartedEvent, createConnectionCompletedEvent, createConnectionErrorEvent, createConnectionRestoringStartedEvent, createConnectionRestoringCompletedEvent, createConnectionRestoringErrorEvent, createDisconnectionEvent, createTransactionSentForSignatureEvent, createTransactionSignedEvent, createTransactionSigningFailedEvent, createDataSentForSignatureEvent, createDataSignedEvent, createDataSigningFailedEvent, WalletNotSupportFeatureError, SessionCrypto } from "@tonconnect/sdk";
|
|
54
54
|
export * from "@tonconnect/sdk";
|
|
55
55
|
import UAParser from "ua-parser-js";
|
|
56
56
|
import deepmerge from "deepmerge";
|
|
@@ -1753,6 +1753,9 @@ function disableScroll() {
|
|
|
1753
1753
|
document.body.classList.add(disableScrollClass);
|
|
1754
1754
|
}
|
|
1755
1755
|
function enableScroll() {
|
|
1756
|
+
if (!document.body.classList.contains(disableScrollClass)) {
|
|
1757
|
+
return;
|
|
1758
|
+
}
|
|
1756
1759
|
document.body.classList.remove(disableScrollClass);
|
|
1757
1760
|
document.documentElement.scrollTo({ top: -parseFloat(getComputedStyle(document.body).top) });
|
|
1758
1761
|
document.body.style.top = "auto";
|
|
@@ -5679,7 +5682,6 @@ const WalletItemStyled = styled.button`
|
|
|
5679
5682
|
border: none;
|
|
5680
5683
|
background-color: unset;
|
|
5681
5684
|
padding: 8px 4px;
|
|
5682
|
-
width: 100%;
|
|
5683
5685
|
min-width: 78px;
|
|
5684
5686
|
display: flex;
|
|
5685
5687
|
flex-direction: column;
|
|
@@ -8942,16 +8944,19 @@ function redirectToTelegram(universalLink, options) {
|
|
|
8942
8944
|
}
|
|
8943
8945
|
if (isInTelegramBrowser()) {
|
|
8944
8946
|
options.returnStrategy = "back";
|
|
8945
|
-
const
|
|
8946
|
-
|
|
8947
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8948
|
+
directLinkUrl.toString(),
|
|
8949
|
+
options.returnStrategy
|
|
8950
|
+
);
|
|
8951
|
+
openLinkBlank(linkWithStrategy);
|
|
8947
8952
|
} else if (isInTMA()) {
|
|
8948
8953
|
if (isTmaPlatform("ios", "android", "macos", "tdesktop", "web")) {
|
|
8949
8954
|
options.returnStrategy = "back";
|
|
8950
|
-
const
|
|
8955
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8951
8956
|
directLinkUrl.toString(),
|
|
8952
8957
|
options.returnStrategy
|
|
8953
8958
|
);
|
|
8954
|
-
sendOpenTelegramLink(
|
|
8959
|
+
sendOpenTelegramLink(linkWithStrategy);
|
|
8955
8960
|
} else if (isTmaPlatform("weba")) {
|
|
8956
8961
|
sendOpenTelegramLink(addReturnStrategy(directLinkUrl.toString(), options));
|
|
8957
8962
|
} else {
|
|
@@ -9064,8 +9069,8 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
|
9064
9069
|
openLink(addReturnStrategy(universalLink, options.returnStrategy), "_self");
|
|
9065
9070
|
} else {
|
|
9066
9071
|
setOpenMethod("universal-link");
|
|
9067
|
-
const
|
|
9068
|
-
openLinkBlank(
|
|
9072
|
+
const linkWithStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
9073
|
+
openLinkBlank(linkWithStrategy);
|
|
9069
9074
|
}
|
|
9070
9075
|
} else if (isInTMA()) {
|
|
9071
9076
|
if (isTmaPlatform("ios", "android")) {
|
|
@@ -9073,26 +9078,26 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
|
9073
9078
|
options.returnStrategy = "tg://resolve";
|
|
9074
9079
|
}
|
|
9075
9080
|
setOpenMethod("universal-link");
|
|
9076
|
-
const
|
|
9077
|
-
sendOpenTelegramLink(
|
|
9081
|
+
const linkWithStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
9082
|
+
sendOpenTelegramLink(linkWithStrategy, () => {
|
|
9078
9083
|
setOpenMethod("universal-link");
|
|
9079
|
-
openLinkBlank(
|
|
9084
|
+
openLinkBlank(linkWithStrategy);
|
|
9080
9085
|
});
|
|
9081
9086
|
} else if (isTmaPlatform("macos", "tdesktop")) {
|
|
9082
9087
|
if (options.returnStrategy === "back") {
|
|
9083
9088
|
options.returnStrategy = "tg://resolve";
|
|
9084
9089
|
}
|
|
9085
|
-
const
|
|
9090
|
+
const linkWithStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
9086
9091
|
const useDeepLink = !!deepLink && !options.forceRedirect;
|
|
9087
9092
|
if (useDeepLink) {
|
|
9088
9093
|
setOpenMethod("custom-deeplink");
|
|
9089
|
-
openDeeplinkWithFallback(toDeeplink(
|
|
9094
|
+
openDeeplinkWithFallback(toDeeplink(linkWithStrategy, deepLink), () => {
|
|
9090
9095
|
setOpenMethod("universal-link");
|
|
9091
|
-
openLinkBlank(
|
|
9096
|
+
openLinkBlank(linkWithStrategy);
|
|
9092
9097
|
});
|
|
9093
9098
|
} else {
|
|
9094
9099
|
setOpenMethod("universal-link");
|
|
9095
|
-
openLinkBlank(
|
|
9100
|
+
openLinkBlank(linkWithStrategy);
|
|
9096
9101
|
}
|
|
9097
9102
|
} else if (isTmaPlatform("weba")) {
|
|
9098
9103
|
if (options.returnStrategy === "back") {
|
|
@@ -9108,17 +9113,17 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
|
9108
9113
|
options.returnStrategy = location.href;
|
|
9109
9114
|
}
|
|
9110
9115
|
}
|
|
9111
|
-
const
|
|
9116
|
+
const linkWithStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
9112
9117
|
const useDeepLink = !!deepLink && !options.forceRedirect;
|
|
9113
9118
|
if (useDeepLink) {
|
|
9114
9119
|
setOpenMethod("custom-deeplink");
|
|
9115
|
-
openDeeplinkWithFallback(toDeeplink(
|
|
9120
|
+
openDeeplinkWithFallback(toDeeplink(linkWithStrategy, deepLink), () => {
|
|
9116
9121
|
setOpenMethod("universal-link");
|
|
9117
|
-
openLinkBlank(
|
|
9122
|
+
openLinkBlank(linkWithStrategy);
|
|
9118
9123
|
});
|
|
9119
9124
|
} else {
|
|
9120
9125
|
setOpenMethod("universal-link");
|
|
9121
|
-
openLinkBlank(
|
|
9126
|
+
openLinkBlank(linkWithStrategy);
|
|
9122
9127
|
}
|
|
9123
9128
|
} else if (isTmaPlatform("web")) {
|
|
9124
9129
|
if (options.returnStrategy === "back") {
|
|
@@ -9134,22 +9139,22 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
|
9134
9139
|
options.returnStrategy = location.href;
|
|
9135
9140
|
}
|
|
9136
9141
|
}
|
|
9137
|
-
const
|
|
9142
|
+
const linkWithStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
9138
9143
|
const useDeepLink = !!deepLink && !options.forceRedirect;
|
|
9139
9144
|
if (useDeepLink) {
|
|
9140
9145
|
setOpenMethod("custom-deeplink");
|
|
9141
|
-
openDeeplinkWithFallback(toDeeplink(
|
|
9146
|
+
openDeeplinkWithFallback(toDeeplink(linkWithStrategy, deepLink), () => {
|
|
9142
9147
|
setOpenMethod("universal-link");
|
|
9143
|
-
openLinkBlank(
|
|
9148
|
+
openLinkBlank(linkWithStrategy);
|
|
9144
9149
|
});
|
|
9145
9150
|
} else {
|
|
9146
9151
|
setOpenMethod("universal-link");
|
|
9147
|
-
openLinkBlank(
|
|
9152
|
+
openLinkBlank(linkWithStrategy);
|
|
9148
9153
|
}
|
|
9149
9154
|
} else {
|
|
9150
9155
|
setOpenMethod("universal-link");
|
|
9151
|
-
const
|
|
9152
|
-
openLinkBlank(
|
|
9156
|
+
const linkWithStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
9157
|
+
openLinkBlank(linkWithStrategy);
|
|
9153
9158
|
}
|
|
9154
9159
|
} else {
|
|
9155
9160
|
if (isOS("ios")) {
|
|
@@ -9222,17 +9227,17 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
|
9222
9227
|
options.returnStrategy = "none";
|
|
9223
9228
|
}
|
|
9224
9229
|
}
|
|
9225
|
-
const
|
|
9230
|
+
const linkWithStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
9226
9231
|
const useDeepLink = !!deepLink && !options.forceRedirect;
|
|
9227
9232
|
if (useDeepLink) {
|
|
9228
9233
|
setOpenMethod("custom-deeplink");
|
|
9229
|
-
openDeeplinkWithFallback(toDeeplink(
|
|
9234
|
+
openDeeplinkWithFallback(toDeeplink(linkWithStrategy, deepLink), () => {
|
|
9230
9235
|
setOpenMethod("universal-link");
|
|
9231
|
-
openLinkBlank(
|
|
9236
|
+
openLinkBlank(linkWithStrategy);
|
|
9232
9237
|
});
|
|
9233
9238
|
} else {
|
|
9234
9239
|
setOpenMethod("universal-link");
|
|
9235
|
-
openLinkBlank(
|
|
9240
|
+
openLinkBlank(linkWithStrategy);
|
|
9236
9241
|
}
|
|
9237
9242
|
} else {
|
|
9238
9243
|
setOpenMethod("universal-link");
|
|
@@ -9240,6 +9245,14 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
|
9240
9245
|
}
|
|
9241
9246
|
}
|
|
9242
9247
|
}
|
|
9248
|
+
function addSessionIdToUniversalLink(universalLink, sessionId) {
|
|
9249
|
+
if (!sessionId) {
|
|
9250
|
+
return universalLink;
|
|
9251
|
+
}
|
|
9252
|
+
const url = new URL(universalLink);
|
|
9253
|
+
url.searchParams.set("id", sessionId);
|
|
9254
|
+
return url.toString();
|
|
9255
|
+
}
|
|
9243
9256
|
function addQueryParameter(url, key, value) {
|
|
9244
9257
|
const parsed = new URL(url);
|
|
9245
9258
|
parsed.searchParams.append(key, value);
|
|
@@ -9257,7 +9270,8 @@ function convertToTGDeepLink(directLink) {
|
|
|
9257
9270
|
const parsed = new URL(directLink);
|
|
9258
9271
|
const [, domain, appname] = parsed.pathname.split("/");
|
|
9259
9272
|
const startapp = parsed.searchParams.get("startapp");
|
|
9260
|
-
|
|
9273
|
+
const id = parsed.searchParams.get("id");
|
|
9274
|
+
return `tg://resolve?domain=${domain}&appname=${appname}&startapp=${startapp}&id=${id}`;
|
|
9261
9275
|
}
|
|
9262
9276
|
const DesktopConnectionModal = (props) => {
|
|
9263
9277
|
const [mode, setMode] = createSignal("mobile");
|
|
@@ -11307,6 +11321,7 @@ const WalletsModal = () => {
|
|
|
11307
11321
|
createEffect(() => {
|
|
11308
11322
|
if (getWalletsModalIsOpened()) {
|
|
11309
11323
|
updateIsMobile();
|
|
11324
|
+
refetchWallets();
|
|
11310
11325
|
} else {
|
|
11311
11326
|
setSelectedWalletInfo(null);
|
|
11312
11327
|
setSelectedTab("universal");
|
|
@@ -11315,7 +11330,11 @@ const WalletsModal = () => {
|
|
|
11315
11330
|
});
|
|
11316
11331
|
const connector = useContext(ConnectorContext);
|
|
11317
11332
|
const tonConnectUI = useContext(TonConnectUiContext);
|
|
11318
|
-
const [fetchedWalletsList
|
|
11333
|
+
const [fetchedWalletsList, {
|
|
11334
|
+
refetch: refetchWallets
|
|
11335
|
+
}] = createResource(() => {
|
|
11336
|
+
return tonConnectUI.getWallets();
|
|
11337
|
+
});
|
|
11319
11338
|
const [selectedWalletInfo, setSelectedWalletInfo] = createSignal(null);
|
|
11320
11339
|
const [selectedWalletError, setSelectedWalletError] = createSignal(null);
|
|
11321
11340
|
const [selectedTab, setSelectedTab] = createSignal("universal");
|
|
@@ -11598,14 +11617,15 @@ const ActionModal = (props) => {
|
|
|
11598
11617
|
const returnStrategy = "returnStrategy" in currentAction ? currentAction.returnStrategy : appState.returnStrategy;
|
|
11599
11618
|
const forceRedirect = !firstClick();
|
|
11600
11619
|
setFirstClick(false);
|
|
11620
|
+
const linkWithSessionId = addSessionIdToUniversalLink(universalLink, currentAction.sessionId);
|
|
11601
11621
|
if (isTelegramUrl(universalLink)) {
|
|
11602
|
-
redirectToTelegram(
|
|
11622
|
+
redirectToTelegram(linkWithSessionId, {
|
|
11603
11623
|
returnStrategy,
|
|
11604
11624
|
twaReturnUrl: "twaReturnUrl" in currentAction ? currentAction.twaReturnUrl : appState.twaReturnUrl,
|
|
11605
11625
|
forceRedirect
|
|
11606
11626
|
});
|
|
11607
11627
|
} else {
|
|
11608
|
-
redirectToWallet(
|
|
11628
|
+
redirectToWallet(linkWithSessionId, deepLink, {
|
|
11609
11629
|
returnStrategy,
|
|
11610
11630
|
forceRedirect
|
|
11611
11631
|
}, () => {
|
|
@@ -12468,7 +12488,7 @@ class TonConnectUITracker {
|
|
|
12468
12488
|
}
|
|
12469
12489
|
}
|
|
12470
12490
|
}
|
|
12471
|
-
const tonConnectUiVersion = "2.3.0-beta.
|
|
12491
|
+
const tonConnectUiVersion = "2.3.0-beta.3";
|
|
12472
12492
|
class TonConnectUI {
|
|
12473
12493
|
// TODO: `actionsConfiguration.twaReturnUrl` is used only in `connectWallet` method, but it's not used in `sendTransaction` method, NEED TO FIX IT
|
|
12474
12494
|
constructor(options) {
|
|
@@ -12755,11 +12775,13 @@ class TonConnectUI {
|
|
|
12755
12775
|
sendExpand();
|
|
12756
12776
|
}
|
|
12757
12777
|
const { notifications: notifications2, modals, returnStrategy, twaReturnUrl } = this.getModalsAndNotificationsConfiguration(options);
|
|
12778
|
+
const sessionId = yield this.getSessionId();
|
|
12758
12779
|
widgetController.setAction({
|
|
12759
12780
|
name: "confirm-transaction",
|
|
12760
12781
|
showNotification: notifications2.includes("before"),
|
|
12761
12782
|
openModal: modals.includes("before"),
|
|
12762
|
-
sent: false
|
|
12783
|
+
sent: false,
|
|
12784
|
+
sessionId: sessionId || void 0
|
|
12763
12785
|
});
|
|
12764
12786
|
const abortController = new AbortController();
|
|
12765
12787
|
const onRequestSent = () => {
|
|
@@ -12771,25 +12793,28 @@ class TonConnectUI {
|
|
|
12771
12793
|
name: "confirm-transaction",
|
|
12772
12794
|
showNotification: notifications2.includes("before"),
|
|
12773
12795
|
openModal: modals.includes("before"),
|
|
12774
|
-
sent: true
|
|
12796
|
+
sent: true,
|
|
12797
|
+
sessionId: sessionId || void 0
|
|
12775
12798
|
});
|
|
12776
12799
|
this.redirectAfterRequestSent({
|
|
12777
12800
|
returnStrategy,
|
|
12778
|
-
twaReturnUrl
|
|
12801
|
+
twaReturnUrl,
|
|
12802
|
+
sessionId: sessionId || void 0
|
|
12779
12803
|
});
|
|
12780
12804
|
let firstClick = true;
|
|
12781
|
-
const redirectToWallet2 = () => {
|
|
12805
|
+
const redirectToWallet2 = () => __async(this, null, function* () {
|
|
12782
12806
|
if (abortController.signal.aborted) {
|
|
12783
12807
|
return;
|
|
12784
12808
|
}
|
|
12785
12809
|
const forceRedirect = !firstClick;
|
|
12786
12810
|
firstClick = false;
|
|
12787
|
-
this.redirectAfterRequestSent({
|
|
12811
|
+
yield this.redirectAfterRequestSent({
|
|
12788
12812
|
returnStrategy,
|
|
12789
12813
|
twaReturnUrl,
|
|
12790
|
-
forceRedirect
|
|
12814
|
+
forceRedirect,
|
|
12815
|
+
sessionId: sessionId || void 0
|
|
12791
12816
|
});
|
|
12792
|
-
};
|
|
12817
|
+
});
|
|
12793
12818
|
(_a2 = options == null ? void 0 : options.onRequestSent) == null ? void 0 : _a2.call(options, redirectToWallet2);
|
|
12794
12819
|
};
|
|
12795
12820
|
const unsubscribe = this.onTransactionModalStateChange((action2) => {
|
|
@@ -12853,11 +12878,13 @@ class TonConnectUI {
|
|
|
12853
12878
|
sendExpand();
|
|
12854
12879
|
}
|
|
12855
12880
|
const { notifications: notifications2, modals, returnStrategy, twaReturnUrl } = this.getModalsAndNotificationsConfiguration();
|
|
12881
|
+
const sessionId = yield this.getSessionId();
|
|
12856
12882
|
widgetController.setAction({
|
|
12857
12883
|
name: "confirm-sign-data",
|
|
12858
12884
|
showNotification: notifications2.includes("before"),
|
|
12859
12885
|
openModal: modals.includes("before"),
|
|
12860
|
-
signed: false
|
|
12886
|
+
signed: false,
|
|
12887
|
+
sessionId: sessionId || void 0
|
|
12861
12888
|
});
|
|
12862
12889
|
const abortController = new AbortController();
|
|
12863
12890
|
const onRequestSent = () => {
|
|
@@ -12869,11 +12896,13 @@ class TonConnectUI {
|
|
|
12869
12896
|
name: "confirm-sign-data",
|
|
12870
12897
|
showNotification: notifications2.includes("before"),
|
|
12871
12898
|
openModal: modals.includes("before"),
|
|
12872
|
-
signed: true
|
|
12899
|
+
signed: true,
|
|
12900
|
+
sessionId: sessionId || void 0
|
|
12873
12901
|
});
|
|
12874
12902
|
this.redirectAfterRequestSent({
|
|
12875
12903
|
returnStrategy,
|
|
12876
|
-
twaReturnUrl
|
|
12904
|
+
twaReturnUrl,
|
|
12905
|
+
sessionId: sessionId || void 0
|
|
12877
12906
|
});
|
|
12878
12907
|
let firstClick = true;
|
|
12879
12908
|
const redirectToWallet2 = () => {
|
|
@@ -12885,7 +12914,8 @@ class TonConnectUI {
|
|
|
12885
12914
|
this.redirectAfterRequestSent({
|
|
12886
12915
|
returnStrategy,
|
|
12887
12916
|
twaReturnUrl,
|
|
12888
|
-
forceRedirect
|
|
12917
|
+
forceRedirect,
|
|
12918
|
+
sessionId: sessionId || void 0
|
|
12889
12919
|
});
|
|
12890
12920
|
};
|
|
12891
12921
|
(_a2 = options == null ? void 0 : options.onRequestSent) == null ? void 0 : _a2.call(options, redirectToWallet2);
|
|
@@ -12936,21 +12966,58 @@ class TonConnectUI {
|
|
|
12936
12966
|
}
|
|
12937
12967
|
});
|
|
12938
12968
|
}
|
|
12969
|
+
/**
|
|
12970
|
+
* Gets the current session ID if available.
|
|
12971
|
+
* @returns session ID string or null if not available.
|
|
12972
|
+
*/
|
|
12973
|
+
getSessionId() {
|
|
12974
|
+
return __async(this, null, function* () {
|
|
12975
|
+
var _a2, _b2;
|
|
12976
|
+
if (!this.connected) {
|
|
12977
|
+
return null;
|
|
12978
|
+
}
|
|
12979
|
+
try {
|
|
12980
|
+
const storage = (_a2 = this.connector.dappSettings) == null ? void 0 : _a2.storage;
|
|
12981
|
+
if (storage) {
|
|
12982
|
+
const stored = yield storage.getItem("ton-connect-storage_bridge-connection");
|
|
12983
|
+
if (stored) {
|
|
12984
|
+
const connection = JSON.parse(stored);
|
|
12985
|
+
if (connection.type === "http" && connection.sessionCrypto) {
|
|
12986
|
+
const sessionCrypto = new SessionCrypto(connection.sessionCrypto);
|
|
12987
|
+
const sessionId = sessionCrypto.sessionId;
|
|
12988
|
+
return sessionId;
|
|
12989
|
+
} else if (connection.type === "http" && ((_b2 = connection.session) == null ? void 0 : _b2.sessionKeyPair)) {
|
|
12990
|
+
const sessionCrypto = new SessionCrypto(connection.session.sessionKeyPair);
|
|
12991
|
+
const sessionId = sessionCrypto.sessionId;
|
|
12992
|
+
return sessionId;
|
|
12993
|
+
}
|
|
12994
|
+
}
|
|
12995
|
+
}
|
|
12996
|
+
} catch (e2) {
|
|
12997
|
+
}
|
|
12998
|
+
return null;
|
|
12999
|
+
});
|
|
13000
|
+
}
|
|
12939
13001
|
redirectAfterRequestSent({
|
|
12940
13002
|
returnStrategy,
|
|
12941
13003
|
twaReturnUrl,
|
|
12942
|
-
forceRedirect
|
|
13004
|
+
forceRedirect,
|
|
13005
|
+
sessionId
|
|
12943
13006
|
}) {
|
|
12944
13007
|
if (this.walletInfo && "universalLink" in this.walletInfo && (this.walletInfo.openMethod === "universal-link" || this.walletInfo.openMethod === "custom-deeplink")) {
|
|
13008
|
+
const linkWithSessionId = addSessionIdToUniversalLink(
|
|
13009
|
+
this.walletInfo.universalLink,
|
|
13010
|
+
sessionId
|
|
13011
|
+
);
|
|
12945
13012
|
if (isTelegramUrl(this.walletInfo.universalLink)) {
|
|
12946
|
-
redirectToTelegram(
|
|
13013
|
+
redirectToTelegram(linkWithSessionId, {
|
|
12947
13014
|
returnStrategy,
|
|
12948
13015
|
twaReturnUrl: twaReturnUrl || appState.twaReturnUrl,
|
|
12949
13016
|
forceRedirect: forceRedirect || false
|
|
12950
13017
|
});
|
|
12951
13018
|
} else {
|
|
12952
13019
|
redirectToWallet(
|
|
12953
|
-
|
|
13020
|
+
linkWithSessionId,
|
|
12954
13021
|
this.walletInfo.deepLink,
|
|
12955
13022
|
{
|
|
12956
13023
|
returnStrategy,
|