@embarkai/ui-kit 0.2.1 → 0.2.3

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.
@@ -15,7 +15,7 @@
15
15
  <meta http-equiv="X-Content-Type-Options" content="nosniff" />
16
16
  <meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
17
17
 
18
- <title>EmbarkAI Secure Wallet - iframe version 0.2.1</title>
18
+ <title>EmbarkAI Secure Wallet - iframe version 0.2.3</title>
19
19
 
20
20
  <!-- Styles will be injected by build process -->
21
21
  <style>
@@ -4399,7 +4399,7 @@ var SigningManager = class extends TokenRefreshApiClient {
4399
4399
  };
4400
4400
 
4401
4401
  // src/iframe/main.ts
4402
- var IFRAME_VERSION = "0.2.1";
4402
+ var IFRAME_VERSION = "0.2.3";
4403
4403
  var IframeWallet = class {
4404
4404
  constructor() {
4405
4405
  console.log("=".repeat(60));
package/dist/index.cjs CHANGED
@@ -843,27 +843,27 @@ var init_useLayoutDataStore = __esm({
843
843
  "src/internal/hooks/useLayoutDataStore.ts"() {
844
844
  import_zustand = require("zustand");
845
845
  init_constants();
846
- PageKey = /* @__PURE__ */ ((PageKey4) => {
847
- PageKey4["AUTH"] = "auth";
848
- PageKey4["LANGUAGES"] = "languages";
849
- PageKey4["TERMS_OF_SERVICE"] = "terms-of-service";
850
- PageKey4["MAIN_MENU"] = "main-menu";
851
- PageKey4["SETTINGS"] = "settings";
852
- PageKey4["SEND"] = "send";
853
- PageKey4["RECEIVE"] = "receive";
854
- PageKey4["BUY"] = "buy";
855
- PageKey4["KYC"] = "kyc";
856
- PageKey4["TRANSACTIONS"] = "transactions";
857
- PageKey4["ASSETS"] = "assets";
858
- PageKey4["MANAGE_WALLET"] = "manage-wallet";
859
- PageKey4["UNLINK_PROVIDER"] = "unlink-provider";
860
- PageKey4["SECURITY"] = "security";
861
- PageKey4["KEYSARE_BACKUP"] = "keysare-backup";
862
- PageKey4["KEYSHARE_RESTORE"] = "keyshare-restore";
863
- PageKey4["CHAIN"] = "chain";
864
- PageKey4["CHAIN_SWITCH_REQUEST"] = "chain-switch-request";
865
- PageKey4["NICKNAME_SETTINGS"] = "nickname-settings";
866
- return PageKey4;
846
+ PageKey = /* @__PURE__ */ ((PageKey3) => {
847
+ PageKey3["AUTH"] = "auth";
848
+ PageKey3["LANGUAGES"] = "languages";
849
+ PageKey3["TERMS_OF_SERVICE"] = "terms-of-service";
850
+ PageKey3["MAIN_MENU"] = "main-menu";
851
+ PageKey3["SETTINGS"] = "settings";
852
+ PageKey3["SEND"] = "send";
853
+ PageKey3["RECEIVE"] = "receive";
854
+ PageKey3["BUY"] = "buy";
855
+ PageKey3["KYC"] = "kyc";
856
+ PageKey3["TRANSACTIONS"] = "transactions";
857
+ PageKey3["ASSETS"] = "assets";
858
+ PageKey3["MANAGE_WALLET"] = "manage-wallet";
859
+ PageKey3["UNLINK_PROVIDER"] = "unlink-provider";
860
+ PageKey3["SECURITY"] = "security";
861
+ PageKey3["KEYSARE_BACKUP"] = "keysare-backup";
862
+ PageKey3["KEYSHARE_RESTORE"] = "keyshare-restore";
863
+ PageKey3["CHAIN"] = "chain";
864
+ PageKey3["CHAIN_SWITCH_REQUEST"] = "chain-switch-request";
865
+ PageKey3["NICKNAME_SETTINGS"] = "nickname-settings";
866
+ return PageKey3;
867
867
  })(PageKey || {});
868
868
  useLayoutDataStore = (0, import_zustand.create)((set) => ({
869
869
  page: null,
@@ -1151,7 +1151,7 @@ var init_helpers = __esm({
1151
1151
 
1152
1152
  // src/internal/components/ChainSync/ChainSync.tsx
1153
1153
  function ChainSync() {
1154
- const { config, callbacks } = useProviderConfig();
1154
+ const { config, callbacksRef } = useProviderConfig();
1155
1155
  const qc = (0, import_react_query2.useQueryClient)();
1156
1156
  const setPage = useLayoutDataStore((st) => st.setPage);
1157
1157
  const { address, session, activeChainId, setAddress, setSession, setActiveChain, setIsLoading, setStatus, setError } = useSession();
@@ -1216,7 +1216,7 @@ function ChainSync() {
1216
1216
  address: smartAccountAddress,
1217
1217
  factoryAddress: chainConfig.factoryAddress
1218
1218
  });
1219
- await callbacks?.onChainChange?.({
1219
+ await callbacksRef.current?.onChainChange?.({
1220
1220
  chainId: targetChainId,
1221
1221
  previousChainId: prevChainId.current
1222
1222
  });
@@ -2401,7 +2401,7 @@ var init_clients = __esm({
2401
2401
  function useAutoConnect() {
2402
2402
  const {
2403
2403
  config: { current: config },
2404
- callbacks
2404
+ callbacksRef
2405
2405
  } = useProviderConfig();
2406
2406
  const setPage = useLayoutDataStore((st) => st.setPage);
2407
2407
  const {
@@ -2424,7 +2424,7 @@ function useAutoConnect() {
2424
2424
  async (userId, hasServerKeyshare, isNewUser) => {
2425
2425
  try {
2426
2426
  try {
2427
- callbacks?.onConnecting?.({ method: "wallet" });
2427
+ callbacksRef.current?.onConnecting?.({ method: "wallet" });
2428
2428
  } catch {
2429
2429
  }
2430
2430
  setStatus("checking key management setup...");
@@ -2456,7 +2456,7 @@ function useAutoConnect() {
2456
2456
  throw error;
2457
2457
  }
2458
2458
  },
2459
- [usePaymaster, setStatus, callbacks, activeChainId]
2459
+ [usePaymaster, setStatus, activeChainId]
2460
2460
  );
2461
2461
  const autoConnectAttemptedRef = (0, import_react3.useRef)(false);
2462
2462
  (0, import_react3.useEffect)(() => {
@@ -2508,7 +2508,7 @@ function useAutoConnect() {
2508
2508
  }
2509
2509
  const finalHasKeyshare = verify?.hasKeyshare ?? hasKeyshare ?? false;
2510
2510
  try {
2511
- callbacks?.onAccount?.({ userId, address: null, session: null, hasKeyshare: finalHasKeyshare });
2511
+ callbacksRef.current?.onAccount?.({ userId, address: null, session: null, hasKeyshare: finalHasKeyshare });
2512
2512
  } catch (error) {
2513
2513
  console.warn("[UI-KIT][AutoConnect] Error due onAccount callback:", error);
2514
2514
  }
@@ -2524,12 +2524,12 @@ function useAutoConnect() {
2524
2524
  setStatus("ready");
2525
2525
  setIsLoading(false);
2526
2526
  try {
2527
- callbacks?.onConnect?.({ address: addr, session: sess });
2527
+ callbacksRef.current?.onConnect?.({ address: addr, session: sess });
2528
2528
  } catch (error) {
2529
2529
  console.warn("[UI-KIT][AutoConnect] Error due onConnect callback:", error);
2530
2530
  }
2531
2531
  try {
2532
- callbacks?.onAccount?.({
2532
+ callbacksRef.current?.onAccount?.({
2533
2533
  userId,
2534
2534
  address: addr,
2535
2535
  session: sess,
@@ -3899,7 +3899,7 @@ function PassKeyStep(props) {
3899
3899
  const { pendingLoginResponseRef, onAuthSuccess } = props;
3900
3900
  const {
3901
3901
  config: { current: config },
3902
- callbacks
3902
+ callbacksRef
3903
3903
  } = useProviderConfig();
3904
3904
  const { t } = useT();
3905
3905
  const isLoading = useSession((st) => st.isLoading);
@@ -3955,7 +3955,7 @@ function PassKeyStep(props) {
3955
3955
  }
3956
3956
  if (!normalized.benignCancel) {
3957
3957
  try {
3958
- callbacks?.onError?.({
3958
+ callbacksRef.current?.onError?.({
3959
3959
  error: e instanceof Error ? e : new Error(errorMessage),
3960
3960
  message: errorMessage
3961
3961
  });
@@ -3966,7 +3966,7 @@ function PassKeyStep(props) {
3966
3966
  } finally {
3967
3967
  setIsLoading(false);
3968
3968
  }
3969
- }, [onAuthSuccess, setPage, callbacks]);
3969
+ }, [onAuthSuccess, setPage]);
3970
3970
  const onPasskeyAuth = (0, import_react10.useCallback)(async () => {
3971
3971
  setAlert(null);
3972
3972
  setPasskeyStatus("checking available passkeys...");
@@ -4035,7 +4035,7 @@ function PassKeyStep(props) {
4035
4035
  message: errorMessage
4036
4036
  });
4037
4037
  try {
4038
- callbacks?.onError?.({
4038
+ callbacksRef.current?.onError?.({
4039
4039
  error: e instanceof Error ? e : new Error(errorMessage),
4040
4040
  message: errorMessage
4041
4041
  });
@@ -4047,7 +4047,7 @@ function PassKeyStep(props) {
4047
4047
  } finally {
4048
4048
  setIsLoading(false);
4049
4049
  }
4050
- }, [onAuthSuccess, setPage, callbacks]);
4050
+ }, [onAuthSuccess, setPage]);
4051
4051
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
4052
4052
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative flex items-center justify-center gap-2 px-5 pt-3 pb-6", children: [
4053
4053
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react4.Key, { className: "w-6 h-6" }),
@@ -4160,7 +4160,7 @@ var init_input = __esm({
4160
4160
 
4161
4161
  // src/internal/components/AuthMenu/SignInStep/Email.tsx
4162
4162
  function Email() {
4163
- const { config, callbacks } = useProviderConfig();
4163
+ const { callbacksRef } = useProviderConfig();
4164
4164
  const { t } = useT();
4165
4165
  const focusRef = (0, import_react12.useRef)(null);
4166
4166
  const inputRef = (0, import_react12.useRef)(null);
@@ -4212,7 +4212,7 @@ function Email() {
4212
4212
  setIsLoading(false);
4213
4213
  },
4214
4214
  onError: (error) => {
4215
- callbacks?.onError?.({ error, message: error?.message || "" });
4215
+ callbacksRef.current?.onError?.({ error, message: error?.message || "" });
4216
4216
  setAlert({
4217
4217
  title: "Failed to send verification code",
4218
4218
  message: error?.message || "Unknown error occurred"
@@ -4435,7 +4435,7 @@ var init_utils4 = __esm({
4435
4435
  // src/internal/components/AuthMenu/SignInStep/Social.tsx
4436
4436
  function Social(props) {
4437
4437
  const { pendingLoginResponseRef, onAuthSuccess } = props;
4438
- const { config, callbacks } = useProviderConfig();
4438
+ const { config } = useProviderConfig();
4439
4439
  const { t } = useT();
4440
4440
  const isLoading = useSession((st) => st.isLoading);
4441
4441
  const setIsLoading = useSession((st) => st.setIsLoading);
@@ -4619,7 +4619,7 @@ function Social(props) {
4619
4619
  setIsLoading(false);
4620
4620
  }
4621
4621
  },
4622
- [onAuthSuccess, callbacks]
4622
+ [onAuthSuccess]
4623
4623
  );
4624
4624
  const enabledSocialProviders = config.current?.social?.providers?.filter((provider) => provider.enabled) || [];
4625
4625
  const isPasskey = !!config.current?.passkey?.enabled;
@@ -4935,7 +4935,7 @@ var init_constants4 = __esm({
4935
4935
 
4936
4936
  // src/internal/components/AuthMenu/useAuthMenuHanders.ts
4937
4937
  function useAuthMenuHandlers() {
4938
- const { config, callbacks } = useProviderConfig();
4938
+ const { config, callbacksRef } = useProviderConfig();
4939
4939
  const qc = (0, import_react_query5.useQueryClient)();
4940
4940
  const pendingLoginResponseRef = (0, import_react15.useRef)(null);
4941
4941
  const setPage = useLayoutDataStore((st) => st.setPage);
@@ -4959,7 +4959,7 @@ function useAuthMenuHandlers() {
4959
4959
  async (userId, hasServerKeyshare, isNewUser) => {
4960
4960
  try {
4961
4961
  try {
4962
- callbacks?.onConnecting?.({ method: "wallet" });
4962
+ callbacksRef.current?.onConnecting?.({ method: "wallet" });
4963
4963
  } catch {
4964
4964
  }
4965
4965
  setStatus("checking key management setup...");
@@ -4994,7 +4994,7 @@ function useAuthMenuHandlers() {
4994
4994
  throw error;
4995
4995
  }
4996
4996
  },
4997
- [setStatus, callbacks, usePaymaster, activeChainId]
4997
+ [setStatus, usePaymaster, activeChainId]
4998
4998
  );
4999
4999
  const onAuthSuccess = (0, import_react15.useCallback)(async () => {
5000
5000
  setIsLoading(true);
@@ -5047,12 +5047,12 @@ function useAuthMenuHandlers() {
5047
5047
  setAddress(addr);
5048
5048
  setStatus("ready");
5049
5049
  try {
5050
- callbacks?.onConnect?.({ address: addr, session: sess });
5050
+ callbacksRef.current?.onConnect?.({ address: addr, session: sess });
5051
5051
  } catch (error) {
5052
5052
  console.warn("[UI-KIT][AuthMenu] Error due onConnect callback:", error);
5053
5053
  }
5054
5054
  try {
5055
- callbacks?.onAccount?.({ userId, address: addr, session: sess, hasKeyshare: hasServerKeyshare });
5055
+ callbacksRef.current?.onAccount?.({ userId, address: addr, session: sess, hasKeyshare: hasServerKeyshare });
5056
5056
  } catch (error) {
5057
5057
  console.warn("[UI-KIT][AuthMenu] Error due onAccount callback:", error);
5058
5058
  }
@@ -5094,7 +5094,6 @@ function useAuthMenuHandlers() {
5094
5094
  }
5095
5095
  }, [
5096
5096
  qc,
5097
- callbacks,
5098
5097
  setStep,
5099
5098
  setPage,
5100
5099
  setError,
@@ -5293,7 +5292,7 @@ var init_VerificationCodeInput = __esm({
5293
5292
  // src/internal/components/AuthMenu/VerifyStep/VerifyStep.tsx
5294
5293
  function VerifyStep(props) {
5295
5294
  const { pendingLoginResponseRef, goBackToSignIn, onAuthSuccess } = props;
5296
- const { callbacks } = useProviderConfig();
5295
+ const { callbacksRef } = useProviderConfig();
5297
5296
  const { t } = useT();
5298
5297
  const recoveryUserId = useSession((st) => st.recoveryUserId);
5299
5298
  const isSessionLoading = useSession((st) => st.isLoading);
@@ -5366,7 +5365,7 @@ function VerifyStep(props) {
5366
5365
  title: "Verification failed",
5367
5366
  message: errorMessage
5368
5367
  });
5369
- callbacks?.onError?.({
5368
+ callbacksRef.current?.onError?.({
5370
5369
  error: error instanceof Error ? error : new Error(errorMessage),
5371
5370
  message: errorMessage
5372
5371
  });
@@ -7472,7 +7471,7 @@ var init_useRestoreStore = __esm({
7472
7471
 
7473
7472
  // src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts
7474
7473
  function useOnRestoreSuccess() {
7475
- const { config, callbacks } = useProviderConfig();
7474
+ const { config, callbacksRef } = useProviderConfig();
7476
7475
  const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
7477
7476
  const setPage = useLayoutDataStore((st) => st.setPage);
7478
7477
  const {
@@ -7490,7 +7489,7 @@ function useOnRestoreSuccess() {
7490
7489
  async (userId, hasServerKeyshare, isNewUser) => {
7491
7490
  try {
7492
7491
  try {
7493
- callbacks?.onConnecting?.({ method: "wallet" });
7492
+ callbacksRef.current?.onConnecting?.({ method: "wallet" });
7494
7493
  } catch {
7495
7494
  }
7496
7495
  setStatus("checking key management setup...");
@@ -7525,7 +7524,7 @@ function useOnRestoreSuccess() {
7525
7524
  throw error;
7526
7525
  }
7527
7526
  },
7528
- [setStatus, callbacks, usePaymaster, activeChainId, publicClient]
7527
+ [setStatus, usePaymaster, activeChainId, publicClient]
7529
7528
  );
7530
7529
  const onRestoreSuccess = (0, import_react25.useCallback)(async () => {
7531
7530
  const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
@@ -7556,12 +7555,12 @@ function useOnRestoreSuccess() {
7556
7555
  setAddress(addr);
7557
7556
  setStatus("ready");
7558
7557
  try {
7559
- callbacks?.onConnect?.({ address: addr, session: sess });
7558
+ callbacksRef.current?.onConnect?.({ address: addr, session: sess });
7560
7559
  } catch (error) {
7561
7560
  console.warn("[UI-KIT][Restore] Error due onConnect callback:", error);
7562
7561
  }
7563
7562
  try {
7564
- callbacks?.onAccount?.({
7563
+ callbacksRef.current?.onAccount?.({
7565
7564
  userId: recoveryUserId,
7566
7565
  address: addr,
7567
7566
  session: sess,
@@ -7588,8 +7587,7 @@ function useOnRestoreSuccess() {
7588
7587
  setAddress,
7589
7588
  setStatus,
7590
7589
  setRecoveryUserId,
7591
- setPage,
7592
- callbacks
7590
+ setPage
7593
7591
  ]);
7594
7592
  return { onRestoreSuccess };
7595
7593
  }
@@ -8970,7 +8968,7 @@ var init_KeyshareRestoreMenu = __esm({
8970
8968
  };
8971
8969
  KeyshareRestoreMenu = () => {
8972
8970
  const qc = (0, import_react_query14.useQueryClient)();
8973
- const callbacks = useProviderConfig().callbacks;
8971
+ const { callbacksRef } = useProviderConfig();
8974
8972
  const { t } = useT();
8975
8973
  const { address, setSession, setAddress, setStatus, setIsLoading } = useSession();
8976
8974
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
@@ -9036,7 +9034,7 @@ var init_KeyshareRestoreMenu = __esm({
9036
9034
  setStatus("idle");
9037
9035
  setIsLoading(false);
9038
9036
  setIsDialogForced(false);
9039
- callbacks?.onDisconnect?.({ address: "0x", userId: disconnectedUserId });
9037
+ callbacksRef.current?.onDisconnect?.({ address: "0x", userId: disconnectedUserId });
9040
9038
  setTimeout(() => setPage("auth" /* AUTH */), 50);
9041
9039
  },
9042
9040
  onError: (err) => {
@@ -9903,7 +9901,7 @@ var init_useStore = __esm({
9903
9901
 
9904
9902
  // src/internal/components/ManageWalletMenu/EmailForm.tsx
9905
9903
  function EmailForm() {
9906
- const { callbacks } = useProviderConfig();
9904
+ const { callbacksRef } = useProviderConfig();
9907
9905
  const { t } = useT();
9908
9906
  const isLoading = useSession((st) => st.isLoading);
9909
9907
  const setIsLoading = useSession((st) => st.setIsLoading);
@@ -9955,7 +9953,7 @@ function EmailForm() {
9955
9953
  message: errorMessage
9956
9954
  });
9957
9955
  try {
9958
- callbacks?.onError?.({
9956
+ callbacksRef.current?.onError?.({
9959
9957
  error: error instanceof Error ? error : new Error(errorMessage),
9960
9958
  message: errorMessage
9961
9959
  });
@@ -10080,7 +10078,7 @@ var init_useSendVerificationCode = __esm({
10080
10078
 
10081
10079
  // src/internal/components/ManageWalletMenu/hooks/useVerifyCode.ts
10082
10080
  function useVerifyCode() {
10083
- const { callbacks } = useProviderConfig();
10081
+ const { callbacksRef } = useProviderConfig();
10084
10082
  const qc = (0, import_react_query22.useQueryClient)();
10085
10083
  const address = useSession((st) => st.address);
10086
10084
  const setIsLoading = useSession((st) => st.setIsLoading);
@@ -10106,7 +10104,7 @@ function useVerifyCode() {
10106
10104
  setAlert(null);
10107
10105
  setEmailStep("input");
10108
10106
  try {
10109
- callbacks?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address]) });
10107
+ callbacksRef.current?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address]) });
10110
10108
  } catch {
10111
10109
  }
10112
10110
  setIsLoading(false);
@@ -10145,7 +10143,7 @@ function normalizePasskeyLinkError(msg) {
10145
10143
  }
10146
10144
  function AddProvider() {
10147
10145
  const qc = (0, import_react_query23.useQueryClient)();
10148
- const callbacks = useProviderConfig().callbacks;
10146
+ const { callbacksRef } = useProviderConfig();
10149
10147
  const address = useSession((st) => st.address);
10150
10148
  const { t } = useT();
10151
10149
  const {
@@ -10209,7 +10207,7 @@ function AddProvider() {
10209
10207
  await qc.invalidateQueries({ queryKey: [PROVIDERS_QUERY_KEY, address] });
10210
10208
  await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
10211
10209
  try {
10212
- callbacks?.onAccountUpdate?.({
10210
+ callbacksRef.current?.onAccountUpdate?.({
10213
10211
  providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address])
10214
10212
  });
10215
10213
  } catch {
@@ -10250,7 +10248,7 @@ function AddProvider() {
10250
10248
  await qc.invalidateQueries({ queryKey: [PROVIDERS_QUERY_KEY, address] });
10251
10249
  await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
10252
10250
  try {
10253
- callbacks?.onAccountUpdate?.({
10251
+ callbacksRef.current?.onAccountUpdate?.({
10254
10252
  providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address])
10255
10253
  });
10256
10254
  } catch {
@@ -10330,7 +10328,7 @@ function useLinkSocial() {
10330
10328
  const address = useSession((st) => st.address);
10331
10329
  const {
10332
10330
  config: { current: config },
10333
- callbacks
10331
+ callbacksRef
10334
10332
  } = useProviderConfig();
10335
10333
  const setPage = useLayoutDataStore((st) => st.setPage);
10336
10334
  const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
@@ -10377,7 +10375,7 @@ function useLinkSocial() {
10377
10375
  await qc.invalidateQueries({ queryKey: [PROVIDERS_QUERY_KEY, address] });
10378
10376
  await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
10379
10377
  try {
10380
- callbacks?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address]) });
10378
+ callbacksRef.current?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address]) });
10381
10379
  } catch {
10382
10380
  }
10383
10381
  setProviderType(null);
@@ -10391,7 +10389,7 @@ function useLinkSocial() {
10391
10389
  setLinkIsLoading(false);
10392
10390
  }
10393
10391
  },
10394
- [config.social?.providers, callbacks]
10392
+ [config.social?.providers]
10395
10393
  );
10396
10394
  const [socialLinkStarted, setSocialLinkStarted] = import_react38.default.useState(false);
10397
10395
  (0, import_react38.useEffect)(() => {
@@ -10482,7 +10480,7 @@ var init_telegram2 = __esm({
10482
10480
  function useLinkTelegram() {
10483
10481
  const {
10484
10482
  config: { current: config },
10485
- callbacks
10483
+ callbacksRef
10486
10484
  } = useProviderConfig();
10487
10485
  const qc = (0, import_react_query25.useQueryClient)();
10488
10486
  const address = useSession((st) => st.address);
@@ -10523,7 +10521,7 @@ function useLinkTelegram() {
10523
10521
  await qc.invalidateQueries({ queryKey: [PROVIDERS_QUERY_KEY, address] });
10524
10522
  await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
10525
10523
  try {
10526
- callbacks?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address]) });
10524
+ callbacksRef.current?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address]) });
10527
10525
  } catch {
10528
10526
  }
10529
10527
  setPage("manage-wallet" /* MANAGE_WALLET */);
@@ -10535,7 +10533,7 @@ function useLinkTelegram() {
10535
10533
  } finally {
10536
10534
  setLinkIsLoading(false);
10537
10535
  }
10538
- }, [config.social?.providers, callbacks]);
10536
+ }, [config.social?.providers]);
10539
10537
  const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react39.useState)(false);
10540
10538
  (0, import_react39.useEffect)(() => {
10541
10539
  console.log("[useLinkTelegram] Effect triggered:", {
@@ -10841,7 +10839,7 @@ var init_ManageWallet = __esm({
10841
10839
  function UnlinkProviderMenu() {
10842
10840
  const qc = (0, import_react_query26.useQueryClient)();
10843
10841
  const address = useSession((st) => st.address);
10844
- const { callbacks } = useProviderConfig();
10842
+ const { callbacksRef } = useProviderConfig();
10845
10843
  const { t } = useT();
10846
10844
  const setPage = useLayoutDataStore((st) => st.setPage);
10847
10845
  const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
@@ -10861,7 +10859,7 @@ function UnlinkProviderMenu() {
10861
10859
  await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address], refetchType: "active" });
10862
10860
  await qc.refetchQueries({ queryKey: [PROVIDERS_QUERY_KEY, address] });
10863
10861
  try {
10864
- callbacks?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address]) });
10862
+ callbacksRef.current?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address]) });
10865
10863
  } catch {
10866
10864
  }
10867
10865
  },
@@ -11086,7 +11084,7 @@ function NicknameEditForm(props) {
11086
11084
  const qc = (0, import_react_query27.useQueryClient)();
11087
11085
  const { t } = useT();
11088
11086
  const passportWalletAddress = useSession((st) => st.address);
11089
- const callbacks = useProviderConfig().callbacks;
11087
+ const { callbacksRef } = useProviderConfig();
11090
11088
  const [isNicknameCopied, setIsNicknameCopied] = (0, import_react42.useState)(false);
11091
11089
  const {
11092
11090
  mutate: changeNickname2,
@@ -11101,7 +11099,9 @@ function NicknameEditForm(props) {
11101
11099
  qc.invalidateQueries({ queryKey: [QUERY_KEYS.nicknameInfo] });
11102
11100
  qc.invalidateQueries({ queryKey: [QUERY_KEYS.userProfile] });
11103
11101
  try {
11104
- callbacks?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, passportWalletAddress]) });
11102
+ callbacksRef.current?.onAccountUpdate?.({
11103
+ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, passportWalletAddress])
11104
+ });
11105
11105
  } catch (err) {
11106
11106
  console.warn("[NicknameEditForm] Error due executing onAccountUpdate callback", err);
11107
11107
  }
@@ -15544,7 +15544,7 @@ var init_package = __esm({
15544
15544
  "package.json"() {
15545
15545
  package_default = {
15546
15546
  name: "@embarkai/ui-kit",
15547
- version: "0.2.1",
15547
+ version: "0.2.3",
15548
15548
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
15549
15549
  type: "module",
15550
15550
  main: "./dist/index.cjs",
@@ -15643,7 +15643,7 @@ var init_package = __esm({
15643
15643
  // src/internal/components/Footer/Footer.tsx
15644
15644
  function Footer() {
15645
15645
  const qc = (0, import_react_query39.useQueryClient)();
15646
- const { callbacks } = useProviderConfig();
15646
+ const { callbacksRef } = useProviderConfig();
15647
15647
  const { address, setSession, setAddress, setStatus, setError, setIsLoading } = useSession();
15648
15648
  const chainConfig = useSession((st) => st.chainConfig);
15649
15649
  const { t } = useT();
@@ -15668,7 +15668,7 @@ function Footer() {
15668
15668
  setError(null);
15669
15669
  setStatus("idle");
15670
15670
  setIsLoading(false);
15671
- callbacks?.onDisconnect?.({ address: disconnectAddress, userId: disconnectedUserId });
15671
+ callbacksRef.current?.onDisconnect?.({ address: disconnectAddress, userId: disconnectedUserId });
15672
15672
  setTimeout(() => {
15673
15673
  setPage("auth" /* AUTH */);
15674
15674
  setIsDialogForced(false);
@@ -16325,7 +16325,7 @@ var init_useExternalWalletStore = __esm({
16325
16325
  // src/internal/components/WalletConnectHandler.tsx
16326
16326
  function WalletConnectHandler() {
16327
16327
  const qc = (0, import_react_query41.useQueryClient)();
16328
- const callbacks = useProviderConfig().callbacks;
16328
+ const { callbacksRef } = useProviderConfig();
16329
16329
  const passportWalletAddress = useSession((st) => st.address);
16330
16330
  const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi2.useAccount)();
16331
16331
  const { openConnectModal, connectModalOpen } = (0, import_rainbowkit.useConnectModal)();
@@ -16363,11 +16363,13 @@ function WalletConnectHandler() {
16363
16363
  refetchType: "active"
16364
16364
  });
16365
16365
  try {
16366
- callbacks?.onAccountUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, passportWalletAddress]) });
16366
+ callbacksRef.current?.onAccountUpdate?.({
16367
+ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, passportWalletAddress])
16368
+ });
16367
16369
  } catch {
16368
16370
  }
16369
16371
  },
16370
- [qc, passportWalletAddress, callbacks, setProviderType, setPage, setIsWalletLinking]
16372
+ [qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
16371
16373
  );
16372
16374
  const [hasStartedLinking, setHasStartedLinking] = import_react63.default.useState(false);
16373
16375
  (0, import_react63.useEffect)(() => {
@@ -16407,7 +16409,16 @@ function WalletConnectHandler() {
16407
16409
  const shouldKeepConnected = walletMode === "direct" || walletMode === "both";
16408
16410
  if (isConnected && !shouldKeepConnected) disconnect();
16409
16411
  }
16410
- }, [isWalletLinking, hasStartedLinking, isConnected, openConnectModal, disconnect, setPage, setProviderType, walletMode]);
16412
+ }, [
16413
+ isWalletLinking,
16414
+ hasStartedLinking,
16415
+ isConnected,
16416
+ openConnectModal,
16417
+ disconnect,
16418
+ setPage,
16419
+ setProviderType,
16420
+ walletMode
16421
+ ]);
16411
16422
  (0, import_react63.useEffect)(() => {
16412
16423
  if (hasStartedLinking && !connectModalOpen && !isConnected && isWalletLinking) {
16413
16424
  console.log("[WalletConnectHandler] Modal closed without connecting");
@@ -16520,7 +16531,16 @@ function WalletConnectHandler() {
16520
16531
  }, 5e3);
16521
16532
  return () => clearTimeout(timeout);
16522
16533
  }
16523
- }, [isConnected, chain?.id, isWalletLinking, hasStartedLinking, connectModalOpen, isWalletSigning, onLinkingComplete, disconnect]);
16534
+ }, [
16535
+ isConnected,
16536
+ chain?.id,
16537
+ isWalletLinking,
16538
+ hasStartedLinking,
16539
+ connectModalOpen,
16540
+ isWalletSigning,
16541
+ onLinkingComplete,
16542
+ disconnect
16543
+ ]);
16524
16544
  return null;
16525
16545
  }
16526
16546
  var import_rainbowkit, import_react_query41, import_react63, import_wagmi2;
@@ -19396,7 +19416,14 @@ function Provider(props) {
19396
19416
  }
19397
19417
  }, [projectId]);
19398
19418
  const contextValue = (0, import_react67.useMemo)(
19399
- () => ({ config, updateConfig, callbacks, updateCallbacks }),
19419
+ () => ({
19420
+ config,
19421
+ updateConfig,
19422
+ /** @deprecated */
19423
+ callbacks,
19424
+ callbacksRef,
19425
+ updateCallbacks
19426
+ }),
19400
19427
  [config, updateConfig, callbacks, updateCallbacks]
19401
19428
  );
19402
19429
  if (!!initialConfig?.wallet?.enabled)
@@ -20768,7 +20795,7 @@ var init_useTransferToLinkedWallet = __esm({
20768
20795
  // src/hooks/useLogout.ts
20769
20796
  function useLogout() {
20770
20797
  const { setSession, setIsLoading, setAddress, setStatus, setError, address } = useSession();
20771
- const { callbacks } = useProviderConfig();
20798
+ const { callbacksRef } = useProviderConfig();
20772
20799
  const logout2 = (0, import_react75.useCallback)(async () => {
20773
20800
  const prevAddress = address;
20774
20801
  let userId = null;
@@ -20789,14 +20816,14 @@ function useLogout() {
20789
20816
  setError(null);
20790
20817
  setIsLoading(false);
20791
20818
  try {
20792
- callbacks?.onDisconnect?.({
20819
+ callbacksRef.current?.onDisconnect?.({
20793
20820
  address: prevAddress,
20794
20821
  userId
20795
20822
  });
20796
20823
  } catch (error) {
20797
20824
  console.warn("[useLogout] Callback error:", error);
20798
20825
  }
20799
- }, [address, setAddress, setError, setSession, setStatus, callbacks]);
20826
+ }, [address, setAddress, setError, setSession, setStatus]);
20800
20827
  return { logout: logout2 };
20801
20828
  }
20802
20829
  var import_auth20, import_react75;