@tonconnect/ui 0.0.12 → 0.0.13

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { WalletInfoBase, WalletInfoInjected, WalletInfoRemote, ITonConnect, ConnectAdditionalRequest, WalletInfo, Account, Wallet, TonConnectError, SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk';
1
+ import { WalletInfoBase, WalletInfoInjected, WalletInfoRemote, ITonConnect, ConnectAdditionalRequest, Wallet, WalletInfo, Account, TonConnectError, SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk';
2
2
  import { Property } from 'csstype';
3
3
 
4
4
  declare type Locales = 'en' | 'ru';
@@ -34,7 +34,6 @@ declare type ColorsSet = {
34
34
  };
35
35
  text: {
36
36
  primary: Color$1;
37
- subhead: Color$1;
38
37
  secondary: Color$1;
39
38
  };
40
39
  };
@@ -60,7 +59,6 @@ declare type PartialColorsSet = {
60
59
  };
61
60
  text?: {
62
61
  primary?: Color$1;
63
- subhead?: Color$1;
64
62
  secondary?: Color$1;
65
63
  };
66
64
  };
@@ -190,6 +188,13 @@ interface TonConnectUiCreateOptionsBase extends TonConnectUiOptions {
190
188
  walletsListSource?: string;
191
189
  }
192
190
 
191
+ declare type WalletOpenMethod = 'qrcode' | 'universal-link';
192
+ declare type WalletInfoWithOpenMethod = WalletInfoInjected | WalletInfoRemoteWithOpenMethod | (WalletInfoInjected & WalletInfoRemoteWithOpenMethod);
193
+ declare type WalletInfoRemoteWithOpenMethod = WalletInfoRemote & {
194
+ openMethod: WalletOpenMethod;
195
+ };
196
+ declare type ConnectedWallet = Wallet & WalletInfoWithOpenMethod;
197
+
193
198
  declare class TonConnectUI {
194
199
  static getWallets(): Promise<WalletInfo[]>;
195
200
  private readonly walletInfoStorage;
@@ -197,6 +202,11 @@ declare class TonConnectUI {
197
202
  private _walletInfo;
198
203
  private systemThemeChangeUnsubscribe;
199
204
  private actionsConfiguration?;
205
+ /**
206
+ * Promise that resolves after end of th connection restoring process (promise will fire after `onStatusChange`, so you can get actual information about wallet and session after when promise resolved).
207
+ * Resolved value `true`/`false` indicates if the session was restored successfully.
208
+ */
209
+ readonly connectionRestored: Promise<boolean>;
200
210
  /**
201
211
  * Current connection status.
202
212
  */
@@ -212,7 +222,7 @@ declare class TonConnectUI {
212
222
  /**
213
223
  * Curren connected wallet's info or null.
214
224
  */
215
- get walletInfo(): WalletInfo | null;
225
+ get walletInfo(): WalletInfoWithOpenMethod | null;
216
226
  /**
217
227
  * Set and apply new UI options. Object with partial options should be passed. Passed options will be merged with current options.
218
228
  * @param options
@@ -227,11 +237,11 @@ declare class TonConnectUI {
227
237
  * Subscribe to connection status change.
228
238
  * @return function which has to be called to unsubscribe.
229
239
  */
230
- onStatusChange(callback: (wallet: (Wallet & WalletInfo) | null) => void, errorsHandler?: (err: TonConnectError) => void): ReturnType<ITonConnect['onStatusChange']>;
240
+ onStatusChange(callback: (wallet: ConnectedWallet | null) => void, errorsHandler?: (err: TonConnectError) => void): ReturnType<ITonConnect['onStatusChange']>;
231
241
  /**
232
242
  * Opens the modal window and handles a wallet connection.
233
243
  */
234
- connectWallet(): Promise<Wallet & WalletInfo>;
244
+ connectWallet(): Promise<ConnectedWallet>;
235
245
  /**
236
246
  * Disconnect wallet and clean localstorage.
237
247
  */
@@ -255,4 +265,4 @@ declare class TonConnectUIError extends TonConnectError {
255
265
  constructor(...args: ConstructorParameters<typeof Error>);
256
266
  }
257
267
 
258
- export { ActionConfiguration, BorderRadius, Color, ColorsSet, Locales, PartialColorsSet, THEME, Theme, TonConnectUI, TonConnectUIError, TonConnectUiCreateOptions, TonConnectUiCreateOptionsBase, TonConnectUiOptions, TonConnectUiOptionsWithConnector, TonConnectUiOptionsWithManifest, UIPreferences, UIWallet, WalletsListConfiguration, WalletsListConfigurationExplicit, WalletsListConfigurationImplicit, TonConnectUI as default };
268
+ export { ActionConfiguration, BorderRadius, Color, ColorsSet, ConnectedWallet, Locales, PartialColorsSet, THEME, Theme, TonConnectUI, TonConnectUIError, TonConnectUiCreateOptions, TonConnectUiCreateOptionsBase, TonConnectUiOptions, TonConnectUiOptionsWithConnector, TonConnectUiOptionsWithManifest, UIPreferences, UIWallet, WalletInfoRemoteWithOpenMethod, WalletInfoWithOpenMethod, WalletOpenMethod, WalletsListConfiguration, WalletsListConfigurationExplicit, WalletsListConfigurationImplicit, TonConnectUI as default };
package/lib/index.js CHANGED
@@ -5300,9 +5300,7 @@ function Dynamic(props) {
5300
5300
  });
5301
5301
  }
5302
5302
  const [walletsModalOpen, setWalletsModalOpen] = createSignal(false);
5303
- const [lastSelectedWalletInfo, setLastSelectedWalletInfo] = createSignal(
5304
- null
5305
- );
5303
+ const [lastSelectedWalletInfo, setLastSelectedWalletInfo] = createSignal(null);
5306
5304
  const [action, setAction] = createSignal(null);
5307
5305
  let e = { data: "" }, t = (t2) => "object" == typeof window ? ((t2 ? t2.querySelector("#_goober") : window._goober) || Object.assign((t2 || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : t2 || e, l = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, a = /\/\*[^]*?\*\/| +/g, n = /\n+/g, o = (e2, t2) => {
5308
5306
  let r = "", l2 = "", a2 = "";
@@ -5823,8 +5821,7 @@ const defaultLightColorsSet = {
5823
5821
  },
5824
5822
  text: {
5825
5823
  primary: "#0F0F0F",
5826
- secondary: "#7A8999",
5827
- subhead: "#6A7785"
5824
+ secondary: "#7A8999"
5828
5825
  }
5829
5826
  };
5830
5827
  const defaultDarkColorsSet = {
@@ -5849,8 +5846,7 @@ const defaultDarkColorsSet = {
5849
5846
  },
5850
5847
  text: {
5851
5848
  primary: "#E5E5EA",
5852
- secondary: "#7D7D85",
5853
- subhead: "#8C8C93"
5849
+ secondary: "#7D7D85"
5854
5850
  }
5855
5851
  };
5856
5852
  var isMergeableObject = function isMergeableObject2(value) {
@@ -6095,7 +6091,7 @@ const ButtonStyled$2 = styled.button`
6095
6091
  padding: 9px 16px;
6096
6092
  border: none;
6097
6093
  border-radius: ${(props) => borders$3[props.theme.borderRadius]};
6098
- cursor: pointer;
6094
+ cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
6099
6095
 
6100
6096
  font-size: 14px;
6101
6097
  font-weight: 590;
@@ -6105,11 +6101,11 @@ const ButtonStyled$2 = styled.button`
6105
6101
  transition: transform 0.1s ease-in-out;
6106
6102
 
6107
6103
  &:hover {
6108
- transform: scale(1.04);
6104
+ transform: ${(props) => props.disabled ? "unset" : "scale(1.04)"};
6109
6105
  }
6110
6106
 
6111
6107
  &:active {
6112
- transform: scale(0.96);
6108
+ transform: ${(props) => props.disabled ? "unset" : "scale(0.96)"};
6113
6109
  }
6114
6110
  `;
6115
6111
  const Button = (props) => {
@@ -6120,11 +6116,17 @@ const Button = (props) => {
6120
6116
  get id() {
6121
6117
  return props.id;
6122
6118
  },
6123
- onClick: () => props.onClick(),
6119
+ onClick: () => {
6120
+ var _a;
6121
+ return (_a = props.onClick) == null ? void 0 : _a.call(props);
6122
+ },
6124
6123
  ref(r$) {
6125
6124
  const _ref$ = props.ref;
6126
6125
  typeof _ref$ === "function" ? _ref$(r$) : props.ref = r$;
6127
6126
  },
6127
+ get disabled() {
6128
+ return props.disabled;
6129
+ },
6128
6130
  get children() {
6129
6131
  return props.children;
6130
6132
  }
@@ -6912,38 +6914,42 @@ const TonIcon = (props) => {
6912
6914
  return _el$;
6913
6915
  })();
6914
6916
  };
6915
- const _tmpl$$b = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="11"></circle><path d="M7.5 13L10 15.5L16.5 9" stroke="white" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);
6917
+ const _tmpl$$b = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="11"></circle><path d="M7.5 13L10 15.5L16.5 9" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);
6916
6918
  const SuccessIcon = (props) => {
6917
6919
  const theme = useTheme();
6918
6920
  const fill = () => props.fill || theme.colors.icon.success;
6919
6921
  return (() => {
6920
- const _el$ = _tmpl$$b.cloneNode(true), _el$2 = _el$.firstChild;
6922
+ const _el$ = _tmpl$$b.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
6921
6923
  createRenderEffect((_p$) => {
6922
- const _v$ = props.class, _v$2 = fill();
6924
+ const _v$ = props.class, _v$2 = fill(), _v$3 = theme.colors.constant.white;
6923
6925
  _v$ !== _p$._v$ && setAttribute(_el$, "class", _p$._v$ = _v$);
6924
6926
  _v$2 !== _p$._v$2 && setAttribute(_el$2, "fill", _p$._v$2 = _v$2);
6927
+ _v$3 !== _p$._v$3 && setAttribute(_el$3, "stroke", _p$._v$3 = _v$3);
6925
6928
  return _p$;
6926
6929
  }, {
6927
6930
  _v$: void 0,
6928
- _v$2: void 0
6931
+ _v$2: void 0,
6932
+ _v$3: void 0
6929
6933
  });
6930
6934
  return _el$;
6931
6935
  })();
6932
6936
  };
6933
- const _tmpl$$a = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="11"></circle><path fill-rule="evenodd" clip-rule="evenodd" d="M7.86358 9.13637C7.51211 8.7849 7.51211 8.21505 7.86358 7.86358C8.21505 7.51211 8.7849 7.51211 9.13637 7.86358L12 10.7272L14.8636 7.86358C15.2151 7.51211 15.7849 7.51211 16.1364 7.86358C16.4878 8.21505 16.4878 8.7849 16.1364 9.13637L13.2728 12L16.1364 14.8636C16.4878 15.2151 16.4878 15.7849 16.1364 16.1364C15.7849 16.4878 15.2151 16.4878 14.8636 16.1364L12 13.2728L9.13637 16.1364C8.7849 16.4878 8.21505 16.4878 7.86358 16.1364C7.51211 15.7849 7.51211 15.2151 7.86358 14.8636L10.7272 12L7.86358 9.13637Z" fill="white"></path></svg>`);
6937
+ const _tmpl$$a = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="11"></circle><path fill-rule="evenodd" clip-rule="evenodd" d="M7.86358 9.13637C7.51211 8.7849 7.51211 8.21505 7.86358 7.86358C8.21505 7.51211 8.7849 7.51211 9.13637 7.86358L12 10.7272L14.8636 7.86358C15.2151 7.51211 15.7849 7.51211 16.1364 7.86358C16.4878 8.21505 16.4878 8.7849 16.1364 9.13637L13.2728 12L16.1364 14.8636C16.4878 15.2151 16.4878 15.7849 16.1364 16.1364C15.7849 16.4878 15.2151 16.4878 14.8636 16.1364L12 13.2728L9.13637 16.1364C8.7849 16.4878 8.21505 16.4878 7.86358 16.1364C7.51211 15.7849 7.51211 15.2151 7.86358 14.8636L10.7272 12L7.86358 9.13637Z"></path></svg>`);
6934
6938
  const ErrorIcon = (props) => {
6935
6939
  const theme = useTheme();
6936
6940
  const fill = () => props.fill || theme.colors.icon.secondary;
6937
6941
  return (() => {
6938
- const _el$ = _tmpl$$a.cloneNode(true), _el$2 = _el$.firstChild;
6942
+ const _el$ = _tmpl$$a.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
6939
6943
  createRenderEffect((_p$) => {
6940
- const _v$ = props.class, _v$2 = fill();
6944
+ const _v$ = props.class, _v$2 = fill(), _v$3 = theme.colors.constant.white;
6941
6945
  _v$ !== _p$._v$ && setAttribute(_el$, "class", _p$._v$ = _v$);
6942
6946
  _v$2 !== _p$._v$2 && setAttribute(_el$2, "fill", _p$._v$2 = _v$2);
6947
+ _v$3 !== _p$._v$3 && setAttribute(_el$3, "fill", _p$._v$3 = _v$3);
6943
6948
  return _p$;
6944
6949
  }, {
6945
6950
  _v$: void 0,
6946
- _v$2: void 0
6951
+ _v$2: void 0,
6952
+ _v$3: void 0
6947
6953
  });
6948
6954
  return _el$;
6949
6955
  })();
@@ -7219,7 +7225,7 @@ const Notification = (props) => {
7219
7225
  }
7220
7226
  });
7221
7227
  };
7222
- const LoaderIconStyled$2 = styled(LoaderIcon)`
7228
+ const LoaderIconStyled$3 = styled(LoaderIcon)`
7223
7229
  align-self: center;
7224
7230
  min-width: 22px;
7225
7231
  min-height: 22px;
@@ -7233,7 +7239,7 @@ const ConfirmOperationNotification = (props) => {
7233
7239
  return props.class;
7234
7240
  },
7235
7241
  get icon() {
7236
- return createComponent(LoaderIconStyled$2, {});
7242
+ return createComponent(LoaderIconStyled$3, {});
7237
7243
  },
7238
7244
  children: "Confirm operation in your wallet"
7239
7245
  });
@@ -7398,8 +7404,26 @@ const AccountButtonStyled = styled(Button)`
7398
7404
  }
7399
7405
  `;
7400
7406
  const DropdownButtonStyled = styled(AccountButtonStyled)`
7407
+ width: 140px;
7408
+ gap: 11px;
7409
+ justify-content: center;
7401
7410
  background-color: ${(props) => props.theme.colors.background.primary};
7402
7411
  `;
7412
+ const LoaderButtonStyled = styled(Button)`
7413
+ width: 140px;
7414
+
7415
+ background-color: ${(props) => props.theme.colors.background.primary};
7416
+ color: ${(props) => props.theme.colors.connectButton.foreground};
7417
+ box-shadow: ${(props) => `0 4px 24px ${rgba(props.theme.colors.constant.black, 0.16)}`};
7418
+
7419
+ display: flex;
7420
+ align-items: center;
7421
+ justify-content: center;
7422
+ `;
7423
+ const LoaderIconStyled$2 = styled(LoaderIcon)`
7424
+ height: 18px;
7425
+ width: 18px;
7426
+ `;
7403
7427
  const DropdownContainerStyled = styled.div`
7404
7428
  display: flex;
7405
7429
  flex-direction: column;
@@ -8166,6 +8190,7 @@ const AccountButton = () => {
8166
8190
  const tonConnectUI = useContext(TonConnectUiContext);
8167
8191
  const [isOpened, setIsOpened] = createSignal(false);
8168
8192
  const [account, setAccount] = createSignal(null);
8193
+ const [restoringProcess, setRestoringProcess] = createSignal(true);
8169
8194
  let dropDownRef;
8170
8195
  const [floating, setFloating] = createSignal();
8171
8196
  const [anchor, setAnchor] = createSignal();
@@ -8181,6 +8206,7 @@ const AccountButton = () => {
8181
8206
  }
8182
8207
  return "";
8183
8208
  };
8209
+ tonConnectUI.connectionRestored.then(() => setRestoringProcess(false));
8184
8210
  const unsubscribe = connector.onStatusChange((wallet) => {
8185
8211
  if (!wallet) {
8186
8212
  setIsOpened(false);
@@ -8208,123 +8234,144 @@ const AccountButton = () => {
8208
8234
  });
8209
8235
  return [createComponent(Show, {
8210
8236
  get when() {
8211
- return !account();
8237
+ return restoringProcess();
8212
8238
  },
8213
8239
  get children() {
8214
- return createComponent(AccountButtonStyled, {
8215
- onClick: () => tonConnectUI.connectWallet(),
8216
- id: "tc-connect-button",
8240
+ return createComponent(LoaderButtonStyled, {
8241
+ disabled: true,
8242
+ id: "tc-connect-button-loading",
8217
8243
  get children() {
8218
- return [createComponent(TonIcon, {
8219
- get fill() {
8220
- return theme.colors.connectButton.foreground;
8221
- }
8222
- }), createComponent(Text, {
8223
- translationKey: "button.connectWallet",
8224
- fontSize: "15px",
8225
- letterSpacing: "-0.24px",
8226
- fontWeight: "590",
8227
- get color() {
8228
- return theme.colors.connectButton.foreground;
8229
- },
8230
- children: "Connect wallet"
8231
- })];
8244
+ return createComponent(LoaderIconStyled$2, {});
8232
8245
  }
8233
8246
  });
8234
8247
  }
8235
8248
  }), createComponent(Show, {
8236
8249
  get when() {
8237
- return account();
8250
+ return !restoringProcess();
8238
8251
  },
8239
8252
  get children() {
8240
- return createComponent(DropdownContainerStyled, {
8253
+ return [createComponent(Show, {
8254
+ get when() {
8255
+ return !account();
8256
+ },
8241
8257
  get children() {
8242
- return [createComponent(DropdownButtonStyled, {
8243
- onClick: () => setIsOpened((v) => !v),
8244
- ref: setAnchor,
8245
- id: "tc-dropdown-button",
8258
+ return createComponent(AccountButtonStyled, {
8259
+ onClick: () => tonConnectUI.connectWallet(),
8260
+ id: "tc-connect-button",
8246
8261
  get children() {
8247
- return [createComponent(Text, {
8262
+ return [createComponent(TonIcon, {
8263
+ get fill() {
8264
+ return theme.colors.connectButton.foreground;
8265
+ }
8266
+ }), createComponent(Text, {
8267
+ translationKey: "button.connectWallet",
8248
8268
  fontSize: "15px",
8249
8269
  letterSpacing: "-0.24px",
8250
8270
  fontWeight: "590",
8251
- get children() {
8252
- return normalizedAddress();
8253
- }
8254
- }), createComponent(ArrowIcon, {
8255
- direction: "bottom"
8271
+ get color() {
8272
+ return theme.colors.connectButton.foreground;
8273
+ },
8274
+ children: "Connect wallet"
8256
8275
  })];
8257
8276
  }
8258
- }), createComponent(Portal, {
8277
+ });
8278
+ }
8279
+ }), createComponent(Show, {
8280
+ get when() {
8281
+ return account();
8282
+ },
8283
+ get children() {
8284
+ return createComponent(DropdownContainerStyled, {
8259
8285
  get children() {
8260
- const _el$ = _tmpl$$3.cloneNode(true);
8261
- use(setFloating, _el$);
8262
- _el$.style.setProperty("z-index", "999");
8263
- insert(_el$, createComponent(Transition, {
8264
- onBeforeEnter: (el) => {
8265
- el.animate([{
8266
- opacity: 0,
8267
- transform: "translateY(-8px)"
8268
- }, {
8269
- opacity: 1,
8270
- transform: "translateY(0)"
8271
- }], {
8272
- duration: 150
8273
- });
8274
- },
8275
- onExit: (el, done) => {
8276
- const a2 = el.animate([{
8277
- opacity: 1,
8278
- transform: "translateY(0)"
8279
- }, {
8280
- opacity: 0,
8281
- transform: "translateY(-8px)"
8282
- }], {
8283
- duration: 150
8284
- });
8285
- a2.finished.then(done);
8286
- },
8286
+ return [createComponent(DropdownButtonStyled, {
8287
+ onClick: () => setIsOpened((v) => !v),
8288
+ ref: setAnchor,
8289
+ id: "tc-dropdown-button",
8287
8290
  get children() {
8288
- return createComponent(Show, {
8289
- get when() {
8290
- return isOpened();
8291
+ return [createComponent(Text, {
8292
+ fontSize: "15px",
8293
+ letterSpacing: "-0.24px",
8294
+ fontWeight: "590",
8295
+ lineHeight: "18px",
8296
+ get children() {
8297
+ return normalizedAddress();
8298
+ }
8299
+ }), createComponent(ArrowIcon, {
8300
+ direction: "bottom"
8301
+ })];
8302
+ }
8303
+ }), createComponent(Portal, {
8304
+ get children() {
8305
+ const _el$ = _tmpl$$3.cloneNode(true);
8306
+ use(setFloating, _el$);
8307
+ _el$.style.setProperty("z-index", "999");
8308
+ insert(_el$, createComponent(Transition, {
8309
+ onBeforeEnter: (el) => {
8310
+ el.animate([{
8311
+ opacity: 0,
8312
+ transform: "translateY(-8px)"
8313
+ }, {
8314
+ opacity: 1,
8315
+ transform: "translateY(0)"
8316
+ }], {
8317
+ duration: 150
8318
+ });
8319
+ },
8320
+ onExit: (el, done) => {
8321
+ const a2 = el.animate([{
8322
+ opacity: 1,
8323
+ transform: "translateY(0)"
8324
+ }, {
8325
+ opacity: 0,
8326
+ transform: "translateY(-8px)"
8327
+ }], {
8328
+ duration: 150
8329
+ });
8330
+ a2.finished.then(done);
8291
8331
  },
8292
8332
  get children() {
8293
- return createComponent(DropdownStyled, {
8294
- get hidden() {
8295
- return !isOpened();
8296
- },
8297
- onClose: () => setIsOpened(false),
8298
- ref(r$) {
8299
- const _ref$ = dropDownRef;
8300
- typeof _ref$ === "function" ? _ref$(r$) : dropDownRef = r$;
8333
+ return createComponent(Show, {
8334
+ get when() {
8335
+ return isOpened();
8301
8336
  },
8302
- id: "tc-dropdown"
8337
+ get children() {
8338
+ return createComponent(DropdownStyled, {
8339
+ get hidden() {
8340
+ return !isOpened();
8341
+ },
8342
+ onClose: () => setIsOpened(false),
8343
+ ref(r$) {
8344
+ const _ref$ = dropDownRef;
8345
+ typeof _ref$ === "function" ? _ref$(r$) : dropDownRef = r$;
8346
+ },
8347
+ id: "tc-dropdown"
8348
+ });
8349
+ }
8303
8350
  });
8304
8351
  }
8352
+ }), null);
8353
+ insert(_el$, createComponent(NotificationsStyled, {
8354
+ id: "tc-notifications"
8355
+ }), null);
8356
+ createRenderEffect((_p$) => {
8357
+ var _a, _b;
8358
+ const _v$ = position.strategy, _v$2 = `${(_a = position.y) != null ? _a : 0}px`, _v$3 = `${(_b = position.x) != null ? _b : 0}px`;
8359
+ _v$ !== _p$._v$ && _el$.style.setProperty("position", _p$._v$ = _v$);
8360
+ _v$2 !== _p$._v$2 && _el$.style.setProperty("top", _p$._v$2 = _v$2);
8361
+ _v$3 !== _p$._v$3 && _el$.style.setProperty("left", _p$._v$3 = _v$3);
8362
+ return _p$;
8363
+ }, {
8364
+ _v$: void 0,
8365
+ _v$2: void 0,
8366
+ _v$3: void 0
8305
8367
  });
8368
+ return _el$;
8306
8369
  }
8307
- }), null);
8308
- insert(_el$, createComponent(NotificationsStyled, {
8309
- id: "tc-notifications"
8310
- }), null);
8311
- createRenderEffect((_p$) => {
8312
- var _a, _b;
8313
- const _v$ = position.strategy, _v$2 = `${(_a = position.y) != null ? _a : 0}px`, _v$3 = `${(_b = position.x) != null ? _b : 0}px`;
8314
- _v$ !== _p$._v$ && _el$.style.setProperty("position", _p$._v$ = _v$);
8315
- _v$2 !== _p$._v$2 && _el$.style.setProperty("top", _p$._v$2 = _v$2);
8316
- _v$3 !== _p$._v$3 && _el$.style.setProperty("left", _p$._v$3 = _v$3);
8317
- return _p$;
8318
- }, {
8319
- _v$: void 0,
8320
- _v$2: void 0,
8321
- _v$3: void 0
8322
- });
8323
- return _el$;
8370
+ })];
8324
8371
  }
8325
- })];
8372
+ });
8326
8373
  }
8327
- });
8374
+ })];
8328
8375
  }
8329
8376
  })];
8330
8377
  };
@@ -10157,7 +10204,12 @@ const QrCodeModal = (props) => {
10157
10204
  }), createComponent(ButtonsContainerStyled, {
10158
10205
  get children() {
10159
10206
  return [createComponent(ActionButtonStyled, {
10160
- onClick: () => openLink(universalLink),
10207
+ onClick: () => {
10208
+ setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, props.wallet), {
10209
+ openMethod: "universal-link"
10210
+ }));
10211
+ openLink(universalLink);
10212
+ },
10161
10213
  get children() {
10162
10214
  return createComponent(Translation, {
10163
10215
  translationKey: "walletModal.qrCodeModal.openWallet",
@@ -10177,9 +10229,12 @@ const QrCodeModal = (props) => {
10177
10229
  },
10178
10230
  get children() {
10179
10231
  return createComponent(ActionButtonStyled, {
10180
- onClick: () => connector.connect({
10181
- jsBridgeKey: props.wallet.jsBridgeKey
10182
- }, props.additionalRequest),
10232
+ onClick: () => {
10233
+ setLastSelectedWalletInfo(props.wallet);
10234
+ connector.connect({
10235
+ jsBridgeKey: props.wallet.jsBridgeKey
10236
+ }, props.additionalRequest);
10237
+ },
10183
10238
  get children() {
10184
10239
  return createComponent(Translation, {
10185
10240
  translationKey: "walletModal.qrCodeModal.openExtension",
@@ -10484,14 +10539,20 @@ const WalletsModal = () => {
10484
10539
  setSelectedWalletInfo(null);
10485
10540
  };
10486
10541
  const onSelect = (walletInfo) => {
10487
- setLastSelectedWalletInfo(walletInfo);
10488
10542
  if (isDevice("mobile") && "universalLink" in walletInfo) {
10543
+ setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, walletInfo), {
10544
+ openMethod: "universal-link"
10545
+ }));
10489
10546
  return onSelectIfMobile(walletInfo);
10490
10547
  }
10491
10548
  if (isWalletInfoInjected(walletInfo) && walletInfo.injected) {
10549
+ setLastSelectedWalletInfo(walletInfo);
10492
10550
  return onSelectIfInjected(walletInfo);
10493
10551
  }
10494
10552
  if ("bridgeUrl" in walletInfo) {
10553
+ setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, walletInfo), {
10554
+ openMethod: "qrcode"
10555
+ }));
10495
10556
  setSelectedWalletInfo(walletInfo);
10496
10557
  return;
10497
10558
  }
@@ -10822,6 +10883,7 @@ class TonConnectUI {
10822
10883
  __publicField(this, "_walletInfo", null);
10823
10884
  __publicField(this, "systemThemeChangeUnsubscribe", null);
10824
10885
  __publicField(this, "actionsConfiguration");
10886
+ __publicField(this, "connectionRestored", Promise.resolve(false));
10825
10887
  if (options && "connector" in options && options.connector) {
10826
10888
  this.connector = options.connector;
10827
10889
  } else if (options && "manifestUrl" in options && options.manifestUrl) {
@@ -10838,11 +10900,13 @@ class TonConnectUI {
10838
10900
  const rootId = this.normalizeWidgetRoot(options == null ? void 0 : options.widgetRootId);
10839
10901
  this.subscribeToWalletChange();
10840
10902
  if ((options == null ? void 0 : options.restoreConnection) !== false) {
10841
- this.connector.restoreConnection().then(() => {
10903
+ this.connectionRestored = new Promise((resolve) => __async(this, null, function* () {
10904
+ yield this.connector.restoreConnection();
10842
10905
  if (!this.connector.connected) {
10843
10906
  this.walletInfoStorage.removeWalletInfo();
10844
10907
  }
10845
- });
10908
+ resolve(this.connector.connected);
10909
+ }));
10846
10910
  }
10847
10911
  this.uiOptions = mergeOptions(options, { uiPreferences: { theme: "SYSTEM" } });
10848
10912
  setAppState({
@@ -10948,7 +11012,7 @@ class TonConnectUI {
10948
11012
  if (!this.connected || !this.walletInfo) {
10949
11013
  throw new TonConnectUIError("Connect wallet to send a transaction.");
10950
11014
  }
10951
- if (!isDevice("desktop") && "universalLink" in this.walletInfo) {
11015
+ if ("universalLink" in this.walletInfo && this.walletInfo.openMethod === "universal-link") {
10952
11016
  openLink(this.walletInfo.universalLink);
10953
11017
  }
10954
11018
  const { notifications: notifications2, modals } = this.getModalsAndNotificationsConfiguration(options);