@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/lib/index.cjs CHANGED
@@ -1874,11 +1874,15 @@ function isNodeJs() {
1874
1874
  return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
1875
1875
  }
1876
1876
  function getUserAgent() {
1877
- var _a2, _b2;
1877
+ var _a2, _b2, _c2;
1878
1878
  const results = new UAParser__default.default().getResult();
1879
1879
  const osName = (_a2 = results.os.name) == null ? void 0 : _a2.toLowerCase();
1880
+ const deviceModel = (_b2 = results.device.model) == null ? void 0 : _b2.toLowerCase();
1880
1881
  let os;
1881
1882
  switch (true) {
1883
+ case deviceModel === "ipad":
1884
+ os = "ipad";
1885
+ break;
1882
1886
  case osName === "ios":
1883
1887
  os = "ios";
1884
1888
  break;
@@ -1895,7 +1899,7 @@ function getUserAgent() {
1895
1899
  os = "windows";
1896
1900
  break;
1897
1901
  }
1898
- const browserName = (_b2 = results.browser.name) == null ? void 0 : _b2.toLowerCase();
1902
+ const browserName = (_c2 = results.browser.name) == null ? void 0 : _c2.toLowerCase();
1899
1903
  let browser;
1900
1904
  switch (true) {
1901
1905
  case browserName === "chrome":
@@ -2835,7 +2839,7 @@ function isDevice(device) {
2835
2839
  return width > maxWidth.mobile;
2836
2840
  default:
2837
2841
  case "mobile":
2838
- return width <= maxWidth.mobile || isOS("ios", "android");
2842
+ return width <= maxWidth.mobile || isOS("ios", "android", "ipad");
2839
2843
  }
2840
2844
  }
2841
2845
  function media(device) {
@@ -8334,7 +8338,7 @@ function redirectToTelegram(universalLink, options) {
8334
8338
  openLinkBlank(addReturnStrategy(directLinkUrl.toString(), options));
8335
8339
  }
8336
8340
  } else {
8337
- if (isOS("ios", "android")) {
8341
+ if (isOS("ios")) {
8338
8342
  if (options.returnStrategy === "back") {
8339
8343
  options.returnStrategy = location.href;
8340
8344
  }
@@ -8355,6 +8359,46 @@ function redirectToTelegram(universalLink, options) {
8355
8359
  );
8356
8360
  openLinkBlank(linkWithStrategy);
8357
8361
  }
8362
+ } else if (isOS("android")) {
8363
+ options.returnStrategy = "none";
8364
+ const isChrome = isBrowser("chrome");
8365
+ const isFirefox = isBrowser("firefox");
8366
+ const useDeepLink = (isChrome || isFirefox) && !options.forceRedirect;
8367
+ if (useDeepLink) {
8368
+ const linkWithStrategy = addReturnStrategy(
8369
+ directLinkUrl.toString(),
8370
+ options.returnStrategy
8371
+ );
8372
+ const deepLink = convertToTGDeepLink(linkWithStrategy);
8373
+ openDeeplinkWithFallback(deepLink, () => openLinkBlank(linkWithStrategy));
8374
+ } else {
8375
+ const linkWithStrategy = addReturnStrategy(
8376
+ directLinkUrl.toString(),
8377
+ options.returnStrategy
8378
+ );
8379
+ openLinkBlank(linkWithStrategy);
8380
+ }
8381
+ } else if (isOS("ipad")) {
8382
+ if (options.returnStrategy === "back") {
8383
+ options.returnStrategy = "back";
8384
+ }
8385
+ const isChrome = isBrowser("chrome");
8386
+ const isFirefox = isBrowser("firefox");
8387
+ const useDeepLink = (isChrome || isFirefox) && !options.forceRedirect;
8388
+ if (useDeepLink) {
8389
+ const linkWithStrategy = addReturnStrategy(
8390
+ directLinkUrl.toString(),
8391
+ options.returnStrategy
8392
+ );
8393
+ const deepLink = convertToTGDeepLink(linkWithStrategy);
8394
+ openDeeplinkWithFallback(deepLink, () => openLinkBlank(linkWithStrategy));
8395
+ } else {
8396
+ const linkWithStrategy = addReturnStrategy(
8397
+ directLinkUrl.toString(),
8398
+ options.returnStrategy
8399
+ );
8400
+ openLinkBlank(linkWithStrategy);
8401
+ }
8358
8402
  } else if (isOS("macos", "windows", "linux")) {
8359
8403
  options.returnStrategy = "none";
8360
8404
  options.twaReturnUrl = void 0;
@@ -8492,6 +8536,17 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
8492
8536
  }
8493
8537
  setOpenMethod("universal-link");
8494
8538
  openLinkBlank(addReturnStrategy(universalLink, options.returnStrategy));
8539
+ } else if (isOS("ipad")) {
8540
+ if (options.returnStrategy === "back") {
8541
+ options.returnStrategy = "back";
8542
+ }
8543
+ if (isBrowser("chrome")) {
8544
+ setOpenMethod("universal-link");
8545
+ openLink(addReturnStrategy(universalLink, options.returnStrategy), "_self");
8546
+ } else {
8547
+ setOpenMethod("universal-link");
8548
+ openLinkBlank(addReturnStrategy(universalLink, options.returnStrategy));
8549
+ }
8495
8550
  } else if (isOS("macos", "windows", "linux")) {
8496
8551
  if (options.returnStrategy === "back") {
8497
8552
  if (isBrowser("safari")) {