@tonconnect/ui-react 0.0.9 → 0.0.11

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
@@ -145,6 +145,23 @@ export const Settings = () => {
145
145
  };
146
146
  ```
147
147
 
148
+ ### useIsConnectionRestored
149
+ Indicates current status of the connection restoring process.
150
+ You can use it to detect when connection restoring process if finished.
151
+
152
+ ```tsx
153
+ import { useIsConnectionRestored } from '@tonconnect/ui-react';
154
+
155
+ export const EntrypointPage = () => {
156
+ const connectionRestoring = useIsConnectionRestored();
157
+
158
+ if (connectionRestoring) {
159
+ return <Loader>Please wait...</Loader>;
160
+ }
161
+
162
+ return <MainPage />;
163
+ };
164
+ ```
148
165
 
149
166
  ## Add connect request parameters (ton_proof)
150
167
  Pass `getConnectParameters` async function to the `TonConnectUIProvider`. This callback will be called after `connectWallet` method call or `Connect Button` click before wallets list render.
@@ -1,3 +1,4 @@
1
1
  export { useTonAddress } from './useTonAddress';
2
2
  export { useTonConnectUI } from './useTonConnectUI';
3
3
  export { useTonWallet } from './useTonWallet';
4
+ export { useIsConnectionRestored } from './useIsConnectionRestored';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Indicates current status of the connection restoring process.
3
+ */
4
+ export declare function useIsConnectionRestored(): boolean;
package/lib/index.js CHANGED
@@ -6277,9 +6277,7 @@ function Dynamic(props) {
6277
6277
  });
6278
6278
  }
6279
6279
  const [walletsModalOpen, setWalletsModalOpen] = createSignal(false);
6280
- const [lastSelectedWalletInfo, setLastSelectedWalletInfo] = createSignal(
6281
- null
6282
- );
6280
+ const [lastSelectedWalletInfo, setLastSelectedWalletInfo] = createSignal(null);
6283
6281
  const [action, setAction] = createSignal(null);
6284
6282
  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) => {
6285
6283
  let r = "", l2 = "", a2 = "";
@@ -6800,8 +6798,7 @@ const defaultLightColorsSet = {
6800
6798
  },
6801
6799
  text: {
6802
6800
  primary: "#0F0F0F",
6803
- secondary: "#7A8999",
6804
- subhead: "#6A7785"
6801
+ secondary: "#7A8999"
6805
6802
  }
6806
6803
  };
6807
6804
  const defaultDarkColorsSet = {
@@ -6826,8 +6823,7 @@ const defaultDarkColorsSet = {
6826
6823
  },
6827
6824
  text: {
6828
6825
  primary: "#E5E5EA",
6829
- secondary: "#7D7D85",
6830
- subhead: "#8C8C93"
6826
+ secondary: "#7D7D85"
6831
6827
  }
6832
6828
  };
6833
6829
  var isMergeableObject = function isMergeableObject2(value) {
@@ -7072,7 +7068,7 @@ const ButtonStyled$2 = styled.button`
7072
7068
  padding: 9px 16px;
7073
7069
  border: none;
7074
7070
  border-radius: ${(props) => borders$3[props.theme.borderRadius]};
7075
- cursor: pointer;
7071
+ cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
7076
7072
 
7077
7073
  font-size: 14px;
7078
7074
  font-weight: 590;
@@ -7082,11 +7078,11 @@ const ButtonStyled$2 = styled.button`
7082
7078
  transition: transform 0.1s ease-in-out;
7083
7079
 
7084
7080
  &:hover {
7085
- transform: scale(1.04);
7081
+ transform: ${(props) => props.disabled ? "unset" : "scale(1.04)"};
7086
7082
  }
7087
7083
 
7088
7084
  &:active {
7089
- transform: scale(0.96);
7085
+ transform: ${(props) => props.disabled ? "unset" : "scale(0.96)"};
7090
7086
  }
7091
7087
  `;
7092
7088
  const Button = (props) => {
@@ -7097,11 +7093,17 @@ const Button = (props) => {
7097
7093
  get id() {
7098
7094
  return props.id;
7099
7095
  },
7100
- onClick: () => props.onClick(),
7096
+ onClick: () => {
7097
+ var _a;
7098
+ return (_a = props.onClick) == null ? void 0 : _a.call(props);
7099
+ },
7101
7100
  ref(r$) {
7102
7101
  const _ref$ = props.ref;
7103
7102
  typeof _ref$ === "function" ? _ref$(r$) : props.ref = r$;
7104
7103
  },
7104
+ get disabled() {
7105
+ return props.disabled;
7106
+ },
7105
7107
  get children() {
7106
7108
  return props.children;
7107
7109
  }
@@ -7889,38 +7891,42 @@ const TonIcon = (props) => {
7889
7891
  return _el$;
7890
7892
  })();
7891
7893
  };
7892
- 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>`);
7894
+ 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>`);
7893
7895
  const SuccessIcon = (props) => {
7894
7896
  const theme = useTheme();
7895
7897
  const fill = () => props.fill || theme.colors.icon.success;
7896
7898
  return (() => {
7897
- const _el$ = _tmpl$$b.cloneNode(true), _el$2 = _el$.firstChild;
7899
+ const _el$ = _tmpl$$b.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
7898
7900
  createRenderEffect((_p$) => {
7899
- const _v$ = props.class, _v$2 = fill();
7901
+ const _v$ = props.class, _v$2 = fill(), _v$3 = theme.colors.constant.white;
7900
7902
  _v$ !== _p$._v$ && setAttribute(_el$, "class", _p$._v$ = _v$);
7901
7903
  _v$2 !== _p$._v$2 && setAttribute(_el$2, "fill", _p$._v$2 = _v$2);
7904
+ _v$3 !== _p$._v$3 && setAttribute(_el$3, "stroke", _p$._v$3 = _v$3);
7902
7905
  return _p$;
7903
7906
  }, {
7904
7907
  _v$: void 0,
7905
- _v$2: void 0
7908
+ _v$2: void 0,
7909
+ _v$3: void 0
7906
7910
  });
7907
7911
  return _el$;
7908
7912
  })();
7909
7913
  };
7910
- 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>`);
7914
+ 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>`);
7911
7915
  const ErrorIcon = (props) => {
7912
7916
  const theme = useTheme();
7913
7917
  const fill = () => props.fill || theme.colors.icon.secondary;
7914
7918
  return (() => {
7915
- const _el$ = _tmpl$$a.cloneNode(true), _el$2 = _el$.firstChild;
7919
+ const _el$ = _tmpl$$a.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
7916
7920
  createRenderEffect((_p$) => {
7917
- const _v$ = props.class, _v$2 = fill();
7921
+ const _v$ = props.class, _v$2 = fill(), _v$3 = theme.colors.constant.white;
7918
7922
  _v$ !== _p$._v$ && setAttribute(_el$, "class", _p$._v$ = _v$);
7919
7923
  _v$2 !== _p$._v$2 && setAttribute(_el$2, "fill", _p$._v$2 = _v$2);
7924
+ _v$3 !== _p$._v$3 && setAttribute(_el$3, "fill", _p$._v$3 = _v$3);
7920
7925
  return _p$;
7921
7926
  }, {
7922
7927
  _v$: void 0,
7923
- _v$2: void 0
7928
+ _v$2: void 0,
7929
+ _v$3: void 0
7924
7930
  });
7925
7931
  return _el$;
7926
7932
  })();
@@ -8196,7 +8202,7 @@ const Notification = (props) => {
8196
8202
  }
8197
8203
  });
8198
8204
  };
8199
- const LoaderIconStyled$2 = styled(LoaderIcon)`
8205
+ const LoaderIconStyled$3 = styled(LoaderIcon)`
8200
8206
  align-self: center;
8201
8207
  min-width: 22px;
8202
8208
  min-height: 22px;
@@ -8210,7 +8216,7 @@ const ConfirmOperationNotification = (props) => {
8210
8216
  return props.class;
8211
8217
  },
8212
8218
  get icon() {
8213
- return createComponent(LoaderIconStyled$2, {});
8219
+ return createComponent(LoaderIconStyled$3, {});
8214
8220
  },
8215
8221
  children: "Confirm operation in your wallet"
8216
8222
  });
@@ -8375,7 +8381,25 @@ const AccountButtonStyled = styled(Button)`
8375
8381
  }
8376
8382
  `;
8377
8383
  const DropdownButtonStyled = styled(AccountButtonStyled)`
8384
+ width: 140px;
8385
+ gap: 11px;
8386
+ justify-content: center;
8387
+ background-color: ${(props) => props.theme.colors.background.primary};
8388
+ `;
8389
+ const LoaderButtonStyled = styled(Button)`
8390
+ width: 140px;
8391
+
8378
8392
  background-color: ${(props) => props.theme.colors.background.primary};
8393
+ color: ${(props) => props.theme.colors.connectButton.foreground};
8394
+ box-shadow: ${(props) => `0 4px 24px ${rgba(props.theme.colors.constant.black, 0.16)}`};
8395
+
8396
+ display: flex;
8397
+ align-items: center;
8398
+ justify-content: center;
8399
+ `;
8400
+ const LoaderIconStyled$2 = styled(LoaderIcon)`
8401
+ height: 18px;
8402
+ width: 18px;
8379
8403
  `;
8380
8404
  const DropdownContainerStyled = styled.div`
8381
8405
  display: flex;
@@ -9143,6 +9167,7 @@ const AccountButton = () => {
9143
9167
  const tonConnectUI2 = useContext(TonConnectUiContext);
9144
9168
  const [isOpened, setIsOpened] = createSignal(false);
9145
9169
  const [account, setAccount] = createSignal(null);
9170
+ const [restoringProcess, setRestoringProcess] = createSignal(true);
9146
9171
  let dropDownRef;
9147
9172
  const [floating, setFloating] = createSignal();
9148
9173
  const [anchor, setAnchor] = createSignal();
@@ -9158,6 +9183,7 @@ const AccountButton = () => {
9158
9183
  }
9159
9184
  return "";
9160
9185
  };
9186
+ tonConnectUI2.connectionRestored.then(() => setRestoringProcess(false));
9161
9187
  const unsubscribe = connector.onStatusChange((wallet) => {
9162
9188
  if (!wallet) {
9163
9189
  setIsOpened(false);
@@ -9185,123 +9211,144 @@ const AccountButton = () => {
9185
9211
  });
9186
9212
  return [createComponent(Show, {
9187
9213
  get when() {
9188
- return !account();
9214
+ return restoringProcess();
9189
9215
  },
9190
9216
  get children() {
9191
- return createComponent(AccountButtonStyled, {
9192
- onClick: () => tonConnectUI2.connectWallet(),
9193
- id: "tc-connect-button",
9217
+ return createComponent(LoaderButtonStyled, {
9218
+ disabled: true,
9219
+ id: "tc-connect-button-loading",
9194
9220
  get children() {
9195
- return [createComponent(TonIcon, {
9196
- get fill() {
9197
- return theme.colors.connectButton.foreground;
9198
- }
9199
- }), createComponent(Text, {
9200
- translationKey: "button.connectWallet",
9201
- fontSize: "15px",
9202
- letterSpacing: "-0.24px",
9203
- fontWeight: "590",
9204
- get color() {
9205
- return theme.colors.connectButton.foreground;
9206
- },
9207
- children: "Connect wallet"
9208
- })];
9221
+ return createComponent(LoaderIconStyled$2, {});
9209
9222
  }
9210
9223
  });
9211
9224
  }
9212
9225
  }), createComponent(Show, {
9213
9226
  get when() {
9214
- return account();
9227
+ return !restoringProcess();
9215
9228
  },
9216
9229
  get children() {
9217
- return createComponent(DropdownContainerStyled, {
9230
+ return [createComponent(Show, {
9231
+ get when() {
9232
+ return !account();
9233
+ },
9218
9234
  get children() {
9219
- return [createComponent(DropdownButtonStyled, {
9220
- onClick: () => setIsOpened((v) => !v),
9221
- ref: setAnchor,
9222
- id: "tc-dropdown-button",
9235
+ return createComponent(AccountButtonStyled, {
9236
+ onClick: () => tonConnectUI2.connectWallet(),
9237
+ id: "tc-connect-button",
9223
9238
  get children() {
9224
- return [createComponent(Text, {
9239
+ return [createComponent(TonIcon, {
9240
+ get fill() {
9241
+ return theme.colors.connectButton.foreground;
9242
+ }
9243
+ }), createComponent(Text, {
9244
+ translationKey: "button.connectWallet",
9225
9245
  fontSize: "15px",
9226
9246
  letterSpacing: "-0.24px",
9227
9247
  fontWeight: "590",
9228
- get children() {
9229
- return normalizedAddress();
9230
- }
9231
- }), createComponent(ArrowIcon, {
9232
- direction: "bottom"
9248
+ get color() {
9249
+ return theme.colors.connectButton.foreground;
9250
+ },
9251
+ children: "Connect wallet"
9233
9252
  })];
9234
9253
  }
9235
- }), createComponent(Portal, {
9254
+ });
9255
+ }
9256
+ }), createComponent(Show, {
9257
+ get when() {
9258
+ return account();
9259
+ },
9260
+ get children() {
9261
+ return createComponent(DropdownContainerStyled, {
9236
9262
  get children() {
9237
- const _el$ = _tmpl$$3.cloneNode(true);
9238
- use(setFloating, _el$);
9239
- _el$.style.setProperty("z-index", "999");
9240
- insert(_el$, createComponent(Transition, {
9241
- onBeforeEnter: (el) => {
9242
- el.animate([{
9243
- opacity: 0,
9244
- transform: "translateY(-8px)"
9245
- }, {
9246
- opacity: 1,
9247
- transform: "translateY(0)"
9248
- }], {
9249
- duration: 150
9250
- });
9251
- },
9252
- onExit: (el, done) => {
9253
- const a2 = el.animate([{
9254
- opacity: 1,
9255
- transform: "translateY(0)"
9256
- }, {
9257
- opacity: 0,
9258
- transform: "translateY(-8px)"
9259
- }], {
9260
- duration: 150
9261
- });
9262
- a2.finished.then(done);
9263
- },
9263
+ return [createComponent(DropdownButtonStyled, {
9264
+ onClick: () => setIsOpened((v) => !v),
9265
+ ref: setAnchor,
9266
+ id: "tc-dropdown-button",
9264
9267
  get children() {
9265
- return createComponent(Show, {
9266
- get when() {
9267
- return isOpened();
9268
+ return [createComponent(Text, {
9269
+ fontSize: "15px",
9270
+ letterSpacing: "-0.24px",
9271
+ fontWeight: "590",
9272
+ lineHeight: "18px",
9273
+ get children() {
9274
+ return normalizedAddress();
9275
+ }
9276
+ }), createComponent(ArrowIcon, {
9277
+ direction: "bottom"
9278
+ })];
9279
+ }
9280
+ }), createComponent(Portal, {
9281
+ get children() {
9282
+ const _el$ = _tmpl$$3.cloneNode(true);
9283
+ use(setFloating, _el$);
9284
+ _el$.style.setProperty("z-index", "999");
9285
+ insert(_el$, createComponent(Transition, {
9286
+ onBeforeEnter: (el) => {
9287
+ el.animate([{
9288
+ opacity: 0,
9289
+ transform: "translateY(-8px)"
9290
+ }, {
9291
+ opacity: 1,
9292
+ transform: "translateY(0)"
9293
+ }], {
9294
+ duration: 150
9295
+ });
9296
+ },
9297
+ onExit: (el, done) => {
9298
+ const a2 = el.animate([{
9299
+ opacity: 1,
9300
+ transform: "translateY(0)"
9301
+ }, {
9302
+ opacity: 0,
9303
+ transform: "translateY(-8px)"
9304
+ }], {
9305
+ duration: 150
9306
+ });
9307
+ a2.finished.then(done);
9268
9308
  },
9269
9309
  get children() {
9270
- return createComponent(DropdownStyled, {
9271
- get hidden() {
9272
- return !isOpened();
9310
+ return createComponent(Show, {
9311
+ get when() {
9312
+ return isOpened();
9273
9313
  },
9274
- onClose: () => setIsOpened(false),
9275
- ref(r$) {
9276
- const _ref$ = dropDownRef;
9277
- typeof _ref$ === "function" ? _ref$(r$) : dropDownRef = r$;
9278
- },
9279
- id: "tc-dropdown"
9314
+ get children() {
9315
+ return createComponent(DropdownStyled, {
9316
+ get hidden() {
9317
+ return !isOpened();
9318
+ },
9319
+ onClose: () => setIsOpened(false),
9320
+ ref(r$) {
9321
+ const _ref$ = dropDownRef;
9322
+ typeof _ref$ === "function" ? _ref$(r$) : dropDownRef = r$;
9323
+ },
9324
+ id: "tc-dropdown"
9325
+ });
9326
+ }
9280
9327
  });
9281
9328
  }
9329
+ }), null);
9330
+ insert(_el$, createComponent(NotificationsStyled, {
9331
+ id: "tc-notifications"
9332
+ }), null);
9333
+ createRenderEffect((_p$) => {
9334
+ var _a, _b;
9335
+ const _v$ = position.strategy, _v$2 = `${(_a = position.y) != null ? _a : 0}px`, _v$3 = `${(_b = position.x) != null ? _b : 0}px`;
9336
+ _v$ !== _p$._v$ && _el$.style.setProperty("position", _p$._v$ = _v$);
9337
+ _v$2 !== _p$._v$2 && _el$.style.setProperty("top", _p$._v$2 = _v$2);
9338
+ _v$3 !== _p$._v$3 && _el$.style.setProperty("left", _p$._v$3 = _v$3);
9339
+ return _p$;
9340
+ }, {
9341
+ _v$: void 0,
9342
+ _v$2: void 0,
9343
+ _v$3: void 0
9282
9344
  });
9345
+ return _el$;
9283
9346
  }
9284
- }), null);
9285
- insert(_el$, createComponent(NotificationsStyled, {
9286
- id: "tc-notifications"
9287
- }), null);
9288
- createRenderEffect((_p$) => {
9289
- var _a, _b;
9290
- const _v$ = position.strategy, _v$2 = `${(_a = position.y) != null ? _a : 0}px`, _v$3 = `${(_b = position.x) != null ? _b : 0}px`;
9291
- _v$ !== _p$._v$ && _el$.style.setProperty("position", _p$._v$ = _v$);
9292
- _v$2 !== _p$._v$2 && _el$.style.setProperty("top", _p$._v$2 = _v$2);
9293
- _v$3 !== _p$._v$3 && _el$.style.setProperty("left", _p$._v$3 = _v$3);
9294
- return _p$;
9295
- }, {
9296
- _v$: void 0,
9297
- _v$2: void 0,
9298
- _v$3: void 0
9299
- });
9300
- return _el$;
9347
+ })];
9301
9348
  }
9302
- })];
9349
+ });
9303
9350
  }
9304
- });
9351
+ })];
9305
9352
  }
9306
9353
  })];
9307
9354
  };
@@ -11134,7 +11181,12 @@ const QrCodeModal = (props) => {
11134
11181
  }), createComponent(ButtonsContainerStyled, {
11135
11182
  get children() {
11136
11183
  return [createComponent(ActionButtonStyled, {
11137
- onClick: () => openLink(universalLink),
11184
+ onClick: () => {
11185
+ setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, props.wallet), {
11186
+ openMethod: "universal-link"
11187
+ }));
11188
+ openLink(universalLink);
11189
+ },
11138
11190
  get children() {
11139
11191
  return createComponent(Translation, {
11140
11192
  translationKey: "walletModal.qrCodeModal.openWallet",
@@ -11154,9 +11206,12 @@ const QrCodeModal = (props) => {
11154
11206
  },
11155
11207
  get children() {
11156
11208
  return createComponent(ActionButtonStyled, {
11157
- onClick: () => connector.connect({
11158
- jsBridgeKey: props.wallet.jsBridgeKey
11159
- }, props.additionalRequest),
11209
+ onClick: () => {
11210
+ setLastSelectedWalletInfo(props.wallet);
11211
+ connector.connect({
11212
+ jsBridgeKey: props.wallet.jsBridgeKey
11213
+ }, props.additionalRequest);
11214
+ },
11160
11215
  get children() {
11161
11216
  return createComponent(Translation, {
11162
11217
  translationKey: "walletModal.qrCodeModal.openExtension",
@@ -11461,14 +11516,20 @@ const WalletsModal = () => {
11461
11516
  setSelectedWalletInfo(null);
11462
11517
  };
11463
11518
  const onSelect = (walletInfo) => {
11464
- setLastSelectedWalletInfo(walletInfo);
11465
11519
  if (isDevice("mobile") && "universalLink" in walletInfo) {
11520
+ setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, walletInfo), {
11521
+ openMethod: "universal-link"
11522
+ }));
11466
11523
  return onSelectIfMobile(walletInfo);
11467
11524
  }
11468
11525
  if (isWalletInfoInjected(walletInfo) && walletInfo.injected) {
11526
+ setLastSelectedWalletInfo(walletInfo);
11469
11527
  return onSelectIfInjected(walletInfo);
11470
11528
  }
11471
11529
  if ("bridgeUrl" in walletInfo) {
11530
+ setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, walletInfo), {
11531
+ openMethod: "qrcode"
11532
+ }));
11472
11533
  setSelectedWalletInfo(walletInfo);
11473
11534
  return;
11474
11535
  }
@@ -11799,6 +11860,7 @@ class TonConnectUI {
11799
11860
  __publicField(this, "_walletInfo", null);
11800
11861
  __publicField(this, "systemThemeChangeUnsubscribe", null);
11801
11862
  __publicField(this, "actionsConfiguration");
11863
+ __publicField(this, "connectionRestored", Promise.resolve(false));
11802
11864
  if (options && "connector" in options && options.connector) {
11803
11865
  this.connector = options.connector;
11804
11866
  } else if (options && "manifestUrl" in options && options.manifestUrl) {
@@ -11815,11 +11877,13 @@ class TonConnectUI {
11815
11877
  const rootId = this.normalizeWidgetRoot(options == null ? void 0 : options.widgetRootId);
11816
11878
  this.subscribeToWalletChange();
11817
11879
  if ((options == null ? void 0 : options.restoreConnection) !== false) {
11818
- this.connector.restoreConnection().then(() => {
11880
+ this.connectionRestored = new Promise((resolve) => __async(this, null, function* () {
11881
+ yield this.connector.restoreConnection();
11819
11882
  if (!this.connector.connected) {
11820
11883
  this.walletInfoStorage.removeWalletInfo();
11821
11884
  }
11822
- });
11885
+ resolve(this.connector.connected);
11886
+ }));
11823
11887
  }
11824
11888
  this.uiOptions = mergeOptions(options, { uiPreferences: { theme: "SYSTEM" } });
11825
11889
  setAppState({
@@ -11893,13 +11957,15 @@ class TonConnectUI {
11893
11957
  }
11894
11958
  connectWallet() {
11895
11959
  return __async(this, null, function* () {
11960
+ var _a;
11896
11961
  const walletsList = yield this.getWallets();
11897
11962
  const embeddedWallet = walletsList.find(
11898
11963
  (wallet) => "embedded" in wallet && wallet.embedded
11899
11964
  );
11900
11965
  if (embeddedWallet) {
11966
+ const additionalRequest = yield (_a = appState.getConnectParameters) == null ? void 0 : _a.call(appState);
11901
11967
  setLastSelectedWalletInfo(embeddedWallet);
11902
- this.connector.connect({ jsBridgeKey: embeddedWallet.jsBridgeKey });
11968
+ this.connector.connect({ jsBridgeKey: embeddedWallet.jsBridgeKey }, additionalRequest);
11903
11969
  } else {
11904
11970
  widgetController.openWalletsModal();
11905
11971
  }
@@ -11925,7 +11991,7 @@ class TonConnectUI {
11925
11991
  if (!this.connected || !this.walletInfo) {
11926
11992
  throw new TonConnectUIError("Connect wallet to send a transaction.");
11927
11993
  }
11928
- if (!isDevice("desktop") && "universalLink" in this.walletInfo) {
11994
+ if ("universalLink" in this.walletInfo && this.walletInfo.openMethod === "universal-link") {
11929
11995
  openLink(this.walletInfo.universalLink);
11930
11996
  }
11931
11997
  const { notifications: notifications2, modals } = this.getModalsAndNotificationsConfiguration(options);
@@ -14956,6 +15022,12 @@ function useTonAddress(userFriendly = true) {
14956
15022
  return "";
14957
15023
  }
14958
15024
  }
15025
+ function useIsConnectionRestored() {
15026
+ const [restored, setRestored] = useState(false);
15027
+ const [tonConnectUI2] = useTonConnectUI();
15028
+ tonConnectUI2.connectionRestored.then(() => setRestored(true));
15029
+ return restored;
15030
+ }
14959
15031
  export {
14960
15032
  THEME,
14961
15033
  TonConnectButton$1 as TonConnectButton,
@@ -14965,6 +15037,7 @@ export {
14965
15037
  TonConnectUIError,
14966
15038
  TonConnectUIProvider$1 as TonConnectUIProvider,
14967
15039
  TonConnectUIReactError,
15040
+ useIsConnectionRestored,
14968
15041
  useTonAddress,
14969
15042
  useTonConnectUI,
14970
15043
  useTonWallet