@tonconnect/ui 2.0.1-beta.2 → 2.0.1-beta.4
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 +3 -3
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +59 -4
- package/lib/index.cjs.map +1 -1
- package/lib/index.mjs +59 -4
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1869,11 +1869,15 @@ function isNodeJs() {
|
|
|
1869
1869
|
return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
1870
1870
|
}
|
|
1871
1871
|
function getUserAgent() {
|
|
1872
|
-
var _a2, _b2;
|
|
1872
|
+
var _a2, _b2, _c2;
|
|
1873
1873
|
const results = new UAParser().getResult();
|
|
1874
1874
|
const osName = (_a2 = results.os.name) == null ? void 0 : _a2.toLowerCase();
|
|
1875
|
+
const deviceModel = (_b2 = results.device.model) == null ? void 0 : _b2.toLowerCase();
|
|
1875
1876
|
let os;
|
|
1876
1877
|
switch (true) {
|
|
1878
|
+
case deviceModel === "ipad":
|
|
1879
|
+
os = "ipad";
|
|
1880
|
+
break;
|
|
1877
1881
|
case osName === "ios":
|
|
1878
1882
|
os = "ios";
|
|
1879
1883
|
break;
|
|
@@ -1890,7 +1894,7 @@ function getUserAgent() {
|
|
|
1890
1894
|
os = "windows";
|
|
1891
1895
|
break;
|
|
1892
1896
|
}
|
|
1893
|
-
const browserName = (
|
|
1897
|
+
const browserName = (_c2 = results.browser.name) == null ? void 0 : _c2.toLowerCase();
|
|
1894
1898
|
let browser;
|
|
1895
1899
|
switch (true) {
|
|
1896
1900
|
case browserName === "chrome":
|
|
@@ -2830,7 +2834,7 @@ function isDevice(device) {
|
|
|
2830
2834
|
return width > maxWidth.mobile;
|
|
2831
2835
|
default:
|
|
2832
2836
|
case "mobile":
|
|
2833
|
-
return width <= maxWidth.mobile || isOS("ios", "android");
|
|
2837
|
+
return width <= maxWidth.mobile || isOS("ios", "android", "ipad");
|
|
2834
2838
|
}
|
|
2835
2839
|
}
|
|
2836
2840
|
function media(device) {
|
|
@@ -8329,7 +8333,7 @@ function redirectToTelegram(universalLink, options) {
|
|
|
8329
8333
|
openLinkBlank(addReturnStrategy(directLinkUrl.toString(), options));
|
|
8330
8334
|
}
|
|
8331
8335
|
} else {
|
|
8332
|
-
if (isOS("ios"
|
|
8336
|
+
if (isOS("ios")) {
|
|
8333
8337
|
if (options.returnStrategy === "back") {
|
|
8334
8338
|
options.returnStrategy = location.href;
|
|
8335
8339
|
}
|
|
@@ -8350,6 +8354,46 @@ function redirectToTelegram(universalLink, options) {
|
|
|
8350
8354
|
);
|
|
8351
8355
|
openLinkBlank(linkWithStrategy);
|
|
8352
8356
|
}
|
|
8357
|
+
} else if (isOS("android")) {
|
|
8358
|
+
options.returnStrategy = "none";
|
|
8359
|
+
const isChrome = isBrowser("chrome");
|
|
8360
|
+
const isFirefox = isBrowser("firefox");
|
|
8361
|
+
const useDeepLink = (isChrome || isFirefox) && !options.forceRedirect;
|
|
8362
|
+
if (useDeepLink) {
|
|
8363
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8364
|
+
directLinkUrl.toString(),
|
|
8365
|
+
options.returnStrategy
|
|
8366
|
+
);
|
|
8367
|
+
const deepLink = convertToTGDeepLink(linkWithStrategy);
|
|
8368
|
+
openDeeplinkWithFallback(deepLink, () => openLinkBlank(linkWithStrategy));
|
|
8369
|
+
} else {
|
|
8370
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8371
|
+
directLinkUrl.toString(),
|
|
8372
|
+
options.returnStrategy
|
|
8373
|
+
);
|
|
8374
|
+
openLinkBlank(linkWithStrategy);
|
|
8375
|
+
}
|
|
8376
|
+
} else if (isOS("ipad")) {
|
|
8377
|
+
if (options.returnStrategy === "back") {
|
|
8378
|
+
options.returnStrategy = "back";
|
|
8379
|
+
}
|
|
8380
|
+
const isChrome = isBrowser("chrome");
|
|
8381
|
+
const isFirefox = isBrowser("firefox");
|
|
8382
|
+
const useDeepLink = (isChrome || isFirefox) && !options.forceRedirect;
|
|
8383
|
+
if (useDeepLink) {
|
|
8384
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8385
|
+
directLinkUrl.toString(),
|
|
8386
|
+
options.returnStrategy
|
|
8387
|
+
);
|
|
8388
|
+
const deepLink = convertToTGDeepLink(linkWithStrategy);
|
|
8389
|
+
openDeeplinkWithFallback(deepLink, () => openLinkBlank(linkWithStrategy));
|
|
8390
|
+
} else {
|
|
8391
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8392
|
+
directLinkUrl.toString(),
|
|
8393
|
+
options.returnStrategy
|
|
8394
|
+
);
|
|
8395
|
+
openLinkBlank(linkWithStrategy);
|
|
8396
|
+
}
|
|
8353
8397
|
} else if (isOS("macos", "windows", "linux")) {
|
|
8354
8398
|
options.returnStrategy = "none";
|
|
8355
8399
|
options.twaReturnUrl = void 0;
|
|
@@ -8487,6 +8531,17 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
|
8487
8531
|
}
|
|
8488
8532
|
setOpenMethod("universal-link");
|
|
8489
8533
|
openLinkBlank(addReturnStrategy(universalLink, options.returnStrategy));
|
|
8534
|
+
} else if (isOS("ipad")) {
|
|
8535
|
+
if (options.returnStrategy === "back") {
|
|
8536
|
+
options.returnStrategy = "back";
|
|
8537
|
+
}
|
|
8538
|
+
if (isBrowser("chrome")) {
|
|
8539
|
+
setOpenMethod("universal-link");
|
|
8540
|
+
openLink(addReturnStrategy(universalLink, options.returnStrategy), "_self");
|
|
8541
|
+
} else {
|
|
8542
|
+
setOpenMethod("universal-link");
|
|
8543
|
+
openLinkBlank(addReturnStrategy(universalLink, options.returnStrategy));
|
|
8544
|
+
}
|
|
8490
8545
|
} else if (isOS("macos", "windows", "linux")) {
|
|
8491
8546
|
if (options.returnStrategy === "back") {
|
|
8492
8547
|
if (isBrowser("safari")) {
|