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