@embarkai/ui-kit 0.4.47 → 0.4.49

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/dist/index.js CHANGED
@@ -1168,52 +1168,48 @@ var init_helpers = __esm({
1168
1168
  });
1169
1169
 
1170
1170
  // src/internal/components/ChainSync/ChainSync.tsx
1171
- import {
1172
- DEFAULT_CHAIN_ID,
1173
- getChainConfig,
1174
- isChainSupported
1175
- } from "@embarkai/core/read";
1171
+ import { DEFAULT_CHAIN_ID, getChainConfig, isChainSupported } from "@embarkai/core/read";
1176
1172
  import { useMutation, useQueryClient } from "@tanstack/react-query";
1177
1173
  import { throttle } from "lodash-es";
1178
1174
  import { useCallback, useEffect as useEffect2, useRef } from "react";
1179
1175
  function ChainSync() {
1180
1176
  const { config, callbacksRef } = useProviderConfig();
1181
1177
  const qc = useQueryClient();
1182
- const setPage = useLayoutDataStore((st) => st.setPage);
1183
- const { address, session, activeChainId, setAddress, setSession, setActiveChain, setIsLoading, setStatus, setError } = useSession();
1178
+ const address = useSession((st) => st.address);
1179
+ const session = useSession((st) => st.session);
1180
+ const activeChainId = useSession((st) => st.activeChainId);
1184
1181
  const prevChainId = useRef(null);
1185
- const isReverting = useRef(false);
1186
1182
  const { mutate: updateChain } = useMutation({
1187
- mutationFn: async (selectedChainId) => {
1183
+ mutationFn: async (toChainId) => {
1184
+ if (!toChainId) {
1185
+ console.warn("[CHAIN_SYNC] No target chainId provided, skipping chain update");
1186
+ return { skip: true };
1187
+ }
1188
+ console.warn("[CHAIN_SYNC] Attempting:", toChainId);
1188
1189
  if (!session?.ownerAddress) {
1189
1190
  console.warn("[CHAIN_SYNC] No session owner address, aborting chain update");
1190
- throw new Error("No session owner");
1191
+ return { skip: true };
1191
1192
  }
1192
- if (prevChainId.current === activeChainId) {
1193
- console.info("[CHAIN_SYNC] Current chain:", activeChainId);
1194
- return { skip: true, targetChainId: activeChainId };
1193
+ if (prevChainId.current === toChainId) {
1194
+ console.info("[CHAIN_SYNC] Chain already selected:", toChainId);
1195
+ return { skip: true };
1195
1196
  }
1196
- console.info("[CHAIN_SYNC]", prevChainId.current, "->", activeChainId);
1197
- setIsLoading(true);
1197
+ console.info("[CHAIN_SYNC] syncing to: ", toChainId);
1198
+ const { setIsLoading, setStatus } = useSession.getState();
1198
1199
  let targetChainId = null;
1199
1200
  switch (true) {
1200
- case (!!selectedChainId && !!isChainSupported(selectedChainId)):
1201
- targetChainId = selectedChainId;
1201
+ case (!!toChainId && !!isChainSupported(toChainId)):
1202
+ targetChainId = toChainId;
1202
1203
  break;
1203
- case (!!selectedChainId && !isChainSupported(selectedChainId)):
1204
- console.warn(`[EMBARKAI] Current activeChainId ${selectedChainId} is not supported. Checking for fallback`);
1205
- // no break, fallthrough to next case
1206
- case (!!config.current?.network?.chainId && !!isChainSupported(config.current.network.chainId)):
1207
- targetChainId = config.current.network.chainId;
1208
- console.info(`[EMBARKAI] Config chainId ${config.current.network.chainId} will be used.`);
1204
+ case (!!toChainId && !isChainSupported(toChainId)):
1205
+ console.warn(`[EMBARKAI] Chain ${toChainId} is not supported. Checking for fallback`);
1206
+ targetChainId = DEFAULT_CHAIN_ID;
1209
1207
  break;
1210
- case (!!config.current?.network?.chainId && !isChainSupported(config.current.network.chainId)):
1211
- console.warn(`No Fallback ChainID Found. Using default chain ${DEFAULT_CHAIN_ID} instead.`);
1212
- // no break, fallthrough to next case
1213
1208
  default:
1214
1209
  targetChainId = DEFAULT_CHAIN_ID;
1215
1210
  break;
1216
1211
  }
1212
+ setIsLoading(true);
1217
1213
  setStatus(`Re-calculating address for chain ${targetChainId}...`);
1218
1214
  const chainConfig = getChainConfig(targetChainId);
1219
1215
  const chainParams = getChainParams(chainConfig);
@@ -1231,9 +1227,9 @@ function ChainSync() {
1231
1227
  };
1232
1228
  },
1233
1229
  onSuccess: async ({ skip, targetChainId, smartAccountAddress, chainParams }) => {
1234
- if (skip) return;
1230
+ if (skip || !smartAccountAddress || !chainParams) return;
1235
1231
  const { chainConfig } = chainParams;
1236
- console.info("[CHAIN_SYNC] Address recalculated for chain", targetChainId, ":", smartAccountAddress);
1232
+ const { setIsLoading, setStatus, setActiveChain, setAddress, setSession } = useSession.getState();
1237
1233
  setActiveChain(chainParams);
1238
1234
  setAddress(smartAccountAddress);
1239
1235
  setSession({
@@ -1242,45 +1238,52 @@ function ChainSync() {
1242
1238
  address: smartAccountAddress,
1243
1239
  factoryAddress: chainConfig.factoryAddress
1244
1240
  });
1245
- await callbacksRef.current?.onChainChange?.({
1241
+ callbacksRef.current?.onChainChange?.({
1246
1242
  chainId: targetChainId,
1247
1243
  previousChainId: prevChainId.current
1248
1244
  });
1249
- if (!config.current?.network?.forceChain && targetChainId !== config.current?.network?.chainId) {
1250
- console.info("[CHAIN_SYNC] Dapp chain request:", targetChainId, "->", config.current?.network?.chainId);
1251
- setPage("chain-switch-request" /* CHAIN_SWITCH_REQUEST */);
1252
- }
1253
1245
  prevChainId.current = targetChainId;
1254
- await qc.invalidateQueries();
1246
+ qc.invalidateQueries();
1255
1247
  setStatus("idle");
1256
1248
  setIsLoading(false);
1257
1249
  },
1258
1250
  onError: (error, selectedChainId) => {
1259
1251
  console.error("[CHAIN_SYNC] Failed to switch chain into ", selectedChainId, ":", error);
1252
+ const { setIsLoading, setStatus, setError } = useSession.getState();
1260
1253
  setStatus("idle");
1261
1254
  setError(error.message);
1262
1255
  setIsLoading(false);
1263
1256
  }
1264
1257
  });
1265
- const updateChainRelaxed = useCallback(throttle(updateChain, 3e3), []);
1258
+ const updateChainRelaxed = useCallback(throttle(updateChain, 2e3), []);
1266
1259
  useEffect2(() => {
1267
- if (!address) return;
1268
- if (prevChainId.current === activeChainId) return;
1269
- if (isReverting.current) {
1270
- isReverting.current = false;
1271
- return;
1272
- }
1260
+ if (!address || !activeChainId) return;
1273
1261
  updateChainRelaxed(activeChainId);
1274
1262
  }, [address, activeChainId]);
1263
+ useEffect2(() => {
1264
+ if (!address || !activeChainId) return;
1265
+ const shouldSwitchRequest = !config.current?.network?.forceChain && activeChainId !== config.current?.network?.chainId;
1266
+ async function showSwitchChainRequest() {
1267
+ const stats = await getShareRecoveryStats();
1268
+ const hasRecoveryData = !!stats && (!!stats.created || stats.devices && stats.devices.length > 0);
1269
+ const jwt = jwtTokenManager2.getTokens();
1270
+ const isNewUser = !hasRecoveryData && !!jwt?.isNewUser;
1271
+ if (isNewUser || !shouldSwitchRequest) return;
1272
+ useLayoutDataStore.getState().setPage("chain-switch-request" /* CHAIN_SWITCH_REQUEST */);
1273
+ }
1274
+ showSwitchChainRequest();
1275
+ }, [address, activeChainId]);
1275
1276
  return null;
1276
1277
  }
1277
1278
  var init_ChainSync = __esm({
1278
1279
  "src/internal/components/ChainSync/ChainSync.tsx"() {
1279
1280
  init_ProviderContext();
1280
1281
  init_SessionContext();
1282
+ init_auth();
1281
1283
  init_constants2();
1282
1284
  init_helpers();
1283
1285
  init_useLayoutDataStore();
1286
+ init_vaultClient();
1284
1287
  }
1285
1288
  });
1286
1289
 
@@ -2421,30 +2424,37 @@ var init_useAutoConnect = __esm({
2421
2424
  import { useMutation as useMutation2 } from "@tanstack/react-query";
2422
2425
  import { useEffect as useEffect4 } from "react";
2423
2426
  function useBackupStatusChanges() {
2424
- const setHasServerVault = useSession((st) => st.setHasServerVault);
2425
- const setPage = useLayoutDataStore((st) => st.setPage);
2426
2427
  const { mutate: handleBackupStatusChanged } = useMutation2({
2427
2428
  mutationFn: async (event) => {
2428
2429
  const customEvent = event;
2429
2430
  console.log("[BACKUP STATUS] changed:", customEvent?.detail);
2430
- return { stats: await getShareRecoveryStats(), detail: customEvent?.detail };
2431
+ return {
2432
+ stats: await getShareRecoveryStats(),
2433
+ detail: customEvent?.detail
2434
+ };
2431
2435
  },
2432
2436
  onSuccess: ({ stats, detail }) => {
2437
+ const { setHasServerVault } = useSession.getState();
2433
2438
  const hasRecoveryData = stats && (!!stats.created || !!stats?.devices?.length);
2434
2439
  if (!!hasRecoveryData) {
2435
2440
  setHasServerVault(true);
2436
- if (!!detail?.navigateToNicknameMenu) {
2437
- console.log("[BACKUP STATUS] New user backup created, navigating to nickname settings");
2438
- setTimeout(() => setPage("nickname-settings" /* NICKNAME_SETTINGS */), 1e3);
2441
+ const jwt = jwtTokenManager2.getTokens();
2442
+ const isNewUserTouched = localStorage.getItem(NEW_USER_TOUCHED_KEY) === "true";
2443
+ if (!isNewUserTouched && !!jwt?.isNewUser) {
2444
+ localStorage.setItem(NEW_USER_TOUCHED_KEY, "true");
2445
+ useLayoutDataStore.getState().setPage("nickname-settings" /* NICKNAME_SETTINGS */);
2446
+ }
2447
+ if (!!isNewUserTouched && !jwt?.isNewUser) {
2448
+ localStorage.removeItem(NEW_USER_TOUCHED_KEY);
2439
2449
  }
2440
2450
  } else {
2441
2451
  setHasServerVault(false);
2442
- setPage("keysare-backup" /* KEYSARE_BACKUP */);
2452
+ useLayoutDataStore.getState().setPage("keysare-backup" /* KEYSARE_BACKUP */);
2443
2453
  console.warn("[BACKUP STATUS] No recovery data found in vault, marking as no-server-vault");
2444
2454
  }
2445
2455
  },
2446
2456
  onError: (error) => {
2447
- setHasServerVault(false);
2457
+ useSession.getState().setHasServerVault(false);
2448
2458
  console.warn("[BACKUP STATUS] Failed to fetch initial vault status:", error);
2449
2459
  }
2450
2460
  });
@@ -2455,11 +2465,14 @@ function useBackupStatusChanges() {
2455
2465
  };
2456
2466
  }, []);
2457
2467
  }
2468
+ var NEW_USER_TOUCHED_KEY;
2458
2469
  var init_useBackupStatusChanges = __esm({
2459
2470
  "src/internal/hooks/useBackupStatusChanges.ts"() {
2460
2471
  init_SessionContext();
2472
+ init_auth();
2461
2473
  init_vaultClient();
2462
2474
  init_useLayoutDataStore();
2475
+ NEW_USER_TOUCHED_KEY = "embarkai-is-new-user-touhced";
2463
2476
  }
2464
2477
  });
2465
2478
 
@@ -11830,7 +11843,6 @@ var init_ChainsMenu = __esm({
11830
11843
 
11831
11844
  // src/internal/components/ChainsMenu/ChainSwitchRequest.tsx
11832
11845
  import { ArrowLeft as ArrowLeft5, Info as Info2, Loader as Loader7 } from "lucide-react";
11833
- import { useEffect as useEffect18, useRef as useRef12 } from "react";
11834
11846
  import { Trans } from "react-i18next";
11835
11847
  import { jsx as jsx49, jsxs as jsxs44 } from "react/jsx-runtime";
11836
11848
  function ChainSwitchRequest() {
@@ -11838,17 +11850,7 @@ function ChainSwitchRequest() {
11838
11850
  const config = useProviderConfig().config;
11839
11851
  const isLoading = useSession((st) => st.isLoading);
11840
11852
  const chainConfig = useSession((st) => st.chainConfig);
11841
- const setActiveChainId = useSession((st) => st.setActiveChainId);
11842
- const setPage = useLayoutDataStore((st) => st.setPage);
11843
11853
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
11844
- const changeTouchedRef = useRef12(false);
11845
- useEffect18(() => {
11846
- if (!changeTouchedRef.current || chainConfig?.id !== config.current?.network?.chainId) return;
11847
- setPage(null);
11848
- return () => {
11849
- changeTouchedRef.current = false;
11850
- };
11851
- }, [chainConfig, setPage]);
11852
11854
  const prefferedChain = NETWORK_OPTIONS.find((ch) => ch.chainId === config.current?.network?.chainId) || null;
11853
11855
  const PrefferedChainIcon = prefferedChain?.Icon || (() => null);
11854
11856
  return /* @__PURE__ */ jsx49(
@@ -11867,7 +11869,7 @@ function ChainSwitchRequest() {
11867
11869
  size: "icon",
11868
11870
  variant: "ghost",
11869
11871
  title: t("passport:common.back"),
11870
- onClick: () => setPage("settings" /* SETTINGS */),
11872
+ onClick: () => useLayoutDataStore.getState().setPage("settings" /* SETTINGS */),
11871
11873
  children: /* @__PURE__ */ jsx49(ArrowLeft5, { className: "h-4 w-4" })
11872
11874
  }
11873
11875
  ),
@@ -11899,8 +11901,8 @@ function ChainSwitchRequest() {
11899
11901
  disabled: isLoading,
11900
11902
  onClick: () => {
11901
11903
  if (!config.current?.network?.chainId) return;
11902
- changeTouchedRef.current = true;
11903
- setActiveChainId(config.current.network.chainId);
11904
+ useSession.getState().setActiveChainId(config.current.network.chainId);
11905
+ useLayoutDataStore.getState().setPage("chain" /* CHAIN */);
11904
11906
  },
11905
11907
  children: [
11906
11908
  isLoading ? /* @__PURE__ */ jsx49(Loader7, { className: "w-6 h-6 animate-spin" }) : /* @__PURE__ */ jsx49(PrefferedChainIcon, { className: "w-6 h-6" }),
@@ -12598,7 +12600,7 @@ var init_guardian_backup = __esm({
12598
12600
  });
12599
12601
 
12600
12602
  // src/internal/components/DevicesMenu/DeviceManageScreen.tsx
12601
- import { useCallback as useCallback14, useEffect as useEffect19, useRef as useRef13, useState as useState11 } from "react";
12603
+ import { useCallback as useCallback14, useEffect as useEffect18, useRef as useRef12, useState as useState11 } from "react";
12602
12604
  import { ArrowLeft as ArrowLeft7, Cpu, Download, HardDrive, Loader2 as Loader23, Trash2, Upload } from "lucide-react";
12603
12605
  import { Fragment as Fragment15, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
12604
12606
  function formatSize(bytes) {
@@ -12613,19 +12615,19 @@ function DeviceManageScreen() {
12613
12615
  const userId = session?.mpcUserId || "";
12614
12616
  const deviceId = pageParams?.deviceId;
12615
12617
  const deviceName = pageParams?.deviceName;
12616
- const guardianRef = useRef13(null);
12618
+ const guardianRef = useRef12(null);
12617
12619
  const [screen, setScreen] = useState11({ step: "connecting" });
12618
12620
  const [actionState, setActionState] = useState11(null);
12619
12621
  const [password, setPassword] = useState11("");
12620
12622
  const [statusMessage, setStatusMessage] = useState11(null);
12621
12623
  const [errorMessage, setErrorMessage] = useState11(null);
12622
12624
  const [waitingConfirm, setWaitingConfirm] = useState11(false);
12623
- useEffect19(() => {
12625
+ useEffect18(() => {
12624
12626
  if (!statusMessage) return;
12625
12627
  const t = setTimeout(() => setStatusMessage(null), 3e3);
12626
12628
  return () => clearTimeout(t);
12627
12629
  }, [statusMessage]);
12628
- useEffect19(() => {
12630
+ useEffect18(() => {
12629
12631
  if (!deviceId || !isWebSerialAvailable()) {
12630
12632
  setScreen({ step: "error", message: "WebSerial not available" });
12631
12633
  return;
@@ -13144,12 +13146,43 @@ var init_DevicesMenu = __esm({
13144
13146
  }
13145
13147
  });
13146
13148
 
13147
- // src/internal/components/KeyshareRestoreMenu/hooks/useRestoreStore.ts
13149
+ // src/internal/stores/useExternalWalletStore.ts
13148
13150
  import { create as create6 } from "zustand";
13151
+ var useExternalWalletStore;
13152
+ var init_useExternalWalletStore = __esm({
13153
+ "src/internal/stores/useExternalWalletStore.ts"() {
13154
+ useExternalWalletStore = create6((set) => ({
13155
+ configMode: "linked",
13156
+ activeMode: "linked",
13157
+ externalAddress: null,
13158
+ externalChainId: null,
13159
+ isExternalConnected: false,
13160
+ connectorName: null,
13161
+ setConfigMode: (mode) => set({ configMode: mode }),
13162
+ setActiveMode: (mode) => set({ activeMode: mode }),
13163
+ setExternalWallet: ({ address, chainId, connectorName }) => set({
13164
+ externalAddress: address,
13165
+ externalChainId: chainId,
13166
+ isExternalConnected: true,
13167
+ connectorName
13168
+ }),
13169
+ clearExternalWallet: () => set({
13170
+ externalAddress: null,
13171
+ externalChainId: null,
13172
+ isExternalConnected: false,
13173
+ connectorName: null
13174
+ }),
13175
+ setExternalChainId: (chainId) => set({ externalChainId: chainId })
13176
+ }));
13177
+ }
13178
+ });
13179
+
13180
+ // src/internal/components/KeyshareRestoreMenu/hooks/useRestoreStore.ts
13181
+ import { create as create7 } from "zustand";
13149
13182
  var useRestoreStore;
13150
13183
  var init_useRestoreStore = __esm({
13151
13184
  "src/internal/components/KeyshareRestoreMenu/hooks/useRestoreStore.ts"() {
13152
- useRestoreStore = create6((set) => ({
13185
+ useRestoreStore = create7((set) => ({
13153
13186
  method: null,
13154
13187
  // recoveryData: null,
13155
13188
  showPassword: false,
@@ -13722,7 +13755,7 @@ var init_cloudStorage = __esm({
13722
13755
 
13723
13756
  // src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts
13724
13757
  import { useMutation as useMutation9, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
13725
- import { useCallback as useCallback17, useEffect as useEffect20 } from "react";
13758
+ import { useCallback as useCallback17, useEffect as useEffect19 } from "react";
13726
13759
  function useCreateBackup() {
13727
13760
  const qc = useQueryClient9();
13728
13761
  const session = useSession((st) => st.session);
@@ -13731,7 +13764,7 @@ function useCreateBackup() {
13731
13764
  const usePasskey = useRestoreStore((st) => st.usePasskey);
13732
13765
  const restorePassword = useRestoreStore((st) => st.restorePassword);
13733
13766
  const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
13734
- useEffect20(() => {
13767
+ useEffect19(() => {
13735
13768
  if (!hasServerVault) {
13736
13769
  useRestoreStore.getState().setMethod("server");
13737
13770
  useLayoutStore.getState().setIsDialogForced(true);
@@ -13753,13 +13786,11 @@ function useCreateBackup() {
13753
13786
  throw new Error("Please provide a password for the backup");
13754
13787
  }
13755
13788
  const password = !usePasskey ? restorePassword : void 0;
13756
- console.log("[BACKUP STATUS] is new user:", jwt.isNewUser);
13757
13789
  return {
13758
- response: await iframeManager.createBackup(passportUserId, { method: "server", password }, jwt.accessToken),
13759
- isNewUser: jwt.isNewUser
13790
+ response: await iframeManager.createBackup(passportUserId, { method: "server", password }, jwt.accessToken)
13760
13791
  };
13761
13792
  },
13762
- onSuccess: async ({ response, isNewUser }) => {
13793
+ onSuccess: async ({ response }) => {
13763
13794
  const { setError, setSuccess } = useRestoreStore.getState();
13764
13795
  qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
13765
13796
  if (response.success) {
@@ -13768,11 +13799,7 @@ function useCreateBackup() {
13768
13799
  if (typeof window !== "undefined") {
13769
13800
  window.dispatchEvent(
13770
13801
  new CustomEvent("lumia-passport-backup-status-changed", {
13771
- detail: {
13772
- method: "server",
13773
- success: true,
13774
- navigateToNicknameMenu: !!isNewUser
13775
- }
13802
+ detail: { method: "server", success: true }
13776
13803
  })
13777
13804
  );
13778
13805
  }
@@ -14032,7 +14059,7 @@ var init_useRestoreAccount = __esm({
14032
14059
  });
14033
14060
 
14034
14061
  // src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts
14035
- import { useEffect as useEffect21 } from "react";
14062
+ import { useEffect as useEffect20 } from "react";
14036
14063
  function validateRestoreFileFormat(parsedData) {
14037
14064
  if (typeof parsedData !== "object" || parsedData === null) return false;
14038
14065
  const data = parsedData;
@@ -14042,7 +14069,7 @@ function useValidateFileBackup() {
14042
14069
  const restoreFile = useRestoreStore((st) => st.restoreFile);
14043
14070
  const setError = useRestoreStore((st) => st.setError);
14044
14071
  const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
14045
- useEffect21(() => {
14072
+ useEffect20(() => {
14046
14073
  if (!restoreFile) {
14047
14074
  return;
14048
14075
  }
@@ -14168,7 +14195,7 @@ var init_MethodSelector = __esm({
14168
14195
 
14169
14196
  // src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx
14170
14197
  import { ChevronRight as ChevronRight2, Eye, EyeOff, Info as Info3, Key as Key4, Loader as Loader8, Plus } from "lucide-react";
14171
- import { useEffect as useEffect22, useRef as useRef14 } from "react";
14198
+ import { useEffect as useEffect21, useRef as useRef13 } from "react";
14172
14199
  import { Fragment as Fragment18, jsx as jsx55, jsxs as jsxs50 } from "react/jsx-runtime";
14173
14200
  function PasswordPasskey(props) {
14174
14201
  const { t } = useT();
@@ -14183,7 +14210,7 @@ function PasswordPasskey(props) {
14183
14210
  onCreatePasskey
14184
14211
  } = props;
14185
14212
  const hasServerVault = useSession((st) => st.hasServerVault);
14186
- const actionRef = useRef14(null);
14213
+ const actionRef = useRef13(null);
14187
14214
  const {
14188
14215
  showPassword,
14189
14216
  restorePassword,
@@ -14197,7 +14224,7 @@ function PasswordPasskey(props) {
14197
14224
  } = useRestoreStore();
14198
14225
  const { config } = useProviderConfig();
14199
14226
  const isPasskeyEnabled = config.current.passkey.enabled;
14200
- useEffect22(() => {
14227
+ useEffect21(() => {
14201
14228
  if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
14202
14229
  }, [isPasskeyEnabled, usePasskey]);
14203
14230
  return /* @__PURE__ */ jsxs50(Fragment18, { children: [
@@ -14525,7 +14552,7 @@ var init_File = __esm({
14525
14552
  import { useQueryClient as useQueryClient10 } from "@tanstack/react-query";
14526
14553
  import dayjs3 from "dayjs";
14527
14554
  import { Download as Download3, Key as Key5, Upload as Upload3 } from "lucide-react";
14528
- import { useEffect as useEffect23 } from "react";
14555
+ import { useEffect as useEffect22 } from "react";
14529
14556
  import { Fragment as Fragment21, jsx as jsx58, jsxs as jsxs53 } from "react/jsx-runtime";
14530
14557
  function Server(props) {
14531
14558
  const { isLoading, mode = "restore", serverHandler, createPasskeyHandler } = props;
@@ -14535,7 +14562,7 @@ function Server(props) {
14535
14562
  const usePasskey = useRestoreStore((st) => st.usePasskey);
14536
14563
  const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
14537
14564
  const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
14538
- useEffect23(() => {
14565
+ useEffect22(() => {
14539
14566
  if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
14540
14567
  setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
14541
14568
  }, [mode, serverRecoveryStatus, setUsePasskey]);
@@ -14558,7 +14585,7 @@ function Server(props) {
14558
14585
  ) : t("passport:backupMenu.vaultRestore")
14559
14586
  }
14560
14587
  ),
14561
- !!serverRecoveryStatus?.created?.at && /* @__PURE__ */ jsxs53(Highlight, { type: "success", className: "flex gap-[var(--ui-kit-gap)]", children: [
14588
+ !!serverRecoveryStatus?.created?.at && /* @__PURE__ */ jsxs53(Highlight, { type: "info", className: "flex gap-[var(--ui-kit-gap)]", children: [
14562
14589
  serverRecoveryStatus.created.encryptionMethod === "password" ? /* @__PURE__ */ jsx58(OtpIcon, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx58(Key5, { className: "w-4 h-4" }),
14563
14590
  /* @__PURE__ */ jsxs53("span", { className: "flex-1 block", children: [
14564
14591
  t("passport:backupMenu.vaultRecoveryStatus"),
@@ -14718,7 +14745,7 @@ var init_select = __esm({
14718
14745
  // src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx
14719
14746
  import { useQuery as useQuery6 } from "@tanstack/react-query";
14720
14747
  import { ArrowLeft as ArrowLeft10, CloudDownload, CloudUpload, Loader as Loader9 } from "lucide-react";
14721
- import { useEffect as useEffect24 } from "react";
14748
+ import { useEffect as useEffect23 } from "react";
14722
14749
  import { Fragment as Fragment22, jsx as jsx60, jsxs as jsxs55 } from "react/jsx-runtime";
14723
14750
  function Cloud2(props) {
14724
14751
  const { isLoading, mode = "restore", cloudHandler } = props;
@@ -14739,7 +14766,7 @@ function Cloud2(props) {
14739
14766
  return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
14740
14767
  }
14741
14768
  });
14742
- useEffect24(() => {
14769
+ useEffect23(() => {
14743
14770
  if (isCloudProvidersLoading) return;
14744
14771
  if (!!cloudProvidersError) {
14745
14772
  console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
@@ -14979,7 +15006,8 @@ var init_methods = __esm({
14979
15006
  // src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
14980
15007
  import { useMutation as useMutation11, useQuery as useQuery7, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
14981
15008
  import { AlertCircle as AlertCircle2, CheckCircle2, CloudDownload as CloudDownload2, Loader as Loader10, UserCircle as UserCircle2 } from "lucide-react";
14982
- import { useEffect as useEffect25 } from "react";
15009
+ import { useEffect as useEffect24 } from "react";
15010
+ import { useDisconnect } from "wagmi";
14983
15011
  import { Fragment as Fragment24, jsx as jsx62, jsxs as jsxs57 } from "react/jsx-runtime";
14984
15012
  var RESTORE_COMPONENTS, KeyshareRestoreMenu;
14985
15013
  var init_KeyshareRestoreMenu = __esm({
@@ -14989,6 +15017,7 @@ var init_KeyshareRestoreMenu = __esm({
14989
15017
  init_i18n();
14990
15018
  init_useLayoutDataStore();
14991
15019
  init_useLayoutStore();
15020
+ init_useExternalWalletStore();
14992
15021
  init_vaultClient();
14993
15022
  init_Expandable2();
14994
15023
  init_button();
@@ -15014,7 +15043,7 @@ var init_KeyshareRestoreMenu = __esm({
15014
15043
  const error = useRestoreStore((st) => st.error);
15015
15044
  const success = useRestoreStore((st) => st.success);
15016
15045
  const currentRestoreMethod = useRestoreStore((st) => st.method);
15017
- useEffect25(() => {
15046
+ useEffect24(() => {
15018
15047
  const { setIsDialogForced } = useLayoutStore.getState();
15019
15048
  const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
15020
15049
  setIsDialogForced(true);
@@ -15027,6 +15056,18 @@ var init_KeyshareRestoreMenu = __esm({
15027
15056
  setIsDialogForced(false);
15028
15057
  };
15029
15058
  }, []);
15059
+ const { disconnect: wagmiDisconnect } = useDisconnect({
15060
+ mutation: {
15061
+ onSuccess: () => {
15062
+ useExternalWalletStore.getState().clearExternalWallet();
15063
+ useExternalWalletStore.getState().setExternalChainId(null);
15064
+ console.log("[ExternalWalletStore] Disconnected from external wallet");
15065
+ },
15066
+ onError: (err) => {
15067
+ console.error("[ExternalWalletStore] Error disconnecting from external wallet:", err);
15068
+ }
15069
+ }
15070
+ });
15030
15071
  const { onRestoreSuccess } = useOnRestoreSuccess();
15031
15072
  const {
15032
15073
  restoreFromServer: restoreFromServer2,
@@ -15042,7 +15083,7 @@ var init_KeyshareRestoreMenu = __esm({
15042
15083
  queryFn: async () => await getShareRecoveryStats()
15043
15084
  });
15044
15085
  const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
15045
- useEffect25(() => {
15086
+ useEffect24(() => {
15046
15087
  if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
15047
15088
  }, [hasServerBackup]);
15048
15089
  const { mutate: disconnect, isPending: isDisconnecting } = useMutation11({
@@ -15062,6 +15103,7 @@ var init_KeyshareRestoreMenu = __esm({
15062
15103
  },
15063
15104
  onSuccess: async ({ disconnectedUserId }) => {
15064
15105
  await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
15106
+ if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
15065
15107
  const { setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
15066
15108
  setSession(null);
15067
15109
  setAddress(null);
@@ -15188,7 +15230,7 @@ var init_KeyshareRestoreMenu = __esm({
15188
15230
  // src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx
15189
15231
  import { useQuery as useQuery8 } from "@tanstack/react-query";
15190
15232
  import { AlertCircle as AlertCircle3, ArrowLeft as ArrowLeft11, CheckCircle2 as CheckCircle22, Loader as Loader11, LockIcon } from "lucide-react";
15191
- import { useEffect as useEffect26 } from "react";
15233
+ import { useEffect as useEffect25 } from "react";
15192
15234
  import { Fragment as Fragment25, jsx as jsx63, jsxs as jsxs58 } from "react/jsx-runtime";
15193
15235
  function KeyshareBackupMenu() {
15194
15236
  const address = useSession((st) => st.address);
@@ -15199,7 +15241,7 @@ function KeyshareBackupMenu() {
15199
15241
  const currentBackupMethod = useRestoreStore((st) => st.method);
15200
15242
  const error = useRestoreStore((st) => st.error);
15201
15243
  const success = useRestoreStore((st) => st.success);
15202
- useEffect26(() => {
15244
+ useEffect25(() => {
15203
15245
  const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
15204
15246
  return () => {
15205
15247
  setSuccess(null);
@@ -15218,7 +15260,7 @@ function KeyshareBackupMenu() {
15218
15260
  queryFn: async () => await getShareRecoveryStats()
15219
15261
  });
15220
15262
  const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
15221
- useEffect26(() => {
15263
+ useEffect25(() => {
15222
15264
  if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
15223
15265
  }, [hasRecoveryData]);
15224
15266
  const {
@@ -15322,7 +15364,16 @@ function KeyshareBackupMenu() {
15322
15364
  /* @__PURE__ */ jsx63(CheckCircle22, { className: "h-4 w-4 flex-shrink-0" }),
15323
15365
  /* @__PURE__ */ jsx63("span", { className: "block w-full flex-1", children: success })
15324
15366
  ] }),
15325
- /* @__PURE__ */ jsx63(Button, { variant: "default", size: "large", className: "w-full", onClick: () => setPage("settings" /* SETTINGS */), children: t("passport:common.continue") })
15367
+ /* @__PURE__ */ jsx63(
15368
+ Button,
15369
+ {
15370
+ variant: "default",
15371
+ size: "large",
15372
+ className: "w-full",
15373
+ onClick: () => useRestoreStore.getState().setSuccess(null),
15374
+ children: t("passport:common.continue")
15375
+ }
15376
+ )
15326
15377
  ] })
15327
15378
  ] })
15328
15379
  }
@@ -15362,7 +15413,7 @@ var init_KeyshareRestoreMenu2 = __esm({
15362
15413
  });
15363
15414
 
15364
15415
  // src/hooks/useColorMode.ts
15365
- import { useCallback as useCallback18, useEffect as useEffect27 } from "react";
15416
+ import { useCallback as useCallback18, useEffect as useEffect26 } from "react";
15366
15417
  function useColorMode() {
15367
15418
  const {
15368
15419
  config: { current: config }
@@ -15377,7 +15428,7 @@ function useColorMode() {
15377
15428
  },
15378
15429
  [handleStoreColorMode]
15379
15430
  );
15380
- useEffect27(() => {
15431
+ useEffect26(() => {
15381
15432
  let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
15382
15433
  if (!targetColorMode && !preferedColorMode) {
15383
15434
  const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
@@ -15492,17 +15543,17 @@ var init_SumsubIframeManager = __esm({
15492
15543
  });
15493
15544
 
15494
15545
  // src/internal/components/KYC/useSumsubIframe.ts
15495
- import { useEffect as useEffect28, useRef as useRef15, useState as useState16 } from "react";
15546
+ import { useEffect as useEffect27, useRef as useRef14, useState as useState16 } from "react";
15496
15547
  function useSumsubIframe({ iframeUrl }) {
15497
15548
  const config = useProviderConfig().config;
15498
15549
  const { colorMode } = useColorMode();
15499
- const iframeRef = useRef15(null);
15550
+ const iframeRef = useRef14(null);
15500
15551
  const [isLoading, setIsLoading] = useState16(true);
15501
15552
  const [error, setError] = useState16(null);
15502
15553
  const [height, setHeight] = useState16(0);
15503
15554
  const [status, setStatus] = useState16("");
15504
15555
  const levelName = config.current?.kyc?.options?.levelName;
15505
- useEffect28(() => {
15556
+ useEffect27(() => {
15506
15557
  setError(null);
15507
15558
  setIsLoading(true);
15508
15559
  setStatus("Preparing verification...");
@@ -15814,14 +15865,14 @@ var init_useProvidersList = __esm({
15814
15865
 
15815
15866
  // src/internal/components/MainMenu/MainMenu.tsx
15816
15867
  import { ChevronLeft, ChevronRight as ChevronRight3, DollarSign as DollarSign2, Wallet2 as Wallet23 } from "lucide-react";
15817
- import { useEffect as useEffect29 } from "react";
15868
+ import { useEffect as useEffect28 } from "react";
15818
15869
  import { jsx as jsx68, jsxs as jsxs63 } from "react/jsx-runtime";
15819
15870
  function MainMenu() {
15820
15871
  const address = useSession((st) => st.address);
15821
15872
  const { t } = useT();
15822
15873
  const setPage = useLayoutDataStore((st) => st.setPage);
15823
15874
  const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
15824
- useEffect29(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
15875
+ useEffect28(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
15825
15876
  useProvidersList();
15826
15877
  return /* @__PURE__ */ jsx68("div", { className: "w-full p-[var(--ui-kit-pd)] flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ jsx68("div", { className: "w-full grid grid-cols-4 gap-0 md:gap-[var(--ui-kit-gap)] py-[10px] md:py-1", children: MAIN_MENU_BUTTONS.map(({ id, label, icon: Icon2 }) => /* @__PURE__ */ jsxs63(
15827
15878
  Button,
@@ -15907,11 +15958,11 @@ var init_linkedProfiles = __esm({
15907
15958
  });
15908
15959
 
15909
15960
  // src/internal/components/ManageWalletMenu/hooks/useStore.ts
15910
- import { create as create7 } from "zustand";
15961
+ import { create as create8 } from "zustand";
15911
15962
  var useManageWalletStore;
15912
15963
  var init_useStore = __esm({
15913
15964
  "src/internal/components/ManageWalletMenu/hooks/useStore.ts"() {
15914
- useManageWalletStore = create7((set) => ({
15965
+ useManageWalletStore = create8((set) => ({
15915
15966
  alert: null,
15916
15967
  emailStep: "input",
15917
15968
  email: "",
@@ -16368,7 +16419,7 @@ var init_EmailNotConnectedWarning = __esm({
16368
16419
 
16369
16420
  // src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts
16370
16421
  import { useQueryClient as useQueryClient15 } from "@tanstack/react-query";
16371
- import React5, { useEffect as useEffect30 } from "react";
16422
+ import React5, { useEffect as useEffect29 } from "react";
16372
16423
  function normalizeSocialLinkError(message) {
16373
16424
  if (message === "X_ALREADY_LINKED") {
16374
16425
  return "This X account is already linked to another account";
@@ -16444,7 +16495,7 @@ function useLinkSocial() {
16444
16495
  [config.social?.providers]
16445
16496
  );
16446
16497
  const [socialLinkStarted, setSocialLinkStarted] = React5.useState(false);
16447
- useEffect30(() => {
16498
+ useEffect29(() => {
16448
16499
  const key = providerType?.toLowerCase();
16449
16500
  console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
16450
16501
  if (isWalletLinking) {
@@ -16527,7 +16578,7 @@ var init_telegram2 = __esm({
16527
16578
 
16528
16579
  // src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts
16529
16580
  import { useQueryClient as useQueryClient16 } from "@tanstack/react-query";
16530
- import { useCallback as useCallback20, useEffect as useEffect31, useState as useState17 } from "react";
16581
+ import { useCallback as useCallback20, useEffect as useEffect30, useState as useState17 } from "react";
16531
16582
  function useLinkTelegram() {
16532
16583
  const {
16533
16584
  config: { current: config },
@@ -16586,7 +16637,7 @@ function useLinkTelegram() {
16586
16637
  }
16587
16638
  }, [config.social?.providers]);
16588
16639
  const [telegramLinkStarted, setTelegramLinkStarted] = useState17(false);
16589
- useEffect31(() => {
16640
+ useEffect30(() => {
16590
16641
  console.log("[useLinkTelegram] Effect triggered:", {
16591
16642
  providerType,
16592
16643
  linkIsLoading,
@@ -16603,7 +16654,7 @@ function useLinkTelegram() {
16603
16654
  handleLinkTelegram();
16604
16655
  }
16605
16656
  }, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
16606
- useEffect31(() => {
16657
+ useEffect30(() => {
16607
16658
  if (providerType !== "telegram") {
16608
16659
  setTelegramLinkStarted(false);
16609
16660
  }
@@ -16903,48 +16954,17 @@ var init_ManageWallet = __esm({
16903
16954
  }
16904
16955
  });
16905
16956
 
16906
- // src/internal/stores/useExternalWalletStore.ts
16907
- import { create as create8 } from "zustand";
16908
- var useExternalWalletStore;
16909
- var init_useExternalWalletStore = __esm({
16910
- "src/internal/stores/useExternalWalletStore.ts"() {
16911
- useExternalWalletStore = create8((set) => ({
16912
- configMode: "linked",
16913
- activeMode: "linked",
16914
- externalAddress: null,
16915
- externalChainId: null,
16916
- isExternalConnected: false,
16917
- connectorName: null,
16918
- setConfigMode: (mode) => set({ configMode: mode }),
16919
- setActiveMode: (mode) => set({ activeMode: mode }),
16920
- setExternalWallet: ({ address, chainId, connectorName }) => set({
16921
- externalAddress: address,
16922
- externalChainId: chainId,
16923
- isExternalConnected: true,
16924
- connectorName
16925
- }),
16926
- clearExternalWallet: () => set({
16927
- externalAddress: null,
16928
- externalChainId: null,
16929
- isExternalConnected: false,
16930
- connectorName: null
16931
- }),
16932
- setExternalChainId: (chainId) => set({ externalChainId: chainId })
16933
- }));
16934
- }
16935
- });
16936
-
16937
16957
  // src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx
16938
16958
  import { useMutation as useMutation15, useQueryClient as useQueryClient17 } from "@tanstack/react-query";
16939
16959
  import { Key as Key6, Loader as Loader15 } from "lucide-react";
16940
16960
  import { useState as useState18 } from "react";
16941
- import { useDisconnect } from "wagmi";
16961
+ import { useDisconnect as useDisconnect2 } from "wagmi";
16942
16962
  import { jsx as jsx74, jsxs as jsxs69 } from "react/jsx-runtime";
16943
16963
  function UnlinkProviderMenu() {
16944
16964
  const qc = useQueryClient17();
16945
16965
  const address = useSession((st) => st.address);
16946
16966
  const { callbacksRef } = useProviderConfig();
16947
- const { disconnect: disconnectExternalWallet } = useDisconnect();
16967
+ const { disconnect: disconnectExternalWallet } = useDisconnect2();
16948
16968
  const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
16949
16969
  const { t } = useT();
16950
16970
  const setPage = useLayoutDataStore((st) => st.setPage);
@@ -17326,19 +17346,19 @@ var init_NicknameEditForm = __esm({
17326
17346
 
17327
17347
  // src/internal/components/NicknameMenu/useNickname.ts
17328
17348
  import { useQuery as useQuery12 } from "@tanstack/react-query";
17329
- import { useEffect as useEffect32, useState as useState20 } from "react";
17349
+ import { useEffect as useEffect31, useState as useState20 } from "react";
17330
17350
  function useNicknameForm(currentNickname) {
17331
17351
  const [inputValue, setInputValue] = useState20("");
17332
17352
  const normalizedInputValue = normalizeNickname(inputValue);
17333
17353
  const validation = validateNickname(inputValue);
17334
17354
  const isValidForCheck = validation.valid && normalizedInputValue.length > 0;
17335
- useEffect32(() => {
17355
+ useEffect31(() => {
17336
17356
  setInputValue(currentNickname);
17337
17357
  }, [currentNickname]);
17338
17358
  const [queryInputValue, setQueryInputValue] = useState20("");
17339
17359
  const isSameAsCurrentNickname = normalizedInputValue === currentNickname.toLowerCase();
17340
17360
  const shouldCheckAvailability = validation.valid && !isSameAsCurrentNickname && inputValue.length > 0;
17341
- useEffect32(() => {
17361
+ useEffect31(() => {
17342
17362
  if (!isValidForCheck || !shouldCheckAvailability) {
17343
17363
  setQueryInputValue("");
17344
17364
  return;
@@ -17645,7 +17665,7 @@ var init_useWatchTokens = __esm({
17645
17665
  // src/internal/hooks/useBlockscoutAssets.ts
17646
17666
  import { createBlockscoutClient } from "@embarkai/core/clients";
17647
17667
  import { useQuery as useQuery15 } from "@tanstack/react-query";
17648
- import { useCallback as useCallback22, useMemo as useMemo9, useRef as useRef16 } from "react";
17668
+ import { useCallback as useCallback22, useMemo as useMemo9, useRef as useRef15 } from "react";
17649
17669
  import { formatEther, formatUnits as formatUnits3 } from "viem";
17650
17670
  function resolveIpfsUri(uri) {
17651
17671
  if (!uri) return "";
@@ -17781,7 +17801,7 @@ function useBlockscoutAssets(options) {
17781
17801
  () => blockscoutApiUrl ? createBlockscoutClient({ baseUrl: blockscoutApiUrl }) : null,
17782
17802
  [blockscoutApiUrl]
17783
17803
  );
17784
- const lastRefreshRef = useRef16(0);
17804
+ const lastRefreshRef = useRef15(0);
17785
17805
  const {
17786
17806
  assets: watchTokenAssets,
17787
17807
  isLoading: watchTokensLoading,
@@ -18411,7 +18431,7 @@ var init_nickname_fingerprint = __esm({
18411
18431
  // src/internal/components/ReceiveMenu/ReceiveMenu.tsx
18412
18432
  import { ArrowLeft as ArrowLeft17, CheckCircle2 as CheckCircle23, Copy as Copy3, Info as Info5, Loader as Loader21, Shield } from "lucide-react";
18413
18433
  import QRCode from "qrcode";
18414
- import { useCallback as useCallback24, useEffect as useEffect33, useMemo as useMemo10, useState as useState23 } from "react";
18434
+ import { useCallback as useCallback24, useEffect as useEffect32, useMemo as useMemo10, useState as useState23 } from "react";
18415
18435
  import { Fragment as Fragment31, jsx as jsx81, jsxs as jsxs76 } from "react/jsx-runtime";
18416
18436
  function ReceiveMenu() {
18417
18437
  const session = useSession((st) => st.session);
@@ -18433,7 +18453,7 @@ function ReceiveMenu() {
18433
18453
  return null;
18434
18454
  }
18435
18455
  }, [session?.ownerAddress]);
18436
- useEffect33(() => {
18456
+ useEffect32(() => {
18437
18457
  if (open && address) {
18438
18458
  QRCode.toDataURL(address, {
18439
18459
  width: 200,
@@ -19328,7 +19348,7 @@ var init_useBridgeStore = __esm({
19328
19348
  // src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx
19329
19349
  import { useConnectModal } from "@rainbow-me/rainbowkit";
19330
19350
  import { useMutation as useMutation18 } from "@tanstack/react-query";
19331
- import { useEffect as useEffect34, useRef as useRef17, useState as useState25 } from "react";
19351
+ import { useEffect as useEffect33, useRef as useRef16, useState as useState25 } from "react";
19332
19352
  import { useSignMessage } from "wagmi";
19333
19353
  import { jsx as jsx89, jsxs as jsxs84 } from "react/jsx-runtime";
19334
19354
  function SenderSelector(props) {
@@ -19339,12 +19359,12 @@ function SenderSelector(props) {
19339
19359
  const { openConnectModal } = useConnectModal();
19340
19360
  const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
19341
19361
  const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
19342
- const pendingWalletRef = useRef17(null);
19362
+ const pendingWalletRef = useRef16(null);
19343
19363
  const originChain = useBridgeStore((st) => st.originChain);
19344
19364
  const bridgeSender = useBridgeStore((st) => st.bridgeSender);
19345
19365
  const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
19346
19366
  const [walletMessage, setWalletMessage] = useState25(null);
19347
- useEffect34(() => {
19367
+ useEffect33(() => {
19348
19368
  useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
19349
19369
  }, [walletMessage]);
19350
19370
  const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = useMutation18({
@@ -19400,7 +19420,7 @@ function SenderSelector(props) {
19400
19420
  setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
19401
19421
  }
19402
19422
  });
19403
- useEffect34(() => {
19423
+ useEffect33(() => {
19404
19424
  const pendingProfile = pendingWalletRef.current;
19405
19425
  if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
19406
19426
  if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
@@ -19585,12 +19605,12 @@ var init_wallets = __esm({
19585
19605
  });
19586
19606
 
19587
19607
  // src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts
19588
- import { useEffect as useEffect35, useRef as useRef18 } from "react";
19608
+ import { useEffect as useEffect34, useRef as useRef17 } from "react";
19589
19609
  function useAvailableSenders() {
19590
19610
  const address = useSession((st) => st.address);
19591
19611
  const { profiles } = useLinkedProfiles();
19592
- const lastCalcedSenders = useRef18([]);
19593
- useEffect35(() => {
19612
+ const lastCalcedSenders = useRef17([]);
19613
+ useEffect34(() => {
19594
19614
  const sendersAccumulator = [
19595
19615
  {
19596
19616
  type: "embarkai-wallet",
@@ -19953,7 +19973,7 @@ var init_utils8 = __esm({
19953
19973
  // src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts
19954
19974
  import { useInfiniteQuery as useInfiniteQuery3 } from "@tanstack/react-query";
19955
19975
  import { debounce as debounce6 } from "lodash-es";
19956
- import { useCallback as useCallback25, useEffect as useEffect36, useMemo as useMemo11 } from "react";
19976
+ import { useCallback as useCallback25, useEffect as useEffect35, useMemo as useMemo11 } from "react";
19957
19977
  function useHyperlaneHistory() {
19958
19978
  const address = useSession((st) => st.address);
19959
19979
  const page = useLayoutDataStore((st) => st.page);
@@ -19979,7 +19999,7 @@ function useHyperlaneHistory() {
19979
19999
  }, 250),
19980
20000
  []
19981
20001
  );
19982
- useEffect36(() => {
20002
+ useEffect35(() => {
19983
20003
  if (isBridgeTxHistoryLoading || txList.length === 0) return;
19984
20004
  updateExpandable();
19985
20005
  }, [isBridgeTxHistoryLoading, txList]);
@@ -20219,7 +20239,7 @@ var init_useBridge = __esm({
20219
20239
 
20220
20240
  // src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts
20221
20241
  import { useQuery as useQuery19 } from "@tanstack/react-query";
20222
- import { useEffect as useEffect37 } from "react";
20242
+ import { useEffect as useEffect36 } from "react";
20223
20243
  function useHyperlaneRoutes() {
20224
20244
  const address = useSession((st) => st.address);
20225
20245
  const page = useLayoutDataStore((st) => st.page);
@@ -20235,7 +20255,7 @@ function useHyperlaneRoutes() {
20235
20255
  queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
20236
20256
  queryFn: async () => getHyperlaneWarpRoutes()
20237
20257
  });
20238
- useEffect37(() => {
20258
+ useEffect36(() => {
20239
20259
  if (!errorWarpRoutes) return;
20240
20260
  useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
20241
20261
  const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
@@ -20244,7 +20264,7 @@ function useHyperlaneRoutes() {
20244
20264
  setOriginChain(null);
20245
20265
  setDestinationChain(null);
20246
20266
  }, [errorWarpRoutes]);
20247
- useEffect37(() => {
20267
+ useEffect36(() => {
20248
20268
  if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
20249
20269
  const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
20250
20270
  if (!warpRouteToAutoSelect) return;
@@ -20277,13 +20297,13 @@ var init_useHyperlaneRoutes = __esm({
20277
20297
  });
20278
20298
 
20279
20299
  // src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts
20280
- import { useEffect as useEffect38 } from "react";
20300
+ import { useEffect as useEffect37 } from "react";
20281
20301
  function useMenuTitle(warpRoutes) {
20282
20302
  const { t } = useT();
20283
20303
  const bridgeStep = useBridgeStore((st) => st.bridgeStep);
20284
20304
  const hyperRoute = useBridgeStore((st) => st.hyperRoute);
20285
20305
  const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
20286
- useEffect38(() => {
20306
+ useEffect37(() => {
20287
20307
  const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
20288
20308
  switch (true) {
20289
20309
  case bridgeStep === "sender-selector":
@@ -20335,7 +20355,7 @@ var init_ResolveChainIcon = __esm({
20335
20355
  // src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts
20336
20356
  import { CHAINS_BROWSERS_TRANSPORTS as CHAINS_BROWSERS_TRANSPORTS2 } from "@embarkai/core";
20337
20357
  import { useQuery as useQuery20, useQueryClient as useQueryClient23 } from "@tanstack/react-query";
20338
- import { useCallback as useCallback27, useEffect as useEffect39 } from "react";
20358
+ import { useCallback as useCallback27, useEffect as useEffect38 } from "react";
20339
20359
  import { createPublicClient as createPublicClient2, erc20Abi as erc20Abi2, formatUnits as formatUnits7, http as http3 } from "viem";
20340
20360
  import { useSwitchChain as useSwitchChain2 } from "wagmi";
20341
20361
  function useBridgeBalance(hyperlaneWarpRoutes) {
@@ -20440,7 +20460,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
20440
20460
  },
20441
20461
  [refreshBalances, qc]
20442
20462
  );
20443
- useEffect39(() => {
20463
+ useEffect38(() => {
20444
20464
  if (!bridgeSender || !originChain) return;
20445
20465
  switch (bridgeSender) {
20446
20466
  case "embarkai-wallet":
@@ -21395,7 +21415,7 @@ var init_steps = __esm({
21395
21415
  });
21396
21416
 
21397
21417
  // src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx
21398
- import { useEffect as useEffect40 } from "react";
21418
+ import { useEffect as useEffect39 } from "react";
21399
21419
  import { Fragment as Fragment38, jsx as jsx99, jsxs as jsxs91 } from "react/jsx-runtime";
21400
21420
  function HyperlaneBridge() {
21401
21421
  const bridgeStep = useBridgeStore((st) => st.bridgeStep);
@@ -21403,7 +21423,7 @@ function HyperlaneBridge() {
21403
21423
  const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
21404
21424
  const { directWalletProfile } = useAvailableSenders();
21405
21425
  useMenuTitle(hyperlaneWarpRoutes);
21406
- useEffect40(
21426
+ useEffect39(
21407
21427
  () => () => {
21408
21428
  useBridgeStore.getState().resetSelections();
21409
21429
  },
@@ -21450,14 +21470,14 @@ var init_HyperlaneBridge = __esm({
21450
21470
  });
21451
21471
 
21452
21472
  // src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx
21453
- import { useRef as useRef19 } from "react";
21473
+ import { useRef as useRef18 } from "react";
21454
21474
  import { jsx as jsx100 } from "react/jsx-runtime";
21455
21475
  function BridgeHistorySwitch(props) {
21456
21476
  const { disabled } = props;
21457
21477
  const selectorFlow = useFlowSelectorStore((st) => st.flow);
21458
21478
  const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
21459
21479
  const bridgeStep = useBridgeStore((st) => st.bridgeStep);
21460
- const lastBridgeStepRef = useRef19(null);
21480
+ const lastBridgeStepRef = useRef18(null);
21461
21481
  if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
21462
21482
  return null;
21463
21483
  }
@@ -21559,7 +21579,7 @@ var init_useErc3643Compliance = __esm({
21559
21579
 
21560
21580
  // src/hooks/useNicknameResolve.ts
21561
21581
  import { useQuery as useQuery21 } from "@tanstack/react-query";
21562
- import { useState as useState28, useEffect as useEffect41, useMemo as useMemo13 } from "react";
21582
+ import { useState as useState28, useEffect as useEffect40, useMemo as useMemo13 } from "react";
21563
21583
  function looksLikeNickname(input) {
21564
21584
  if (!input) return false;
21565
21585
  if (input.startsWith("0x")) return false;
@@ -21573,7 +21593,7 @@ function useNicknameResolve(input, options) {
21573
21593
  const [isDebouncing, setIsDebouncing] = useState28(false);
21574
21594
  const normalized = normalizeNickname(input);
21575
21595
  const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
21576
- useEffect41(() => {
21596
+ useEffect40(() => {
21577
21597
  if (!isNicknameInput || !enabled) {
21578
21598
  setDebouncedInput("");
21579
21599
  setIsDebouncing(false);
@@ -22561,7 +22581,7 @@ var init_sendSteps = __esm({
22561
22581
 
22562
22582
  // src/internal/components/SendMenu/send/SendMenu.tsx
22563
22583
  import { CheckCircle2 as CheckCircle26, Loader as Loader31 } from "lucide-react";
22564
- import { useEffect as useEffect42, useMemo as useMemo14 } from "react";
22584
+ import { useEffect as useEffect41, useMemo as useMemo14 } from "react";
22565
22585
  import { parseUnits as parseUnits2 } from "viem";
22566
22586
  import { Fragment as Fragment42, jsx as jsx107, jsxs as jsxs98 } from "react/jsx-runtime";
22567
22587
  function SendMenu() {
@@ -22583,10 +22603,10 @@ function SendMenu() {
22583
22603
  userOpHash,
22584
22604
  reset
22585
22605
  } = useSendTransaction();
22586
- useEffect42(() => {
22606
+ useEffect41(() => {
22587
22607
  useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
22588
22608
  }, [isAssetsLoading, isTransactionPending]);
22589
- useEffect42(() => {
22609
+ useEffect41(() => {
22590
22610
  useFlowSelectorStore.getState().setError(sendTransactionError || null);
22591
22611
  }, [sendTransactionError]);
22592
22612
  const {
@@ -22601,7 +22621,7 @@ function SendMenu() {
22601
22621
  } = useSendStore();
22602
22622
  const isNft = isNftAsset3(selectedAsset);
22603
22623
  const isSecurity = isSecurityToken2(selectedAsset);
22604
- useEffect42(
22624
+ useEffect41(
22605
22625
  () => () => {
22606
22626
  setSelectedAsset(null);
22607
22627
  setRecipient("");
@@ -22611,7 +22631,7 @@ function SendMenu() {
22611
22631
  },
22612
22632
  []
22613
22633
  );
22614
- useEffect42(() => {
22634
+ useEffect41(() => {
22615
22635
  const shouldSetNativeAsset = assets.length > 0 && !selectedAsset;
22616
22636
  if (!shouldSetNativeAsset) return;
22617
22637
  const native = assets.find((a) => a.type === "native");
@@ -22637,7 +22657,7 @@ function SendMenu() {
22637
22657
  enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
22638
22658
  chainId: activeChainId
22639
22659
  });
22640
- useEffect42(() => {
22660
+ useEffect41(() => {
22641
22661
  const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
22642
22662
  switch (true) {
22643
22663
  case txStep === "select-asset":
@@ -22730,7 +22750,7 @@ var init_send = __esm({
22730
22750
 
22731
22751
  // src/internal/components/SendMenu/SendFlowSelector.tsx
22732
22752
  import { ArrowLeft as ArrowLeft19, ArrowRightIcon as ArrowRightIcon2, ArrowRightLeftIcon as ArrowRightLeftIcon2, InfoIcon as InfoIcon5 } from "lucide-react";
22733
- import { useEffect as useEffect43 } from "react";
22753
+ import { useEffect as useEffect42 } from "react";
22734
22754
  import { jsx as jsx108, jsxs as jsxs99 } from "react/jsx-runtime";
22735
22755
  function SelectorFlowButtons() {
22736
22756
  const { t } = useT();
@@ -22793,7 +22813,7 @@ function SendFlowSelector() {
22793
22813
  const error = useFlowSelectorStore((st) => st.error);
22794
22814
  const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
22795
22815
  const selectorFlow = useFlowSelectorStore((st) => st.flow);
22796
- useEffect43(
22816
+ useEffect42(
22797
22817
  () => () => {
22798
22818
  useFlowSelectorStore.getState().setError(null);
22799
22819
  },
@@ -22976,7 +22996,7 @@ var init_constants6 = __esm({
22976
22996
  // src/internal/components/SettingsMenu/SettingsMenu.tsx
22977
22997
  import { useQuery as useQuery22 } from "@tanstack/react-query";
22978
22998
  import { ArrowLeft as ArrowLeft20, HardDrive as HardDrive3 } from "lucide-react";
22979
- import { useEffect as useEffect44 } from "react";
22999
+ import { useEffect as useEffect43 } from "react";
22980
23000
  import { jsx as jsx110, jsxs as jsxs100 } from "react/jsx-runtime";
22981
23001
  function useSettingsButtons() {
22982
23002
  const config = useProviderConfig().config;
@@ -22995,7 +23015,7 @@ function useSettingsButtons() {
22995
23015
  if (proMode) {
22996
23016
  settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: HardDrive3 });
22997
23017
  }
22998
- useEffect44(() => {
23018
+ useEffect43(() => {
22999
23019
  const cssvEl = document.querySelector(".embarkai-ui-scope");
23000
23020
  if (!cssvEl || !window?.getComputedStyle) {
23001
23021
  return;
@@ -24264,7 +24284,7 @@ var init_PageMap = __esm({
24264
24284
  });
24265
24285
 
24266
24286
  // src/internal/hooks/usePageMapper.tsx
24267
- import { useCallback as useCallback30, useEffect as useEffect45 } from "react";
24287
+ import { useCallback as useCallback30, useEffect as useEffect44 } from "react";
24268
24288
  import { jsx as jsx115 } from "react/jsx-runtime";
24269
24289
  function usePageMapper() {
24270
24290
  const page = useLayoutDataStore((st) => st.page);
@@ -24297,7 +24317,7 @@ function usePageMapper() {
24297
24317
  },
24298
24318
  [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
24299
24319
  );
24300
- useEffect45(() => {
24320
+ useEffect44(() => {
24301
24321
  if (page === null) return closeDialog();
24302
24322
  const pageItem = PAGE_MAP[page];
24303
24323
  if (!pageItem) {
@@ -24321,7 +24341,7 @@ var init_usePageMapper = __esm({
24321
24341
 
24322
24342
  // src/internal/hooks/useSettingsNotifications.ts
24323
24343
  import { useQuery as useQuery24 } from "@tanstack/react-query";
24324
- import { useEffect as useEffect46 } from "react";
24344
+ import { useEffect as useEffect45 } from "react";
24325
24345
  function useSettingsNotifications() {
24326
24346
  const address = useSession((st) => st.address);
24327
24347
  const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
@@ -24333,14 +24353,14 @@ function useSettingsNotifications() {
24333
24353
  queryKey: [QUERY_KEYS.userProfile, address],
24334
24354
  queryFn: getUserProfile
24335
24355
  });
24336
- useEffect46(() => {
24356
+ useEffect45(() => {
24337
24357
  const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
24338
24358
  setSettingsNotifications({
24339
24359
  ...COMPLETE_KYC_PROGRESS,
24340
24360
  status: isKYCVerified ? "resolved" : "active"
24341
24361
  });
24342
24362
  }, [userProfile, setSettingsNotifications]);
24343
- useEffect46(() => {
24363
+ useEffect45(() => {
24344
24364
  setSettingsNotifications({
24345
24365
  ...EMAIL_NOT_CONNECTED_NOTIFICATION,
24346
24366
  status: hasEmail ? "resolved" : "active"
@@ -24373,7 +24393,7 @@ var init_package = __esm({
24373
24393
  "package.json"() {
24374
24394
  package_default = {
24375
24395
  name: "@embarkai/ui-kit",
24376
- version: "0.4.47",
24396
+ version: "0.4.49",
24377
24397
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
24378
24398
  type: "module",
24379
24399
  main: "./dist/index.cjs",
@@ -24473,7 +24493,7 @@ var init_package = __esm({
24473
24493
  // src/internal/components/Footer/Footer.tsx
24474
24494
  import { useMutation as useMutation20, useQueryClient as useQueryClient26 } from "@tanstack/react-query";
24475
24495
  import { Loader as Loader33, LogOut } from "lucide-react";
24476
- import { useDisconnect as useDisconnect2 } from "wagmi";
24496
+ import { useDisconnect as useDisconnect3 } from "wagmi";
24477
24497
  import { jsx as jsx116, jsxs as jsxs105 } from "react/jsx-runtime";
24478
24498
  function Footer() {
24479
24499
  const qc = useQueryClient26();
@@ -24481,8 +24501,7 @@ function Footer() {
24481
24501
  const { t } = useT();
24482
24502
  const address = useSession((st) => st.address);
24483
24503
  const chainConfig = useSession((st) => st.chainConfig);
24484
- const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
24485
- const { disconnect: wagmiDisconnect } = useDisconnect2({
24504
+ const { disconnect: wagmiDisconnect } = useDisconnect3({
24486
24505
  mutation: {
24487
24506
  onSuccess: () => {
24488
24507
  useExternalWalletStore.getState().clearExternalWallet();
@@ -24509,7 +24528,7 @@ function Footer() {
24509
24528
  },
24510
24529
  onSuccess: async ({ disconnectAddress, disconnectedUserId }) => {
24511
24530
  await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
24512
- if (!!directWalletAddress) wagmiDisconnect();
24531
+ if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
24513
24532
  const { setError, setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
24514
24533
  setSession(null);
24515
24534
  setAddress(null);
@@ -24608,7 +24627,7 @@ var init_Footer2 = __esm({
24608
24627
  // src/internal/components/Header/Header.tsx
24609
24628
  import { useQuery as useQuery25 } from "@tanstack/react-query";
24610
24629
  import { Copy as Copy5, Loader as Loader34 } from "lucide-react";
24611
- import { useCallback as useCallback31, useRef as useRef20, useState as useState32 } from "react";
24630
+ import { useCallback as useCallback31, useRef as useRef19, useState as useState32 } from "react";
24612
24631
  import { Fragment as Fragment44, jsx as jsx117, jsxs as jsxs106 } from "react/jsx-runtime";
24613
24632
  function formatAddress2(addr) {
24614
24633
  if (!addr) return "";
@@ -24622,8 +24641,8 @@ function Header() {
24622
24641
  const proMode = useProMode();
24623
24642
  const [proToast, setProToast] = useState32(false);
24624
24643
  const [copied, setCopied] = useState32(false);
24625
- const clickCountRef = useRef20(0);
24626
- const clickTimerRef = useRef20(null);
24644
+ const clickCountRef = useRef19(0);
24645
+ const clickTimerRef = useRef19(null);
24627
24646
  const handleAvatarClick = useCallback31(() => {
24628
24647
  clickCountRef.current += 1;
24629
24648
  if (clickTimerRef.current) {
@@ -24926,7 +24945,7 @@ var init_visually_hidden = __esm({
24926
24945
 
24927
24946
  // src/internal/components/Dialog/Dialog.tsx
24928
24947
  import { AnimatePresence, motion } from "framer-motion";
24929
- import { useEffect as useEffect47 } from "react";
24948
+ import { useEffect as useEffect46 } from "react";
24930
24949
  import { jsx as jsx120, jsxs as jsxs108 } from "react/jsx-runtime";
24931
24950
  function Dialog2() {
24932
24951
  const config = useProviderConfig().config;
@@ -24938,7 +24957,7 @@ function Dialog2() {
24938
24957
  const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
24939
24958
  const setPage = useLayoutDataStore((st) => st.setPage);
24940
24959
  const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
24941
- useEffect47(() => setIsSettings(!!session), [session, setIsSettings]);
24960
+ useEffect46(() => setIsSettings(!!session), [session, setIsSettings]);
24942
24961
  usePageMapper();
24943
24962
  useAutoConnect();
24944
24963
  useBackupStatusChanges();
@@ -25060,15 +25079,15 @@ var init_TssManager = __esm({
25060
25079
  // src/internal/components/WalletConnectHandler.tsx
25061
25080
  import { useConnectModal as useConnectModal2 } from "@rainbow-me/rainbowkit";
25062
25081
  import { useMutation as useMutation21, useQueryClient as useQueryClient27 } from "@tanstack/react-query";
25063
- import React9, { useCallback as useCallback33, useEffect as useEffect48 } from "react";
25064
- import { useAccount, useDisconnect as useDisconnect3, useSignMessage as useSignMessage2 } from "wagmi";
25082
+ import React9, { useCallback as useCallback33, useEffect as useEffect47 } from "react";
25083
+ import { useAccount, useDisconnect as useDisconnect4, useSignMessage as useSignMessage2 } from "wagmi";
25065
25084
  function WalletConnectHandler() {
25066
25085
  const qc = useQueryClient27();
25067
25086
  const { callbacksRef } = useProviderConfig();
25068
25087
  const passportWalletAddress = useSession((st) => st.address);
25069
25088
  const { address: walletAddress, isConnected, chain, connector } = useAccount();
25070
25089
  const { openConnectModal, connectModalOpen } = useConnectModal2();
25071
- const { disconnect } = useDisconnect3();
25090
+ const { disconnect } = useDisconnect4();
25072
25091
  const { signMessageAsync } = useSignMessage2();
25073
25092
  const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
25074
25093
  const setPage = useLayoutDataStore((st) => st.setPage);
@@ -25115,7 +25134,7 @@ function WalletConnectHandler() {
25115
25134
  const [hasStartedLinking, setHasStartedLinking] = React9.useState(false);
25116
25135
  const [modalWasOpened, setModalWasOpened] = React9.useState(false);
25117
25136
  const [pendingModalOpen, setPendingModalOpen] = React9.useState(false);
25118
- useEffect48(() => {
25137
+ useEffect47(() => {
25119
25138
  if (isWalletLinking && !hasStartedLinking) {
25120
25139
  console.log("[WalletConnectHandler] Starting wallet link flow:", {
25121
25140
  isConnected,
@@ -25153,18 +25172,18 @@ function WalletConnectHandler() {
25153
25172
  setProviderType,
25154
25173
  walletMode
25155
25174
  ]);
25156
- useEffect48(() => {
25175
+ useEffect47(() => {
25157
25176
  if (pendingModalOpen && !isConnected && openConnectModal) {
25158
25177
  setPendingModalOpen(false);
25159
25178
  openConnectModal();
25160
25179
  }
25161
25180
  }, [pendingModalOpen, isConnected, openConnectModal]);
25162
- useEffect48(() => {
25181
+ useEffect47(() => {
25163
25182
  if (connectModalOpen && hasStartedLinking) {
25164
25183
  setModalWasOpened(true);
25165
25184
  }
25166
25185
  }, [connectModalOpen, hasStartedLinking]);
25167
- useEffect48(() => {
25186
+ useEffect47(() => {
25168
25187
  if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
25169
25188
  console.log("[WalletConnectHandler] Modal closed without connecting");
25170
25189
  onLinkingComplete(false);
@@ -25172,7 +25191,7 @@ function WalletConnectHandler() {
25172
25191
  setModalWasOpened(false);
25173
25192
  }
25174
25193
  }, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
25175
- useEffect48(() => {
25194
+ useEffect47(() => {
25176
25195
  if (isWalletLinking) {
25177
25196
  const timeout = setTimeout(() => {
25178
25197
  console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
@@ -25292,7 +25311,7 @@ function WalletConnectHandler() {
25292
25311
  setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
25293
25312
  }
25294
25313
  });
25295
- useEffect48(() => {
25314
+ useEffect47(() => {
25296
25315
  if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
25297
25316
  console.log("[WalletConnectHandler] handleWalletSign triggered");
25298
25317
  if (!passportWalletAddress) {
@@ -25302,7 +25321,7 @@ function WalletConnectHandler() {
25302
25321
  handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
25303
25322
  }
25304
25323
  }, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
25305
- useEffect48(() => {
25324
+ useEffect47(() => {
25306
25325
  if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
25307
25326
  const timeout = setTimeout(() => {
25308
25327
  console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
@@ -25338,7 +25357,7 @@ var init_WalletConnectHandler = __esm({
25338
25357
  });
25339
25358
 
25340
25359
  // src/internal/components/DirectWalletHandler.tsx
25341
- import { useEffect as useEffect49 } from "react";
25360
+ import { useEffect as useEffect48 } from "react";
25342
25361
  import { useAccount as useAccount2 } from "wagmi";
25343
25362
  function DirectWalletHandler() {
25344
25363
  const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
@@ -25350,13 +25369,13 @@ function DirectWalletHandler() {
25350
25369
  const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
25351
25370
  const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
25352
25371
  const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
25353
- useEffect49(() => {
25372
+ useEffect48(() => {
25354
25373
  setConfigMode(walletMode);
25355
25374
  if (walletMode !== "both") {
25356
25375
  setActiveMode(walletMode);
25357
25376
  }
25358
25377
  }, [walletMode, setConfigMode, setActiveMode]);
25359
- useEffect49(() => {
25378
+ useEffect48(() => {
25360
25379
  if (isConnected && address && !isExternalConnected && connector && chain?.id) {
25361
25380
  setExternalWallet({
25362
25381
  address,
@@ -25365,17 +25384,17 @@ function DirectWalletHandler() {
25365
25384
  });
25366
25385
  }
25367
25386
  }, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
25368
- useEffect49(() => {
25387
+ useEffect48(() => {
25369
25388
  if (isExternalConnected && !isConnected) {
25370
25389
  clearExternalWallet();
25371
25390
  }
25372
25391
  }, [isConnected, isExternalConnected, clearExternalWallet]);
25373
- useEffect49(() => {
25392
+ useEffect48(() => {
25374
25393
  if (isExternalConnected && isConnected && chain?.id) {
25375
25394
  setExternalChainId(chain.id);
25376
25395
  }
25377
25396
  }, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
25378
- useEffect49(() => {
25397
+ useEffect48(() => {
25379
25398
  if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
25380
25399
  setExternalWallet({
25381
25400
  address,
@@ -28204,9 +28223,9 @@ import {
28204
28223
  createContext,
28205
28224
  useCallback as useCallback34,
28206
28225
  useContext,
28207
- useEffect as useEffect50,
28226
+ useEffect as useEffect49,
28208
28227
  useMemo as useMemo16,
28209
- useRef as useRef21
28228
+ useRef as useRef20
28210
28229
  } from "react";
28211
28230
  import { jsx as jsx124 } from "react/jsx-runtime";
28212
28231
  function clearLegacyWagmiStorage() {
@@ -28226,9 +28245,9 @@ function clearLegacyWagmiStorage() {
28226
28245
  }
28227
28246
  function Provider(props) {
28228
28247
  const { children, projectId, initialConfig = {}, callbacks } = props;
28229
- const callbacksRef = useRef21(callbacks);
28230
- useEffect50(() => notifyNoProjetctId(projectId), [projectId]);
28231
- const config = useRef21(merge3({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
28248
+ const callbacksRef = useRef20(callbacks);
28249
+ useEffect49(() => notifyNoProjetctId(projectId), [projectId]);
28250
+ const config = useRef20(merge3({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
28232
28251
  const updateConfig = useCallback34((updates) => {
28233
28252
  const prev = config.current;
28234
28253
  const next = { ...prev };
@@ -28268,7 +28287,7 @@ function Provider(props) {
28268
28287
  const next = updates ? { ...prev, ...updates } : void 0;
28269
28288
  callbacksRef.current = next;
28270
28289
  }, []);
28271
- useEffect50(() => {
28290
+ useEffect49(() => {
28272
28291
  if (typeof window === "undefined" || !projectId) return;
28273
28292
  const mergedConfig = merge3(DEFAULT_PROVIDER_CONFIG, initialConfig);
28274
28293
  updateConfig(mergedConfig);
@@ -28288,7 +28307,7 @@ function Provider(props) {
28288
28307
  useSession.getState().setActiveChainId(mergedConfig.network.chainId);
28289
28308
  }
28290
28309
  }, [projectId, initialConfig]);
28291
- useEffect50(() => {
28310
+ useEffect49(() => {
28292
28311
  if (typeof window === "undefined" || !projectId) return;
28293
28312
  try {
28294
28313
  initSdkErrorTracking();
@@ -28470,7 +28489,7 @@ init_pro_mode();
28470
28489
  init_utils2();
28471
28490
  import { useQuery as useQuery26 } from "@tanstack/react-query";
28472
28491
  import { Cloud as Cloud4, Laptop as Laptop2, Loader as Loader35, Shield as Shield3 } from "lucide-react";
28473
- import { useEffect as useEffect51, useMemo as useMemo17 } from "react";
28492
+ import { useEffect as useEffect50, useMemo as useMemo17 } from "react";
28474
28493
  import { Fragment as Fragment47, jsx as jsx126, jsxs as jsxs111 } from "react/jsx-runtime";
28475
28494
  function getFormattedStatus(label, status, showStatus) {
28476
28495
  const isStatus = showStatus && status && status !== "idle" && status !== "ready";
@@ -28490,7 +28509,7 @@ function ConnectWalletButton(props) {
28490
28509
  const colorMode = useLayoutStore((st) => st.colorMode);
28491
28510
  const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
28492
28511
  const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
28493
- useEffect51(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
28512
+ useEffect50(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
28494
28513
  const { data: profile, isLoading: isProfileLoading } = useQuery26({
28495
28514
  retry: false,
28496
28515
  enabled: !!address,
@@ -29162,13 +29181,13 @@ var Hash = ({
29162
29181
 
29163
29182
  // src/internal/components/TransactionsMenu/TransactionsList.tsx
29164
29183
  init_base();
29165
- import { useEffect as useEffect53, useState as useState36 } from "react";
29184
+ import { useEffect as useEffect52, useState as useState36 } from "react";
29166
29185
  import { jsx as jsx132, jsxs as jsxs115 } from "react/jsx-runtime";
29167
29186
  var TransactionsList = ({ address, itemsCount = 10 }) => {
29168
29187
  const [transactions, setTransactions] = useState36([]);
29169
29188
  const [loading, setLoading] = useState36(true);
29170
29189
  const [error, setError] = useState36(null);
29171
- useEffect53(() => {
29190
+ useEffect52(() => {
29172
29191
  const fetchTransactions2 = async () => {
29173
29192
  try {
29174
29193
  setLoading(true);
@@ -29485,14 +29504,14 @@ init_useExternalWalletStore();
29485
29504
  init_useLayoutDataStore();
29486
29505
  import { useCallback as useCallback39 } from "react";
29487
29506
  import { useConnectModal as useConnectModal3 } from "@rainbow-me/rainbowkit";
29488
- import { useDisconnect as useDisconnect4 } from "wagmi";
29507
+ import { useDisconnect as useDisconnect5 } from "wagmi";
29489
29508
  function useDirectWallet() {
29490
29509
  const address = useExternalWalletStore((st) => st.externalAddress);
29491
29510
  const chainId = useExternalWalletStore((st) => st.externalChainId);
29492
29511
  const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
29493
29512
  const connectorName = useExternalWalletStore((st) => st.connectorName);
29494
29513
  const clearExternalWallet = useExternalWalletStore((st) => st.clearExternalWallet);
29495
- const { disconnect: wagmiDisconnect } = useDisconnect4();
29514
+ const { disconnect: wagmiDisconnect } = useDisconnect5();
29496
29515
  const { openConnectModal } = useConnectModal3();
29497
29516
  const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
29498
29517
  const connect = useCallback39(() => {
@@ -29677,11 +29696,11 @@ init_SessionContext();
29677
29696
  init_useExternalWalletStore();
29678
29697
  import { logout as coreLogout, jwtTokenManager as jwtTokenManager3 } from "@embarkai/core/auth";
29679
29698
  import { useCallback as useCallback42 } from "react";
29680
- import { useDisconnect as useDisconnect5 } from "wagmi";
29699
+ import { useDisconnect as useDisconnect6 } from "wagmi";
29681
29700
  function useLogout() {
29682
29701
  const { callbacksRef } = useProviderConfig();
29683
29702
  const address = useSession((st) => st.address);
29684
- const { disconnect: wagmiDisconnect } = useDisconnect5({
29703
+ const { disconnect: wagmiDisconnect } = useDisconnect6({
29685
29704
  mutation: {
29686
29705
  onSuccess: () => {
29687
29706
  useExternalWalletStore.getState().clearExternalWallet();