@tonconnect/ui 2.0.1 → 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.mjs CHANGED
@@ -6932,12 +6932,16 @@ function useOpenedNotifications(config) {
6932
6932
  const [timeoutIds, setTimeoutIds] = createSignal([]);
6933
6933
  createEffect(
6934
6934
  on(action, (action2) => {
6935
+ var _a2;
6935
6936
  if (!action2 || !action2.showNotification) {
6936
6937
  return;
6937
6938
  }
6938
6939
  if (latestAction() === action2) {
6939
6940
  return;
6940
6941
  }
6942
+ if (((_a2 = latestAction()) == null ? void 0 : _a2.name) === "confirm-transaction" && action2.name === "confirm-transaction") {
6943
+ return;
6944
+ }
6941
6945
  setLatestAction(action2);
6942
6946
  setOpenedNotifications(
6943
6947
  (openedNotifications2) => openedNotifications2.filter((n2) => n2.action !== "confirm-transaction")
@@ -8337,7 +8341,17 @@ function redirectToTelegram(universalLink, options) {
8337
8341
  } else {
8338
8342
  if (isOS("ios")) {
8339
8343
  if (options.returnStrategy === "back") {
8340
- options.returnStrategy = location.href;
8344
+ if (isBrowser("safari")) {
8345
+ options.returnStrategy = "back";
8346
+ } else if (isBrowser("chrome")) {
8347
+ options.returnStrategy = "googlechrome://";
8348
+ } else if (isBrowser("firefox")) {
8349
+ options.returnStrategy = "firefox://";
8350
+ } else if (isBrowser("opera")) {
8351
+ options.returnStrategy = "opera-http://";
8352
+ } else {
8353
+ options.returnStrategy = location.href;
8354
+ }
8341
8355
  }
8342
8356
  const isChrome = isBrowser("chrome");
8343
8357
  const isFirefox = isBrowser("firefox");
@@ -8377,7 +8391,17 @@ function redirectToTelegram(universalLink, options) {
8377
8391
  }
8378
8392
  } else if (isOS("ipad")) {
8379
8393
  if (options.returnStrategy === "back") {
8380
- options.returnStrategy = "back";
8394
+ if (isBrowser("safari")) {
8395
+ options.returnStrategy = "back";
8396
+ } else if (isBrowser("chrome")) {
8397
+ options.returnStrategy = "googlechrome://";
8398
+ } else if (isBrowser("firefox")) {
8399
+ options.returnStrategy = "firefox://";
8400
+ } else if (isBrowser("opera")) {
8401
+ options.returnStrategy = "opera-http://";
8402
+ } else {
8403
+ options.returnStrategy = location.href;
8404
+ }
8381
8405
  }
8382
8406
  const isChrome = isBrowser("chrome");
8383
8407
  const isFirefox = isBrowser("firefox");
@@ -8501,7 +8525,7 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
8501
8525
  if (isOS("ios")) {
8502
8526
  if (options.returnStrategy === "back") {
8503
8527
  if (isBrowser("safari")) {
8504
- options.returnStrategy = location.href;
8528
+ options.returnStrategy = "none";
8505
8529
  } else if (isBrowser("chrome")) {
8506
8530
  options.returnStrategy = "googlechrome://";
8507
8531
  } else if (isBrowser("firefox")) {
@@ -8535,7 +8559,17 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
8535
8559
  openLinkBlank(addReturnStrategy(universalLink, options.returnStrategy));
8536
8560
  } else if (isOS("ipad")) {
8537
8561
  if (options.returnStrategy === "back") {
8538
- options.returnStrategy = "back";
8562
+ if (isBrowser("safari")) {
8563
+ options.returnStrategy = "none";
8564
+ } else if (isBrowser("chrome")) {
8565
+ options.returnStrategy = "googlechrome://";
8566
+ } else if (isBrowser("firefox")) {
8567
+ options.returnStrategy = "firefox://";
8568
+ } else if (isBrowser("opera")) {
8569
+ options.returnStrategy = "opera-http://";
8570
+ } else {
8571
+ options.returnStrategy = location.href;
8572
+ }
8539
8573
  }
8540
8574
  if (isBrowser("chrome")) {
8541
8575
  setOpenMethod("universal-link");
@@ -10201,7 +10235,7 @@ const ActionModal = (props) => {
10201
10235
  }
10202
10236
  }), createComponent(Show, {
10203
10237
  get when() {
10204
- return !sent();
10238
+ return !sent() && (props.showButton === "open-wallet" && universalLink || props.showButton !== "open-wallet");
10205
10239
  },
10206
10240
  get children() {
10207
10241
  return createComponent(LoaderButtonStyled, {
@@ -10598,8 +10632,8 @@ class TransactionModalManager {
10598
10632
  __publicField(this, "consumers", []);
10599
10633
  this.connector = options.connector;
10600
10634
  createEffect(() => {
10601
- const _ = action();
10602
- this.consumers.forEach((consumer) => consumer(_));
10635
+ const currentAction = action();
10636
+ this.consumers.forEach((consumer) => consumer(currentAction));
10603
10637
  });
10604
10638
  }
10605
10639
  onStateChange(consumer) {
@@ -10892,9 +10926,7 @@ class TonConnectUI {
10892
10926
  openModal: modals.includes("before"),
10893
10927
  sent: true
10894
10928
  });
10895
- const userOSIsIos = getUserAgent().os === "ios";
10896
- const shouldSkipRedirectToWallet = skipRedirectToWallet === "ios" && userOSIsIos || skipRedirectToWallet === "always";
10897
- if (this.walletInfo && "universalLink" in this.walletInfo && this.walletInfo.openMethod === "universal-link" && !shouldSkipRedirectToWallet) {
10929
+ if (this.walletInfo && "universalLink" in this.walletInfo && (this.walletInfo.openMethod === "universal-link" || this.walletInfo.openMethod === "custom-deeplink")) {
10898
10930
  if (isTelegramUrl(this.walletInfo.universalLink)) {
10899
10931
  redirectToTelegram(this.walletInfo.universalLink, {
10900
10932
  returnStrategy,
@@ -10902,7 +10934,16 @@ class TonConnectUI {
10902
10934
  forceRedirect: false
10903
10935
  });
10904
10936
  } else {
10905
- openLinkBlank(addReturnStrategy(this.walletInfo.universalLink, returnStrategy));
10937
+ redirectToWallet(
10938
+ this.walletInfo.universalLink,
10939
+ this.walletInfo.deepLink,
10940
+ {
10941
+ returnStrategy,
10942
+ forceRedirect: false
10943
+ },
10944
+ () => {
10945
+ }
10946
+ );
10906
10947
  }
10907
10948
  }
10908
10949
  };