@riligar/auth-react 1.32.0 → 1.34.0

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.esm.js CHANGED
@@ -366,35 +366,27 @@ const useAuthStore = create((set, get) => ({
366
366
  },
367
367
  /* Init ao montar o Provider */
368
368
  init: async () => {
369
- const {
370
- fetchApplicationInfo
371
- } = get();
372
369
  try {
373
- // Buscar application info primeiro (não bloqueia o init)
374
- // Apenas se não estiver em modo interno (dashboard)
375
- if (!isInternal()) {
376
- fetchApplicationInfo();
370
+ // Busca a sessão (que agora também traz applicationInfo)
371
+ const sessionData = await getSession();
372
+
373
+ // Se veio aplicação no redirecionamento/sessão, salva no store
374
+ if (sessionData?.application) {
375
+ set({
376
+ applicationInfo: sessionData.application
377
+ });
377
378
  }
378
379
  let user = null;
379
-
380
- // PRIMEIRO: Tenta buscar sessão do servidor (funciona com cookies)
381
- // Isso é essencial para Better Auth que usa session cookies
382
- try {
383
- const sessionData = await getSession();
384
- if (sessionData?.user) {
385
- user = sessionData.user;
386
- }
387
- if (sessionData?.session) {
388
- set({
389
- currentSession: sessionData.session
390
- });
391
- }
392
- } catch (sessionError) {
393
- // Se falhar (401), continua para verificar localStorage token
394
- console.log('[AuthStore] Server session not found, checking local token');
380
+ if (sessionData?.user) {
381
+ user = sessionData.user;
382
+ }
383
+ if (sessionData?.session) {
384
+ set({
385
+ currentSession: sessionData.session
386
+ });
395
387
  }
396
388
 
397
- // SEGUNDO: Se não encontrou sessão via cookies, verifica localStorage token (JWT)
389
+ // Se não encontrou sessão via cookies, verifica localStorage token (JWT)
398
390
  if (!user && isAuthenticated()) {
399
391
  user = getCurrentUser();
400
392
  }
@@ -1080,7 +1072,7 @@ function AuthCard({
1080
1072
  title,
1081
1073
  subtitle,
1082
1074
  logo,
1083
- logoHeight = 33,
1075
+ logoWidth = 133,
1084
1076
  width = 350,
1085
1077
  // Variant props
1086
1078
  variant = 'card',
@@ -1097,7 +1089,8 @@ function AuthCard({
1097
1089
  children: [logo && /*#__PURE__*/jsx(Image, {
1098
1090
  src: logo,
1099
1091
  alt: "Auth",
1100
- h: logoHeight,
1092
+ mx: "auto",
1093
+ w: logoWidth,
1101
1094
  fit: "contain"
1102
1095
  }), title && /*#__PURE__*/jsx(Title, {
1103
1096
  order: 3,
@@ -1125,7 +1118,7 @@ function AuthCard({
1125
1118
  title: logo ? /*#__PURE__*/jsx(Image, {
1126
1119
  src: logo,
1127
1120
  alt: "Auth",
1128
- h: logoHeight,
1121
+ h: logoWidth,
1129
1122
  fit: "contain"
1130
1123
  }) : title ? /*#__PURE__*/jsx(Title, {
1131
1124
  order: 4,
@@ -1161,7 +1154,7 @@ function SignIn({
1161
1154
  // Configuração
1162
1155
  logo,
1163
1156
  // Removido default, será calculado abaixo
1164
- logoHeight = 33,
1157
+ logoWidth = 133,
1165
1158
  title = 'Entrar',
1166
1159
  subtitle = 'Acesse sua conta para continuar',
1167
1160
  // Variant
@@ -1241,7 +1234,7 @@ function SignIn({
1241
1234
  const isLoading = loadingSignIn || loadingMagicLink || loadingResetPassword;
1242
1235
  return /*#__PURE__*/jsxs(AuthCard, {
1243
1236
  logo: finalLogo,
1244
- logoHeight: logoHeight,
1237
+ logoWidth: logoWidth,
1245
1238
  title: title,
1246
1239
  subtitle: subtitle,
1247
1240
  variant: variant,
@@ -1341,7 +1334,7 @@ function SignIn({
1341
1334
  function SignUp({
1342
1335
  // Configuração
1343
1336
  logo,
1344
- logoHeight = 33,
1337
+ logoWidth = 133,
1345
1338
  title = 'Criar Conta',
1346
1339
  subtitle = 'Preencha os dados para se cadastrar',
1347
1340
  // Variant
@@ -1393,7 +1386,7 @@ function SignUp({
1393
1386
  };
1394
1387
  return /*#__PURE__*/jsxs(AuthCard, {
1395
1388
  logo: finalLogo,
1396
- logoHeight: logoHeight,
1389
+ logoWidth: logoWidth,
1397
1390
  title: title,
1398
1391
  subtitle: subtitle,
1399
1392
  variant: variant,