@forge-connect/react 1.0.1 → 1.0.2

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.d.cts CHANGED
@@ -320,6 +320,7 @@ declare function createApiClient(apiUrl: string): {
320
320
  password?: string;
321
321
  challengeId?: string;
322
322
  signature?: string;
323
+ signedTransaction?: string;
323
324
  walletAddress?: string;
324
325
  }): Promise<{
325
326
  success: true;
@@ -648,7 +649,7 @@ declare function useWallets(): {
648
649
  label?: string;
649
650
  isPrimary?: boolean;
650
651
  }) => Promise<void>;
651
- linkWallet: (walletAddress: string, signMessage: (message: Uint8Array) => Promise<Uint8Array>, chain?: string) => Promise<void>;
652
+ linkWallet: (walletAddress: string, signMessage: ((message: Uint8Array) => Promise<Uint8Array>) | undefined, chain?: string, signTransaction?: (txBase64: string) => Promise<string>) => Promise<void>;
652
653
  };
653
654
 
654
655
  declare function useSessions(): {
package/dist/index.d.ts CHANGED
@@ -320,6 +320,7 @@ declare function createApiClient(apiUrl: string): {
320
320
  password?: string;
321
321
  challengeId?: string;
322
322
  signature?: string;
323
+ signedTransaction?: string;
323
324
  walletAddress?: string;
324
325
  }): Promise<{
325
326
  success: true;
@@ -648,7 +649,7 @@ declare function useWallets(): {
648
649
  label?: string;
649
650
  isPrimary?: boolean;
650
651
  }) => Promise<void>;
651
- linkWallet: (walletAddress: string, signMessage: (message: Uint8Array) => Promise<Uint8Array>, chain?: string) => Promise<void>;
652
+ linkWallet: (walletAddress: string, signMessage: ((message: Uint8Array) => Promise<Uint8Array>) | undefined, chain?: string, signTransaction?: (txBase64: string) => Promise<string>) => Promise<void>;
652
653
  };
653
654
 
654
655
  declare function useSessions(): {
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/provider.tsx
2
- import { useState as useState16, useCallback as useCallback8, useEffect as useEffect12, useRef as useRef8, useMemo as useMemo3 } from "react";
2
+ import { useState as useState16, useCallback as useCallback9, useEffect as useEffect12, useRef as useRef9, useMemo as useMemo3 } from "react";
3
3
 
4
4
  // src/context.ts
5
5
  import { createContext } from "react";
@@ -1233,7 +1233,7 @@ async function startAuthentication(options) {
1233
1233
  }
1234
1234
 
1235
1235
  // src/runtime-imports.ts
1236
- var importSolanaWeb3 = () => new Function('return import("@solana/web3.js")')();
1236
+ var importSolanaWeb3 = () => import("@solana/web3.js");
1237
1237
 
1238
1238
  // src/components/tabs/wallet-connect.tsx
1239
1239
  import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
@@ -2144,19 +2144,33 @@ function useWallets() {
2144
2144
  [api, getAccessToken, fetchWallets]
2145
2145
  );
2146
2146
  const linkWallet = useCallback4(
2147
- async (walletAddress, signMessage, chain = "solana") => {
2147
+ async (walletAddress, signMessage, chain = "solana", signTransaction) => {
2148
2148
  const token = getAccessToken();
2149
2149
  if (!token) throw new Error("Please sign in to continue.");
2150
- const { challengeId, message: challengeMessage } = await api.walletChallenge(walletAddress, chain);
2151
- const encoded = new TextEncoder().encode(challengeMessage);
2152
- const signatureBytes = await signMessage(encoded);
2153
- const signature = chain === "solana" ? uint8ArrayToBase58(signatureBytes) : Array.from(signatureBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
2154
- await api.linkAuthMethod(token, {
2155
- provider: `${chain}_wallet`,
2156
- challengeId,
2157
- signature,
2158
- walletAddress
2159
- });
2150
+ if (signMessage) {
2151
+ const { challengeId, message: challengeMessage } = await api.walletChallenge(walletAddress, chain);
2152
+ const encoded = new TextEncoder().encode(challengeMessage);
2153
+ const signatureBytes = await signMessage(encoded);
2154
+ const signature = chain === "solana" ? uint8ArrayToBase58(signatureBytes) : Array.from(signatureBytes).map((b) => b.toString(16).padStart(2, "0")).join("");
2155
+ await api.linkAuthMethod(token, {
2156
+ provider: `${chain}_wallet`,
2157
+ challengeId,
2158
+ signature,
2159
+ walletAddress
2160
+ });
2161
+ } else {
2162
+ if (!signTransaction) {
2163
+ throw new Error("Wallet does not support message signing or transaction signing.");
2164
+ }
2165
+ const { challengeId, transaction: txBase64 } = await api.walletChallengeTx(walletAddress, chain);
2166
+ const signedTxBase64 = await signTransaction(txBase64);
2167
+ await api.linkAuthMethod(token, {
2168
+ provider: `${chain}_wallet_tx`,
2169
+ challengeId,
2170
+ signedTransaction: signedTxBase64,
2171
+ walletAddress
2172
+ });
2173
+ }
2160
2174
  await fetchWallets();
2161
2175
  },
2162
2176
  [api, getAccessToken, fetchWallets]
@@ -3264,7 +3278,7 @@ function SecurityTab() {
3264
3278
  }
3265
3279
 
3266
3280
  // src/components/link-auth-modal.tsx
3267
- import { useState as useState15, useEffect as useEffect11, useMemo as useMemo2 } from "react";
3281
+ import { useState as useState15, useEffect as useEffect11, useMemo as useMemo2, useRef as useRef8, useCallback as useCallback8 } from "react";
3268
3282
  import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
3269
3283
  function LinkAuthModal() {
3270
3284
  const { linkModal, closeLinkModal, config } = useForgeConnect();
@@ -3548,10 +3562,23 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3548
3562
  const [loading, setLoading] = useState15(false);
3549
3563
  const [error, setError] = useState15("");
3550
3564
  const [showOther, setShowOther] = useState15(false);
3565
+ const [coldWallet, setColdWallet] = useState15(false);
3551
3566
  const mobile = useMemo2(() => isMobile(), []);
3552
3567
  const walletConfig = config.walletConfig;
3553
3568
  const preferred = walletConfig?.preferredWallets ?? [];
3554
3569
  const onlyPreferred = walletConfig?.onlyPreferred ?? false;
3570
+ const coldWalletRef = useRef8(coldWallet);
3571
+ coldWalletRef.current = coldWallet;
3572
+ const buildSignTxFnForAdapter = useCallback8((adapter) => {
3573
+ if (!adapter.signTransaction) return void 0;
3574
+ return async (txBase64) => {
3575
+ const { Transaction } = await importSolanaWeb3();
3576
+ const bytes = Uint8Array.from(atob(txBase64), (c) => c.charCodeAt(0));
3577
+ const tx = Transaction.from(bytes);
3578
+ const signedTx = await adapter.signTransaction(tx);
3579
+ return btoa(String.fromCharCode(...new Uint8Array(signedTx.serialize())));
3580
+ };
3581
+ }, []);
3555
3582
  const handleConnect = async (w) => {
3556
3583
  if (w.readyState !== "Installed") {
3557
3584
  if (mobile) {
@@ -3571,9 +3598,14 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3571
3598
  if (!w.adapter.connected) await w.adapter.connect();
3572
3599
  const pk = w.adapter.publicKey;
3573
3600
  if (!pk) throw new Error("Wallet did not provide a public key.");
3601
+ const useCold = coldWalletRef.current;
3574
3602
  const adapterSignMessage = w.adapter.signMessage ? (msg) => w.adapter.signMessage(msg) : void 0;
3575
- if (!adapterSignMessage) throw new Error("This wallet does not support message signing.");
3576
- await linkWallet(pk.toBase58(), adapterSignMessage, "solana");
3603
+ await linkWallet(
3604
+ pk.toBase58(),
3605
+ useCold ? void 0 : adapterSignMessage,
3606
+ "solana",
3607
+ useCold ? buildSignTxFnForAdapter(w.adapter) : void 0
3608
+ );
3577
3609
  onSuccess();
3578
3610
  } catch (err) {
3579
3611
  onFatalError(err instanceof Error ? err.message : "Could not link this wallet. Please try again.");
@@ -3630,7 +3662,7 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3630
3662
  return /* @__PURE__ */ jsxs15("div", { className: "fc-tab", children: [
3631
3663
  loading ? /* @__PURE__ */ jsxs15("div", { style: { textAlign: "center", padding: "24px 0" }, children: [
3632
3664
  /* @__PURE__ */ jsx16("p", { className: "fc-tab-title", children: "Connecting..." }),
3633
- /* @__PURE__ */ jsx16("p", { className: "fc-text", children: "Approve the connection, then sign the verification request in your wallet" }),
3665
+ /* @__PURE__ */ jsx16("p", { className: "fc-text", children: coldWallet ? "Confirm the transaction on your device" : "Approve the connection, then sign the verification request in your wallet" }),
3634
3666
  error && /* @__PURE__ */ jsxs15(Fragment6, { children: [
3635
3667
  /* @__PURE__ */ jsx16("p", { className: "fc-error", children: error }),
3636
3668
  /* @__PURE__ */ jsx16(
@@ -3688,6 +3720,21 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3688
3720
  ] }, w.adapter.name))
3689
3721
  ] }),
3690
3722
  preferredWallets.length === 0 && otherWallets.length === 0 && mobileExtraWallets.length === 0 && /* @__PURE__ */ jsx16("p", { className: "fc-text", children: "No wallet found. Please install a Solana wallet (like Phantom) to continue." }),
3723
+ /* @__PURE__ */ jsxs15("label", { className: "fc-cold-wallet-toggle", children: [
3724
+ /* @__PURE__ */ jsx16(
3725
+ "input",
3726
+ {
3727
+ type: "checkbox",
3728
+ checked: coldWallet,
3729
+ onChange: (e) => setColdWallet(e.target.checked)
3730
+ }
3731
+ ),
3732
+ /* @__PURE__ */ jsx16("span", { className: "fc-toggle-track" }),
3733
+ /* @__PURE__ */ jsxs15("span", { className: "fc-cold-wallet-label", children: [
3734
+ /* @__PURE__ */ jsx16("span", { children: "Hardware wallet" }),
3735
+ /* @__PURE__ */ jsx16("span", { children: "Ledger, Trezor, Keystone..." })
3736
+ ] })
3737
+ ] }),
3691
3738
  error && /* @__PURE__ */ jsx16("p", { className: "fc-error", children: error })
3692
3739
  ] }),
3693
3740
  !loading && onBack && /* @__PURE__ */ jsx16("div", { className: "fc-switch", children: /* @__PURE__ */ jsx16("button", { type: "button", className: "fc-link", onClick: onBack, children: "Back" }) })
@@ -3718,10 +3765,10 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3718
3765
  const [accountModal, setAccountModal] = useState16({ isOpen: false });
3719
3766
  const [linkModal, setLinkModal] = useState16({ isOpen: false });
3720
3767
  const [challengeToken, setChallengeToken] = useState16(null);
3721
- const apiRef = useRef8(createApiClient(config.apiUrl));
3722
- const refreshTimerRef = useRef8(null);
3768
+ const apiRef = useRef9(createApiClient(config.apiUrl));
3769
+ const refreshTimerRef = useRef9(null);
3723
3770
  const api = apiRef.current;
3724
- const scheduleRefresh = useCallback8((token) => {
3771
+ const scheduleRefresh = useCallback9((token) => {
3725
3772
  if (refreshTimerRef.current) clearTimeout(refreshTimerRef.current);
3726
3773
  const delay = getRefreshDelay(token);
3727
3774
  if (delay === null) return;
@@ -3810,7 +3857,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3810
3857
  }
3811
3858
  }
3812
3859
  }, []);
3813
- const handleAuthSuccess = useCallback8(
3860
+ const handleAuthSuccess = useCallback9(
3814
3861
  async (token) => {
3815
3862
  const user = await api.getMe(token);
3816
3863
  setAuth({ status: "authenticated", user, accessToken: token });
@@ -3823,7 +3870,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3823
3870
  },
3824
3871
  [api, scheduleRefresh, onLogin]
3825
3872
  );
3826
- const loginWithEmail = useCallback8(
3873
+ const loginWithEmail = useCallback9(
3827
3874
  async (email, password) => {
3828
3875
  const res = await api.login(email, password);
3829
3876
  if (res.requires2FA) {
@@ -3835,19 +3882,19 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3835
3882
  },
3836
3883
  [api, handleAuthSuccess]
3837
3884
  );
3838
- const register = useCallback8(
3885
+ const register = useCallback9(
3839
3886
  async (email, password, displayName) => {
3840
3887
  await api.register(email, password, displayName);
3841
3888
  },
3842
3889
  [api]
3843
3890
  );
3844
- const sendOtp = useCallback8(
3891
+ const sendOtp = useCallback9(
3845
3892
  async (email) => {
3846
3893
  await api.sendOtp(email);
3847
3894
  },
3848
3895
  [api]
3849
3896
  );
3850
- const verifyOtp = useCallback8(
3897
+ const verifyOtp = useCallback9(
3851
3898
  async (email, code) => {
3852
3899
  const res = await api.verifyOtp(email, code);
3853
3900
  if (res.requires2FA) {
@@ -3859,7 +3906,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3859
3906
  },
3860
3907
  [api, handleAuthSuccess]
3861
3908
  );
3862
- const loginWithWallet = useCallback8(
3909
+ const loginWithWallet = useCallback9(
3863
3910
  async (walletAddress, signMessage, chain = "solana", signTransaction) => {
3864
3911
  if (signMessage) {
3865
3912
  const { challengeId: challengeId2, message: challengeMessage } = await api.walletChallenge(walletAddress, chain);
@@ -3890,7 +3937,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3890
3937
  },
3891
3938
  [api, handleAuthSuccess]
3892
3939
  );
3893
- const loginWithOAuth = useCallback8(
3940
+ const loginWithOAuth = useCallback9(
3894
3941
  (provider) => {
3895
3942
  const callbackUrl = `${config.apiUrl}/auth/oauth/${provider}`;
3896
3943
  const redirectUri = encodeURIComponent(window.location.origin + "/fc-oauth-callback");
@@ -3912,7 +3959,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3912
3959
  },
3913
3960
  [config.apiUrl]
3914
3961
  );
3915
- const logout = useCallback8(async () => {
3962
+ const logout = useCallback9(async () => {
3916
3963
  const token = auth.accessToken;
3917
3964
  if (refreshTimerRef.current) clearTimeout(refreshTimerRef.current);
3918
3965
  setAuth({ status: "unauthenticated", user: null, accessToken: null });
@@ -3924,19 +3971,19 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3924
3971
  }
3925
3972
  }
3926
3973
  }, [auth.accessToken, api, onLogout]);
3927
- const forgotPassword = useCallback8(
3974
+ const forgotPassword = useCallback9(
3928
3975
  async (email) => {
3929
3976
  await api.forgotPassword(email);
3930
3977
  },
3931
3978
  [api]
3932
3979
  );
3933
- const resetPassword = useCallback8(
3980
+ const resetPassword = useCallback9(
3934
3981
  async (token, password) => {
3935
3982
  await api.resetPassword(token, password);
3936
3983
  },
3937
3984
  [api]
3938
3985
  );
3939
- const verifyEmailToken = useCallback8(
3986
+ const verifyEmailToken = useCallback9(
3940
3987
  async (token) => {
3941
3988
  const res = await api.verifyEmailToken(token);
3942
3989
  if (res.requires2FA) {
@@ -3948,25 +3995,25 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3948
3995
  },
3949
3996
  [api, handleAuthSuccess]
3950
3997
  );
3951
- const loginWithPasskey = useCallback8(async () => {
3998
+ const loginWithPasskey = useCallback9(async () => {
3952
3999
  const { options, challengeKey } = await api.getPasskeyLoginOptions(config.webauthnRpId);
3953
4000
  const authResponse = await startAuthentication({ optionsJSON: options });
3954
4001
  const { accessToken } = await api.verifyPasskeyLogin(challengeKey, authResponse, config.webauthnRpId, config.webauthnOrigin);
3955
4002
  await handleAuthSuccess(accessToken);
3956
4003
  }, [api, handleAuthSuccess, config.webauthnRpId, config.webauthnOrigin]);
3957
- const verify2FA = useCallback8(async (code) => {
4004
+ const verify2FA = useCallback9(async (code) => {
3958
4005
  if (!challengeToken) throw new Error("No 2FA challenge active");
3959
4006
  const { accessToken } = await api.verify2FA(challengeToken, code);
3960
4007
  setChallengeToken(null);
3961
4008
  await handleAuthSuccess(accessToken);
3962
4009
  }, [api, challengeToken, handleAuthSuccess]);
3963
- const verifyRecoveryCode = useCallback8(async (code) => {
4010
+ const verifyRecoveryCode = useCallback9(async (code) => {
3964
4011
  if (!challengeToken) throw new Error("No 2FA challenge active");
3965
4012
  const { accessToken } = await api.verifyRecoveryCode(challengeToken, code);
3966
4013
  setChallengeToken(null);
3967
4014
  await handleAuthSuccess(accessToken);
3968
4015
  }, [api, challengeToken, handleAuthSuccess]);
3969
- const logoutAll = useCallback8(async () => {
4016
+ const logoutAll = useCallback9(async () => {
3970
4017
  const token = auth.accessToken;
3971
4018
  if (refreshTimerRef.current) clearTimeout(refreshTimerRef.current);
3972
4019
  setAuth({ status: "unauthenticated", user: null, accessToken: null });
@@ -3978,7 +4025,7 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3978
4025
  }
3979
4026
  }
3980
4027
  }, [auth.accessToken, api, onLogout]);
3981
- const openModal = useCallback8(() => {
4028
+ const openModal = useCallback9(() => {
3982
4029
  const methods = resolveLoginMethods(config);
3983
4030
  if (methods.length === 1 && isOAuthMethod(methods[0])) {
3984
4031
  loginWithOAuth(methods[0]);
@@ -3991,25 +4038,25 @@ function ForgeConnectProvider({ config, children, onLogin, onLogout, walletAdapt
3991
4038
  const step = resolveInitialStep(config, methods);
3992
4039
  setModal({ isOpen: true, step });
3993
4040
  }, [config, loginWithOAuth]);
3994
- const closeModal = useCallback8(() => {
4041
+ const closeModal = useCallback9(() => {
3995
4042
  setModal({ isOpen: false, step: "method-select" });
3996
4043
  }, []);
3997
- const setModalStep = useCallback8((step) => {
4044
+ const setModalStep = useCallback9((step) => {
3998
4045
  setModal((prev) => ({ ...prev, step }));
3999
4046
  }, []);
4000
- const openAccountModal = useCallback8(() => {
4047
+ const openAccountModal = useCallback9(() => {
4001
4048
  setAccountModal({ isOpen: true });
4002
4049
  }, []);
4003
- const closeAccountModal = useCallback8(() => {
4050
+ const closeAccountModal = useCallback9(() => {
4004
4051
  setAccountModal({ isOpen: false });
4005
4052
  }, []);
4006
- const openLinkModal = useCallback8((mode) => {
4053
+ const openLinkModal = useCallback9((mode) => {
4007
4054
  setLinkModal({ isOpen: true, mode: mode ?? "auth" });
4008
4055
  }, []);
4009
- const closeLinkModal = useCallback8(() => {
4056
+ const closeLinkModal = useCallback9(() => {
4010
4057
  setLinkModal({ isOpen: false });
4011
4058
  }, []);
4012
- const getAccessToken = useCallback8(() => auth.accessToken, [auth.accessToken]);
4059
+ const getAccessToken = useCallback9(() => auth.accessToken, [auth.accessToken]);
4013
4060
  const value = useMemo3(() => ({
4014
4061
  auth,
4015
4062
  modal,
@@ -4113,14 +4160,14 @@ function AccountButton({ className, loginLabel, compact }) {
4113
4160
  }
4114
4161
 
4115
4162
  // src/hooks/use-admin.ts
4116
- import { useState as useState17, useCallback as useCallback9 } from "react";
4163
+ import { useState as useState17, useCallback as useCallback10 } from "react";
4117
4164
  function useAdmin() {
4118
4165
  const { api, getAccessToken } = useForgeConnect();
4119
4166
  const [users, setUsers] = useState17(null);
4120
4167
  const [selectedUser, setSelectedUser] = useState17(null);
4121
4168
  const [userSessions, setUserSessions] = useState17(null);
4122
4169
  const [loading, setLoading] = useState17(false);
4123
- const listUsers = useCallback9(
4170
+ const listUsers = useCallback10(
4124
4171
  async (params) => {
4125
4172
  const token = getAccessToken();
4126
4173
  if (!token) throw new Error("Please sign in to continue.");
@@ -4135,7 +4182,7 @@ function useAdmin() {
4135
4182
  },
4136
4183
  [api, getAccessToken]
4137
4184
  );
4138
- const getUser = useCallback9(
4185
+ const getUser = useCallback10(
4139
4186
  async (id) => {
4140
4187
  const token = getAccessToken();
4141
4188
  if (!token) throw new Error("Please sign in to continue.");
@@ -4150,7 +4197,7 @@ function useAdmin() {
4150
4197
  },
4151
4198
  [api, getAccessToken]
4152
4199
  );
4153
- const updateUserStatus = useCallback9(
4200
+ const updateUserStatus = useCallback10(
4154
4201
  async (id, status) => {
4155
4202
  const token = getAccessToken();
4156
4203
  if (!token) throw new Error("Please sign in to continue.");
@@ -4161,7 +4208,7 @@ function useAdmin() {
4161
4208
  },
4162
4209
  [api, getAccessToken, selectedUser?.id, getUser]
4163
4210
  );
4164
- const getUserSessions = useCallback9(
4211
+ const getUserSessions = useCallback10(
4165
4212
  async (id) => {
4166
4213
  const token = getAccessToken();
4167
4214
  if (!token) throw new Error("Please sign in to continue.");
@@ -4176,7 +4223,7 @@ function useAdmin() {
4176
4223
  },
4177
4224
  [api, getAccessToken]
4178
4225
  );
4179
- const revokeUserSessions = useCallback9(
4226
+ const revokeUserSessions = useCallback10(
4180
4227
  async (id) => {
4181
4228
  const token = getAccessToken();
4182
4229
  if (!token) throw new Error("Please sign in to continue.");
@@ -4199,7 +4246,7 @@ function useAdmin() {
4199
4246
  }
4200
4247
 
4201
4248
  // src/hooks/use-roles.ts
4202
- import { useState as useState18, useCallback as useCallback10 } from "react";
4249
+ import { useState as useState18, useCallback as useCallback11 } from "react";
4203
4250
  function useRoles() {
4204
4251
  const { api, getAccessToken } = useForgeConnect();
4205
4252
  const [roles, setRoles] = useState18(null);
@@ -4208,7 +4255,7 @@ function useRoles() {
4208
4255
  const [roleUsers, setRoleUsers] = useState18(null);
4209
4256
  const [permissionDomains, setPermissionDomains] = useState18(null);
4210
4257
  const [loading, setLoading] = useState18(false);
4211
- const listRoles = useCallback10(
4258
+ const listRoles = useCallback11(
4212
4259
  async (tenantId) => {
4213
4260
  const token = getAccessToken();
4214
4261
  if (!token) throw new Error("Please sign in to continue.");
@@ -4223,7 +4270,7 @@ function useRoles() {
4223
4270
  },
4224
4271
  [api, getAccessToken]
4225
4272
  );
4226
- const getRoleUsers = useCallback10(
4273
+ const getRoleUsers = useCallback11(
4227
4274
  async (id) => {
4228
4275
  const token = getAccessToken();
4229
4276
  if (!token) throw new Error("Please sign in to continue.");
@@ -4233,7 +4280,7 @@ function useRoles() {
4233
4280
  },
4234
4281
  [api, getAccessToken]
4235
4282
  );
4236
- const getRole = useCallback10(
4283
+ const getRole = useCallback11(
4237
4284
  async (id) => {
4238
4285
  const token = getAccessToken();
4239
4286
  if (!token) throw new Error("Please sign in to continue.");
@@ -4250,7 +4297,7 @@ function useRoles() {
4250
4297
  },
4251
4298
  [api, getAccessToken, getRoleUsers]
4252
4299
  );
4253
- const createRole = useCallback10(
4300
+ const createRole = useCallback11(
4254
4301
  async (data) => {
4255
4302
  const token = getAccessToken();
4256
4303
  if (!token) throw new Error("Please sign in to continue.");
@@ -4260,7 +4307,7 @@ function useRoles() {
4260
4307
  },
4261
4308
  [api, getAccessToken, listRoles]
4262
4309
  );
4263
- const updateRole = useCallback10(
4310
+ const updateRole = useCallback11(
4264
4311
  async (id, data) => {
4265
4312
  const token = getAccessToken();
4266
4313
  if (!token) throw new Error("Please sign in to continue.");
@@ -4270,7 +4317,7 @@ function useRoles() {
4270
4317
  },
4271
4318
  [api, getAccessToken]
4272
4319
  );
4273
- const deleteRole = useCallback10(
4320
+ const deleteRole = useCallback11(
4274
4321
  async (id) => {
4275
4322
  const token = getAccessToken();
4276
4323
  if (!token) throw new Error("Please sign in to continue.");
@@ -4279,7 +4326,7 @@ function useRoles() {
4279
4326
  },
4280
4327
  [api, getAccessToken, selectedRole?.id]
4281
4328
  );
4282
- const getPermissions = useCallback10(
4329
+ const getPermissions = useCallback11(
4283
4330
  async () => {
4284
4331
  const token = getAccessToken();
4285
4332
  if (!token) throw new Error("Please sign in to continue.");
@@ -4289,7 +4336,7 @@ function useRoles() {
4289
4336
  },
4290
4337
  [api, getAccessToken]
4291
4338
  );
4292
- const getUserRoles = useCallback10(
4339
+ const getUserRoles = useCallback11(
4293
4340
  async (userId, tenantId) => {
4294
4341
  const token = getAccessToken();
4295
4342
  if (!token) throw new Error("Please sign in to continue.");
@@ -4304,7 +4351,7 @@ function useRoles() {
4304
4351
  },
4305
4352
  [api, getAccessToken]
4306
4353
  );
4307
- const assignRole = useCallback10(
4354
+ const assignRole = useCallback11(
4308
4355
  async (userId, roleId, tenantId) => {
4309
4356
  const token = getAccessToken();
4310
4357
  if (!token) throw new Error("Please sign in to continue.");
@@ -4312,7 +4359,7 @@ function useRoles() {
4312
4359
  },
4313
4360
  [api, getAccessToken]
4314
4361
  );
4315
- const revokeRole = useCallback10(
4362
+ const revokeRole = useCallback11(
4316
4363
  async (userId, roleId, tenantId) => {
4317
4364
  const token = getAccessToken();
4318
4365
  if (!token) throw new Error("Please sign in to continue.");