academe-kit 0.7.5 → 0.7.7

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.cjs CHANGED
@@ -6307,7 +6307,7 @@ const SecurityProvider = ({ apiBaseUrl = "https://stg-api.academe.com.br", skipA
6307
6307
  setIsRefreshing(false);
6308
6308
  }, [getKeycloakUser, services, skipApiUserFetch]);
6309
6309
  // --- 5. Ações de Auth ---
6310
- const signOut = React2.useCallback(() => {
6310
+ const signOut = React2.useCallback(async () => {
6311
6311
  console.log("[KC LOGOUT!]");
6312
6312
  setCurrentUser(null);
6313
6313
  setAccessToken(undefined);
@@ -6321,10 +6321,18 @@ const SecurityProvider = ({ apiBaseUrl = "https://stg-api.academe.com.br", skipA
6321
6321
  sessionStorage.clear();
6322
6322
  localStorage.removeItem(`oidc.user:${auth.settings.authority}:${auth.settings.client_id}`);
6323
6323
  auth.removeUser();
6324
- auth.signoutRedirect({
6325
- id_token_hint: auth.user?.id_token,
6326
- });
6327
6324
  auth.clearStaleState();
6325
+ // Fazer logout silencioso no Keycloak e redirecionar para login
6326
+ try {
6327
+ await auth.signoutSilent({
6328
+ id_token_hint: auth.user?.id_token,
6329
+ });
6330
+ }
6331
+ catch (error) {
6332
+ console.debug("[KC LOGOUT] Silent signout failed, redirecting to login anyway:", error);
6333
+ }
6334
+ // Redirecionar para a tela de login
6335
+ auth.signinRedirect();
6328
6336
  }, [auth]);
6329
6337
  const hasSchool = React2.useCallback((schoolId) => {
6330
6338
  if (hasRealmRole(exports.GLOBAL_ROLES.ADMIN_ACADEME)) {
@@ -6338,7 +6346,7 @@ const SecurityProvider = ({ apiBaseUrl = "https://stg-api.academe.com.br", skipA
6338
6346
  }, []);
6339
6347
  // Memoizar o value do context para evitar re-renders desnecessários
6340
6348
  const contextValue = React2.useMemo(() => ({
6341
- isInitialized: !isLoading || isRefreshing,
6349
+ isInitialized: !isLoading || isRefreshing || !!accessToken,
6342
6350
  isTokenReady,
6343
6351
  user: currentUser,
6344
6352
  refreshUserData,