@tonconnect/ui 2.0.1-beta.8 → 2.0.2-beta.0

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
@@ -6937,12 +6937,16 @@ function useOpenedNotifications(config) {
6937
6937
  const [timeoutIds, setTimeoutIds] = createSignal([]);
6938
6938
  createEffect(
6939
6939
  on(action, (action2) => {
6940
+ var _a2;
6940
6941
  if (!action2 || !action2.showNotification) {
6941
6942
  return;
6942
6943
  }
6943
6944
  if (latestAction() === action2) {
6944
6945
  return;
6945
6946
  }
6947
+ if (((_a2 = latestAction()) == null ? void 0 : _a2.name) === "confirm-transaction" && action2.name === "confirm-transaction") {
6948
+ return;
6949
+ }
6946
6950
  setLatestAction(action2);
6947
6951
  setOpenedNotifications(
6948
6952
  (openedNotifications2) => openedNotifications2.filter((n2) => n2.action !== "confirm-transaction")
@@ -8342,7 +8346,17 @@ function redirectToTelegram(universalLink, options) {
8342
8346
  } else {
8343
8347
  if (isOS("ios")) {
8344
8348
  if (options.returnStrategy === "back") {
8345
- options.returnStrategy = location.href;
8349
+ if (isBrowser("safari")) {
8350
+ options.returnStrategy = "back";
8351
+ } else if (isBrowser("chrome")) {
8352
+ options.returnStrategy = "googlechrome://";
8353
+ } else if (isBrowser("firefox")) {
8354
+ options.returnStrategy = "firefox://";
8355
+ } else if (isBrowser("opera")) {
8356
+ options.returnStrategy = "opera-http://";
8357
+ } else {
8358
+ options.returnStrategy = location.href;
8359
+ }
8346
8360
  }
8347
8361
  const isChrome = isBrowser("chrome");
8348
8362
  const isFirefox = isBrowser("firefox");
@@ -8382,7 +8396,17 @@ function redirectToTelegram(universalLink, options) {
8382
8396
  }
8383
8397
  } else if (isOS("ipad")) {
8384
8398
  if (options.returnStrategy === "back") {
8385
- options.returnStrategy = "back";
8399
+ if (isBrowser("safari")) {
8400
+ options.returnStrategy = "back";
8401
+ } else if (isBrowser("chrome")) {
8402
+ options.returnStrategy = "googlechrome://";
8403
+ } else if (isBrowser("firefox")) {
8404
+ options.returnStrategy = "firefox://";
8405
+ } else if (isBrowser("opera")) {
8406
+ options.returnStrategy = "opera-http://";
8407
+ } else {
8408
+ options.returnStrategy = location.href;
8409
+ }
8386
8410
  }
8387
8411
  const isChrome = isBrowser("chrome");
8388
8412
  const isFirefox = isBrowser("firefox");
@@ -8506,7 +8530,7 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
8506
8530
  if (isOS("ios")) {
8507
8531
  if (options.returnStrategy === "back") {
8508
8532
  if (isBrowser("safari")) {
8509
- options.returnStrategy = location.href;
8533
+ options.returnStrategy = "none";
8510
8534
  } else if (isBrowser("chrome")) {
8511
8535
  options.returnStrategy = "googlechrome://";
8512
8536
  } else if (isBrowser("firefox")) {
@@ -8540,7 +8564,17 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
8540
8564
  openLinkBlank(addReturnStrategy(universalLink, options.returnStrategy));
8541
8565
  } else if (isOS("ipad")) {
8542
8566
  if (options.returnStrategy === "back") {
8543
- options.returnStrategy = "back";
8567
+ if (isBrowser("safari")) {
8568
+ options.returnStrategy = "none";
8569
+ } else if (isBrowser("chrome")) {
8570
+ options.returnStrategy = "googlechrome://";
8571
+ } else if (isBrowser("firefox")) {
8572
+ options.returnStrategy = "firefox://";
8573
+ } else if (isBrowser("opera")) {
8574
+ options.returnStrategy = "opera-http://";
8575
+ } else {
8576
+ options.returnStrategy = location.href;
8577
+ }
8544
8578
  }
8545
8579
  if (isBrowser("chrome")) {
8546
8580
  setOpenMethod("universal-link");
@@ -10206,7 +10240,7 @@ const ActionModal = (props) => {
10206
10240
  }
10207
10241
  }), createComponent(Show, {
10208
10242
  get when() {
10209
- return !sent();
10243
+ return !sent() && (props.showButton === "open-wallet" && universalLink || props.showButton !== "open-wallet");
10210
10244
  },
10211
10245
  get children() {
10212
10246
  return createComponent(LoaderButtonStyled, {
@@ -10603,8 +10637,8 @@ class TransactionModalManager {
10603
10637
  __publicField(this, "consumers", []);
10604
10638
  this.connector = options.connector;
10605
10639
  createEffect(() => {
10606
- const _ = action();
10607
- this.consumers.forEach((consumer) => consumer(_));
10640
+ const currentAction = action();
10641
+ this.consumers.forEach((consumer) => consumer(currentAction));
10608
10642
  });
10609
10643
  }
10610
10644
  onStateChange(consumer) {
@@ -10897,9 +10931,7 @@ class TonConnectUI {
10897
10931
  openModal: modals.includes("before"),
10898
10932
  sent: true
10899
10933
  });
10900
- const userOSIsIos = getUserAgent().os === "ios";
10901
- const shouldSkipRedirectToWallet = skipRedirectToWallet === "ios" && userOSIsIos || skipRedirectToWallet === "always";
10902
- if (this.walletInfo && "universalLink" in this.walletInfo && this.walletInfo.openMethod === "universal-link" && !shouldSkipRedirectToWallet) {
10934
+ if (this.walletInfo && "universalLink" in this.walletInfo && (this.walletInfo.openMethod === "universal-link" || this.walletInfo.openMethod === "custom-deeplink")) {
10903
10935
  if (sdk.isTelegramUrl(this.walletInfo.universalLink)) {
10904
10936
  redirectToTelegram(this.walletInfo.universalLink, {
10905
10937
  returnStrategy,
@@ -10907,7 +10939,16 @@ class TonConnectUI {
10907
10939
  forceRedirect: false
10908
10940
  });
10909
10941
  } else {
10910
- openLinkBlank(addReturnStrategy(this.walletInfo.universalLink, returnStrategy));
10942
+ redirectToWallet(
10943
+ this.walletInfo.universalLink,
10944
+ this.walletInfo.deepLink,
10945
+ {
10946
+ returnStrategy,
10947
+ forceRedirect: false
10948
+ },
10949
+ () => {
10950
+ }
10951
+ );
10911
10952
  }
10912
10953
  }
10913
10954
  };