@tonconnect/ui
Advanced tools
Comparing version 1.0.0-beta.5 to 1.0.0-beta.6
@@ -122,2 +122,7 @@ import { WalletInfoBase, WalletInfoInjectable, WalletInfoRemote, ITonConnect, Wallet, WalletInfo, Account, ConnectAdditionalRequest, TonConnectError, SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk'; | ||
returnStrategy?: ReturnStrategy; | ||
/** | ||
* Specifies whether the method should redirect user to the connected wallet | ||
* @default 'ios' | ||
*/ | ||
skipRedirectToWallet?: 'ios' | 'always' | 'never'; | ||
} | ||
@@ -124,0 +129,0 @@ |
{ | ||
"name": "@tonconnect/ui", | ||
"version": "1.0.0-beta.5", | ||
"version": "1.0.0-beta.6", | ||
"scripts": { | ||
@@ -52,3 +52,4 @@ "start": "vite --host", | ||
"deepmerge": "^4.2.2", | ||
"@tonconnect/sdk": "^2.1.3" | ||
"@tonconnect/sdk": "^2.1.3", | ||
"ua-parser-js": "^1.0.35" | ||
}, | ||
@@ -72,3 +73,4 @@ "devDependencies": { | ||
"rollup": "^3.8.0", | ||
"solid-devtools": "^0.24.7" | ||
"solid-devtools": "^0.24.7", | ||
"@types/ua-parser-js": "^0.7.36" | ||
}, | ||
@@ -75,0 +77,0 @@ "typedoc": { |
@@ -204,2 +204,59 @@ # TON Connect UI | ||
## Universal links redirecting issues (IOS) | ||
Some operating systems, and especially iOS, have restrictions related to universal link usage. | ||
For instance, if you try to open a universal link on an iOS device via `window.open`, you can face the following problem: | ||
the mobile browser won't redirect the user to the wallet app and will open the fallback tab instead. | ||
That's because universal links can only be opened synchronously after a user's action in the browser (button click/...). | ||
This means that you either can't perform any asynchronous requests after the user clicks an action button in your dapp, either you can't redirect the user to the connected wallet on some devices. | ||
So, by default, if the user's operating system is iOS, they won't be automatically redirected to the wallet after the dapp calls `tonConnectUI.sendTransaction`. | ||
You can change this behavior using the skipRedirectToWallet option: | ||
```ts | ||
const result = await tonConnectUI.sendTransaction(defaultTx, { | ||
modals: ['before', 'success', 'error'], | ||
notifications: ['before', 'success', 'error'], | ||
skipRedirectToWallet: 'ios' //'ios' (default), or 'never', or 'always' | ||
}); | ||
``` | ||
<details> | ||
<summary>You can set it globally with `uiOptions` setter, and it will be applied for all actions (send transaction/...).</summary> | ||
```ts | ||
tonConnectUI.uiOptions = { | ||
actionsConfiguration: { | ||
skipRedirectToWallet: 'ios' | ||
} | ||
}; | ||
``` | ||
</details> | ||
<details> | ||
<summary>You should use the option `'never'` if there are no any async calls in the action button's click handler before `tonConnectUI.sendTransaction` call</summary> | ||
```ts | ||
// use skipRedirectToWallet: 'never' for better UX | ||
const onClick = async () => { | ||
const txBody = packTxBodySynchrone(); | ||
tonConnectUI.sendTransaction(txBody, { skipRedirectToWallet: 'never' }); | ||
const myApiResponse = await notifyBackend(); | ||
//... | ||
} | ||
``` | ||
```ts | ||
// DON'T use skipRedirectToWallet: 'never', you should use skipRedirectToWallet: 'ios' | ||
const onClick = async () => { | ||
const myApiResponse = await notifyBackend(); | ||
const txBody = packTxBodySynchrone(); | ||
tonConnectUI.sendTransaction(txBody, { skipRedirectToWallet: 'ios' }); | ||
//... | ||
} | ||
``` | ||
</details> | ||
## Add the return strategy | ||
@@ -206,0 +263,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2865203
18498
614
4
18
+ Addedua-parser-js@^1.0.35
+ Addedua-parser-js@1.0.40(transitive)