@tonconnect/ui 0.0.14 → 0.0.16

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/README.md CHANGED
@@ -193,6 +193,42 @@ const defaultBehaviour = {
193
193
  }
194
194
  ```
195
195
 
196
+ You can also modify this behaviour for all actions calls using `uiOptions` setter:
197
+ ```ts
198
+ tonConnectUI.uiOptions = {
199
+ actionsConfiguration: {
200
+ modals: ['before', 'success', 'error'],
201
+ notifications: ['before', 'success', 'error']
202
+ }
203
+ };
204
+ ```
205
+
206
+ ## Add the return strategy
207
+
208
+ Return strategy (optional) specifies return strategy for the deeplink when user signs/declines the request.
209
+
210
+ 'back' (default) means return to the app which initialized deeplink jump (e.g. browser, native app, ...),
211
+ 'none' means no jumps after user action;
212
+ a URL: wallet will open this URL after completing the user's action. Note, that you shouldn't pass your app's URL if it is a webpage. This option should be used for native apps to work around possible OS-specific issues with 'back' option.
213
+
214
+ You can set it globally with `uiOptions` setter, and it will be applied for connect request and all subsequent actions (send transaction/...).
215
+
216
+ ```ts
217
+ tonConnectUI.uiOptions = {
218
+ actionsConfiguration: {
219
+ returnStrategy: 'none'
220
+ }
221
+ };
222
+ ```
223
+
224
+ Or you can set it directly when you send a transaction (will be applied only for this transaction request)
225
+ ```ts
226
+ const result = await tonConnectUI.sendTransaction(defaultTx, {
227
+ returnStrategy: '<protocol>://<your_return_url>' // Note, that you shouldn't pass your app's URL if it is a webpage.
228
+ // This option should be used for native apps to work around possible OS-specific issues with 'back' option.
229
+ });
230
+ ```
231
+
196
232
  ## Detect end of the connection restoring process
197
233
  Before restoring previous connected wallet TonConnect has to set up SSE connection with bridge, so you have to wait a little while connection restoring.
198
234
  If you need to update your UI depending on if connection is restoring, you can use `tonConnectUI.connectionRestored` promise.