@nocios/crudify-ui 1.2.28 → 1.2.29
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/MIGRATION.md +201 -0
- package/dist/{CrudifyDataProvider-VQUGF4OL.mjs → CrudifyDataProvider-BLW4PCVZ.mjs} +1 -1
- package/dist/{chunk-UAYA54B3.mjs → chunk-LR5FXHGC.mjs} +43 -11
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +51 -12
- package/dist/index.mjs +12 -5
- package/package.json +1 -1
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Guía de Migración - useCrudifyUser v1.2.25+
|
|
2
|
+
|
|
3
|
+
## Cambios Importantes
|
|
4
|
+
|
|
5
|
+
A partir de la versión 1.2.25, el hook `useCrudifyUser` ha sido completamente reestructurado para ser más simple y claro.
|
|
6
|
+
|
|
7
|
+
## Antes (❌ Estructura Anterior)
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
const {
|
|
11
|
+
userEmail,
|
|
12
|
+
userId,
|
|
13
|
+
userIdentifier,
|
|
14
|
+
userProfile,
|
|
15
|
+
profileLoading,
|
|
16
|
+
profileError,
|
|
17
|
+
extendedData,
|
|
18
|
+
refreshProfile,
|
|
19
|
+
clearProfile
|
|
20
|
+
} = useCrudifyUser();
|
|
21
|
+
|
|
22
|
+
// Acceso a datos
|
|
23
|
+
console.log(extendedData.fullProfile);
|
|
24
|
+
console.log(extendedData.displayData);
|
|
25
|
+
console.log(extendedData.totalFields);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Ahora (✅ Nueva Estructura)
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
const {
|
|
32
|
+
user,
|
|
33
|
+
loading,
|
|
34
|
+
error,
|
|
35
|
+
refreshProfile,
|
|
36
|
+
clearProfile
|
|
37
|
+
} = useCrudifyUser();
|
|
38
|
+
|
|
39
|
+
// Acceso a datos
|
|
40
|
+
console.log(user.session); // Datos del JWT token
|
|
41
|
+
console.log(user.data); // Datos de la base de datos
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Estructura del objeto `user`
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
interface CrudifyUserData {
|
|
48
|
+
session: JWTPayload | null; // Datos del token JWT
|
|
49
|
+
data: UserProfile | null; // Datos de la base de datos
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `user.session` (Datos del JWT)
|
|
54
|
+
- `user.session.sub` - User ID
|
|
55
|
+
- `user.session.email` - Email del usuario
|
|
56
|
+
- `user.session.name` - Nombre del usuario
|
|
57
|
+
- `user.session.exp` - Timestamp de expiración
|
|
58
|
+
- `user.session.iat` - Timestamp de emisión
|
|
59
|
+
- Y todos los demás campos del JWT token
|
|
60
|
+
|
|
61
|
+
### `user.data` (Datos de la Base de Datos)
|
|
62
|
+
- `user.data.id` - ID del perfil en la BD
|
|
63
|
+
- `user.data.email` - Email del perfil
|
|
64
|
+
- `user.data.firstName` - Nombre
|
|
65
|
+
- `user.data.lastName` - Apellido
|
|
66
|
+
- `user.data.role` - Rol del usuario
|
|
67
|
+
- Y todos los demás campos del perfil de usuario
|
|
68
|
+
|
|
69
|
+
## Migraciones Necesarias
|
|
70
|
+
|
|
71
|
+
### 1. Cambiar las destructuraciones
|
|
72
|
+
```typescript
|
|
73
|
+
// ❌ Antes
|
|
74
|
+
const { userProfile, profileLoading, profileError } = useCrudifyUser();
|
|
75
|
+
|
|
76
|
+
// ✅ Ahora
|
|
77
|
+
const { user, loading, error } = useCrudifyUser();
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 2. Actualizar acceso a datos de sesión
|
|
81
|
+
```typescript
|
|
82
|
+
// ❌ Antes
|
|
83
|
+
const email = userEmail;
|
|
84
|
+
const userId = userId;
|
|
85
|
+
|
|
86
|
+
// ✅ Ahora
|
|
87
|
+
const email = user.session?.email;
|
|
88
|
+
const userId = user.session?.sub;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 3. Actualizar acceso a datos de perfil
|
|
92
|
+
```typescript
|
|
93
|
+
// ❌ Antes
|
|
94
|
+
const profileData = userProfile;
|
|
95
|
+
const fullName = extendedData.displayData.fullName;
|
|
96
|
+
|
|
97
|
+
// ✅ Ahora
|
|
98
|
+
const profileData = user.data;
|
|
99
|
+
const fullName = user.data?.fullName;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 4. Actualizar estados de carga y error
|
|
103
|
+
```typescript
|
|
104
|
+
// ❌ Antes
|
|
105
|
+
if (profileLoading) return <Loading />;
|
|
106
|
+
if (profileError) return <Error message={profileError} />;
|
|
107
|
+
|
|
108
|
+
// ✅ Ahora
|
|
109
|
+
if (loading) return <Loading />;
|
|
110
|
+
if (error) return <Error message={error} />;
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Beneficios de la Nueva Estructura
|
|
114
|
+
|
|
115
|
+
1. **Más Simple**: Solo un objeto `user` con `session` y `data`
|
|
116
|
+
2. **Más Claro**: Es obvio qué viene del JWT (`session`) y qué de la DB (`data`)
|
|
117
|
+
3. **Sin Duplicación**: La información no se repite en múltiples lugares
|
|
118
|
+
4. **Mejor TypeScript**: Tipos más precisos y claros
|
|
119
|
+
5. **Más Fácil de Usar**: Los desarrolladores entienden inmediatamente la estructura
|
|
120
|
+
|
|
121
|
+
## Ejemplo Completo de Migración
|
|
122
|
+
|
|
123
|
+
### Antes
|
|
124
|
+
```tsx
|
|
125
|
+
function UserProfile() {
|
|
126
|
+
const {
|
|
127
|
+
userEmail,
|
|
128
|
+
userProfile,
|
|
129
|
+
profileLoading,
|
|
130
|
+
profileError,
|
|
131
|
+
extendedData,
|
|
132
|
+
refreshProfile
|
|
133
|
+
} = useCrudifyUser();
|
|
134
|
+
|
|
135
|
+
if (profileLoading) return <div>Cargando...</div>;
|
|
136
|
+
if (profileError) return <div>Error: {profileError}</div>;
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<div>
|
|
140
|
+
<h1>Welcome {userProfile?.fullName || userEmail}</h1>
|
|
141
|
+
<p>Total fields: {extendedData.totalFields}</p>
|
|
142
|
+
<pre>{JSON.stringify(extendedData.displayData, null, 2)}</pre>
|
|
143
|
+
<button onClick={refreshProfile}>Refresh</button>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Después
|
|
150
|
+
```tsx
|
|
151
|
+
function UserProfile() {
|
|
152
|
+
const {
|
|
153
|
+
user,
|
|
154
|
+
loading,
|
|
155
|
+
error,
|
|
156
|
+
refreshProfile
|
|
157
|
+
} = useCrudifyUser();
|
|
158
|
+
|
|
159
|
+
if (loading) return <div>Cargando...</div>;
|
|
160
|
+
if (error) return <div>Error: {error}</div>;
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<div>
|
|
164
|
+
<h1>Welcome {user.data?.fullName || user.session?.email}</h1>
|
|
165
|
+
<h2>Datos de Sesión:</h2>
|
|
166
|
+
<pre>{JSON.stringify(user.session, null, 2)}</pre>
|
|
167
|
+
<h2>Datos de Perfil:</h2>
|
|
168
|
+
<pre>{JSON.stringify(user.data, null, 2)}</pre>
|
|
169
|
+
<button onClick={refreshProfile}>Refresh</button>
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Retrocompatibilidad
|
|
176
|
+
|
|
177
|
+
Para mantener compatibilidad temporal, puedes crear un wrapper:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
// wrapper temporal para compatibilidad
|
|
181
|
+
export const useLegacyUserProfile = () => {
|
|
182
|
+
const { user, loading, error, refreshProfile, clearProfile } = useCrudifyUser();
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
userEmail: user.session?.email || null,
|
|
186
|
+
userId: user.session?.sub || null,
|
|
187
|
+
userProfile: user.data,
|
|
188
|
+
profileLoading: loading,
|
|
189
|
+
profileError: error,
|
|
190
|
+
extendedData: {
|
|
191
|
+
fullProfile: user.data,
|
|
192
|
+
displayData: user.data,
|
|
193
|
+
totalFields: user.data ? Object.keys(user.data).length : 0
|
|
194
|
+
},
|
|
195
|
+
refreshProfile,
|
|
196
|
+
clearProfile
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Nota**: Este wrapper es solo para facilitar la migración. Se recomienda migrar completamente a la nueva estructura.
|
|
@@ -52,9 +52,30 @@ var _ConfigurationManager = class _ConfigurationManager {
|
|
|
52
52
|
colors: "default"
|
|
53
53
|
};
|
|
54
54
|
const env = this.resolveValue("env", propsConfig.env, envConfig.env, cookieConfig.env, "prod", configSource);
|
|
55
|
-
const publicApiKey = this.resolveValue(
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
const publicApiKey = this.resolveValue(
|
|
56
|
+
"publicApiKey",
|
|
57
|
+
propsConfig.publicApiKey,
|
|
58
|
+
envConfig.publicApiKey,
|
|
59
|
+
cookieConfig.publicApiKey,
|
|
60
|
+
void 0,
|
|
61
|
+
configSource
|
|
62
|
+
);
|
|
63
|
+
const loginActions = this.resolveValue(
|
|
64
|
+
"loginActions",
|
|
65
|
+
propsConfig.loginActions,
|
|
66
|
+
envConfig.loginActions,
|
|
67
|
+
cookieConfig.loginActions,
|
|
68
|
+
[],
|
|
69
|
+
configSource
|
|
70
|
+
);
|
|
71
|
+
const appName = this.resolveValue(
|
|
72
|
+
"appName",
|
|
73
|
+
propsConfig.appName,
|
|
74
|
+
envConfig.appName,
|
|
75
|
+
cookieConfig.appName,
|
|
76
|
+
"Crudify App",
|
|
77
|
+
configSource
|
|
78
|
+
);
|
|
58
79
|
const logo = this.resolveValue("logo", propsConfig.logo, envConfig.logo, cookieConfig.logo, "", configSource);
|
|
59
80
|
const colors = this.resolveValue("colors", propsConfig.colors, envConfig.colors, cookieConfig.colors, {}, configSource);
|
|
60
81
|
console.log("\u{1F50D} ConfigurationManager - Resolved values:");
|
|
@@ -652,7 +673,7 @@ var _TokenManager = class _TokenManager {
|
|
|
652
673
|
console.log("\u{1F510} TokenManager - Initialization complete");
|
|
653
674
|
}
|
|
654
675
|
/**
|
|
655
|
-
* Migrate tokens from localStorage to
|
|
676
|
+
* Migrate tokens from plain localStorage to encrypted localStorage
|
|
656
677
|
* This ensures compatibility with older implementations
|
|
657
678
|
*/
|
|
658
679
|
migrateFromLocalStorage() {
|
|
@@ -660,9 +681,9 @@ var _TokenManager = class _TokenManager {
|
|
|
660
681
|
const legacyKeys = ["authToken", "token", "jwt", "jwtToken"];
|
|
661
682
|
for (const key of legacyKeys) {
|
|
662
683
|
const token = localStorage.getItem(key);
|
|
663
|
-
if (token && !
|
|
684
|
+
if (token && !secureLocalStorage.getToken()) {
|
|
664
685
|
console.log(`\u{1F510} TokenManager - Migrating token from localStorage key: ${key}`);
|
|
665
|
-
|
|
686
|
+
secureLocalStorage.setToken(token);
|
|
666
687
|
localStorage.removeItem(key);
|
|
667
688
|
break;
|
|
668
689
|
}
|
|
@@ -677,8 +698,8 @@ var _TokenManager = class _TokenManager {
|
|
|
677
698
|
loadTokenFromStorage() {
|
|
678
699
|
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Entry point - loading token from storage");
|
|
679
700
|
try {
|
|
680
|
-
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Getting token from secure
|
|
681
|
-
const storedToken =
|
|
701
|
+
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Getting token from secure local storage");
|
|
702
|
+
const storedToken = secureLocalStorage.getToken();
|
|
682
703
|
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Stored token exists:", !!storedToken);
|
|
683
704
|
if (storedToken && this.isTokenValid(storedToken)) {
|
|
684
705
|
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Stored token is valid, updating cache");
|
|
@@ -741,7 +762,7 @@ var _TokenManager = class _TokenManager {
|
|
|
741
762
|
this.tokenCache = token;
|
|
742
763
|
this.parsedTokenCache = this.parseToken(token);
|
|
743
764
|
console.log("\u{1F510} TokenManager - SET_TOKEN: Storing token in secure storage");
|
|
744
|
-
|
|
765
|
+
secureLocalStorage.setToken(token);
|
|
745
766
|
console.log("\u{1F510} TokenManager - SET_TOKEN: Synchronizing with crudify");
|
|
746
767
|
this.syncTokenWithCrudify(token);
|
|
747
768
|
console.log("\u{1F510} TokenManager - SET_TOKEN: Token set and synchronized successfully");
|
|
@@ -843,7 +864,7 @@ var _TokenManager = class _TokenManager {
|
|
|
843
864
|
this.tokenCache = null;
|
|
844
865
|
this.parsedTokenCache = null;
|
|
845
866
|
console.log("\u{1F510} TokenManager - CLEAR_TOKEN: Clearing from secure storage");
|
|
846
|
-
|
|
867
|
+
secureLocalStorage.removeItem(this.TOKEN_KEY);
|
|
847
868
|
console.log("\u{1F510} TokenManager - CLEAR_TOKEN: Clearing from crudify");
|
|
848
869
|
crudify2.setToken("");
|
|
849
870
|
console.log("\u{1F510} TokenManager - CLEAR_TOKEN: Token cleared from all storages successfully");
|
|
@@ -1107,7 +1128,18 @@ var CrudifyDataProvider = ({
|
|
|
1107
1128
|
tokenManager: tokenManager.getDebugInfo(),
|
|
1108
1129
|
crudifyInitializer: crudifyInitializer.getStatus()
|
|
1109
1130
|
};
|
|
1110
|
-
}, [
|
|
1131
|
+
}, [
|
|
1132
|
+
isConfigured,
|
|
1133
|
+
configError,
|
|
1134
|
+
isInitialized,
|
|
1135
|
+
isInitializing,
|
|
1136
|
+
initializationError,
|
|
1137
|
+
isAuthenticated,
|
|
1138
|
+
config,
|
|
1139
|
+
token,
|
|
1140
|
+
user,
|
|
1141
|
+
tokenExpiration
|
|
1142
|
+
]);
|
|
1111
1143
|
useEffect(() => {
|
|
1112
1144
|
const resolvedConfig = initializeConfiguration();
|
|
1113
1145
|
updateAuthenticationState();
|
package/dist/index.d.mts
CHANGED
|
@@ -314,7 +314,7 @@ interface JWTPayload$1 extends JwtPayload {
|
|
|
314
314
|
* Key features:
|
|
315
315
|
* - Automatic storage <-> crudify synchronization
|
|
316
316
|
* - Token validation and expiration checking
|
|
317
|
-
* - Migration support from localStorage to
|
|
317
|
+
* - Migration support from plain localStorage to encrypted localStorage
|
|
318
318
|
* - Backward compatibility with existing token storage keys
|
|
319
319
|
* - Automatic cleanup of expired tokens
|
|
320
320
|
*/
|
|
@@ -339,7 +339,7 @@ declare class TokenManager {
|
|
|
339
339
|
*/
|
|
340
340
|
private initializeTokenManager;
|
|
341
341
|
/**
|
|
342
|
-
* Migrate tokens from localStorage to
|
|
342
|
+
* Migrate tokens from plain localStorage to encrypted localStorage
|
|
343
343
|
* This ensures compatibility with older implementations
|
|
344
344
|
*/
|
|
345
345
|
private migrateFromLocalStorage;
|
package/dist/index.d.ts
CHANGED
|
@@ -314,7 +314,7 @@ interface JWTPayload$1 extends JwtPayload {
|
|
|
314
314
|
* Key features:
|
|
315
315
|
* - Automatic storage <-> crudify synchronization
|
|
316
316
|
* - Token validation and expiration checking
|
|
317
|
-
* - Migration support from localStorage to
|
|
317
|
+
* - Migration support from plain localStorage to encrypted localStorage
|
|
318
318
|
* - Backward compatibility with existing token storage keys
|
|
319
319
|
* - Automatic cleanup of expired tokens
|
|
320
320
|
*/
|
|
@@ -339,7 +339,7 @@ declare class TokenManager {
|
|
|
339
339
|
*/
|
|
340
340
|
private initializeTokenManager;
|
|
341
341
|
/**
|
|
342
|
-
* Migrate tokens from localStorage to
|
|
342
|
+
* Migrate tokens from plain localStorage to encrypted localStorage
|
|
343
343
|
* This ensures compatibility with older implementations
|
|
344
344
|
*/
|
|
345
345
|
private migrateFromLocalStorage;
|
package/dist/index.js
CHANGED
|
@@ -209,9 +209,30 @@ var init_ConfigurationManager = __esm({
|
|
|
209
209
|
colors: "default"
|
|
210
210
|
};
|
|
211
211
|
const env = this.resolveValue("env", propsConfig.env, envConfig.env, cookieConfig.env, "prod", configSource);
|
|
212
|
-
const publicApiKey = this.resolveValue(
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
const publicApiKey = this.resolveValue(
|
|
213
|
+
"publicApiKey",
|
|
214
|
+
propsConfig.publicApiKey,
|
|
215
|
+
envConfig.publicApiKey,
|
|
216
|
+
cookieConfig.publicApiKey,
|
|
217
|
+
void 0,
|
|
218
|
+
configSource
|
|
219
|
+
);
|
|
220
|
+
const loginActions = this.resolveValue(
|
|
221
|
+
"loginActions",
|
|
222
|
+
propsConfig.loginActions,
|
|
223
|
+
envConfig.loginActions,
|
|
224
|
+
cookieConfig.loginActions,
|
|
225
|
+
[],
|
|
226
|
+
configSource
|
|
227
|
+
);
|
|
228
|
+
const appName = this.resolveValue(
|
|
229
|
+
"appName",
|
|
230
|
+
propsConfig.appName,
|
|
231
|
+
envConfig.appName,
|
|
232
|
+
cookieConfig.appName,
|
|
233
|
+
"Crudify App",
|
|
234
|
+
configSource
|
|
235
|
+
);
|
|
215
236
|
const logo = this.resolveValue("logo", propsConfig.logo, envConfig.logo, cookieConfig.logo, "", configSource);
|
|
216
237
|
const colors = this.resolveValue("colors", propsConfig.colors, envConfig.colors, cookieConfig.colors, {}, configSource);
|
|
217
238
|
console.log("\u{1F50D} ConfigurationManager - Resolved values:");
|
|
@@ -718,7 +739,7 @@ var init_TokenManager = __esm({
|
|
|
718
739
|
console.log("\u{1F510} TokenManager - Initialization complete");
|
|
719
740
|
}
|
|
720
741
|
/**
|
|
721
|
-
* Migrate tokens from localStorage to
|
|
742
|
+
* Migrate tokens from plain localStorage to encrypted localStorage
|
|
722
743
|
* This ensures compatibility with older implementations
|
|
723
744
|
*/
|
|
724
745
|
migrateFromLocalStorage() {
|
|
@@ -726,9 +747,9 @@ var init_TokenManager = __esm({
|
|
|
726
747
|
const legacyKeys = ["authToken", "token", "jwt", "jwtToken"];
|
|
727
748
|
for (const key of legacyKeys) {
|
|
728
749
|
const token = localStorage.getItem(key);
|
|
729
|
-
if (token && !
|
|
750
|
+
if (token && !secureLocalStorage.getToken()) {
|
|
730
751
|
console.log(`\u{1F510} TokenManager - Migrating token from localStorage key: ${key}`);
|
|
731
|
-
|
|
752
|
+
secureLocalStorage.setToken(token);
|
|
732
753
|
localStorage.removeItem(key);
|
|
733
754
|
break;
|
|
734
755
|
}
|
|
@@ -743,8 +764,8 @@ var init_TokenManager = __esm({
|
|
|
743
764
|
loadTokenFromStorage() {
|
|
744
765
|
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Entry point - loading token from storage");
|
|
745
766
|
try {
|
|
746
|
-
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Getting token from secure
|
|
747
|
-
const storedToken =
|
|
767
|
+
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Getting token from secure local storage");
|
|
768
|
+
const storedToken = secureLocalStorage.getToken();
|
|
748
769
|
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Stored token exists:", !!storedToken);
|
|
749
770
|
if (storedToken && this.isTokenValid(storedToken)) {
|
|
750
771
|
console.log("\u{1F510} TokenManager - LOAD_FROM_STORAGE: Stored token is valid, updating cache");
|
|
@@ -807,7 +828,7 @@ var init_TokenManager = __esm({
|
|
|
807
828
|
this.tokenCache = token;
|
|
808
829
|
this.parsedTokenCache = this.parseToken(token);
|
|
809
830
|
console.log("\u{1F510} TokenManager - SET_TOKEN: Storing token in secure storage");
|
|
810
|
-
|
|
831
|
+
secureLocalStorage.setToken(token);
|
|
811
832
|
console.log("\u{1F510} TokenManager - SET_TOKEN: Synchronizing with crudify");
|
|
812
833
|
this.syncTokenWithCrudify(token);
|
|
813
834
|
console.log("\u{1F510} TokenManager - SET_TOKEN: Token set and synchronized successfully");
|
|
@@ -909,7 +930,7 @@ var init_TokenManager = __esm({
|
|
|
909
930
|
this.tokenCache = null;
|
|
910
931
|
this.parsedTokenCache = null;
|
|
911
932
|
console.log("\u{1F510} TokenManager - CLEAR_TOKEN: Clearing from secure storage");
|
|
912
|
-
|
|
933
|
+
secureLocalStorage.removeItem(this.TOKEN_KEY);
|
|
913
934
|
console.log("\u{1F510} TokenManager - CLEAR_TOKEN: Clearing from crudify");
|
|
914
935
|
import_crudify_browser3.default.setToken("");
|
|
915
936
|
console.log("\u{1F510} TokenManager - CLEAR_TOKEN: Token cleared from all storages successfully");
|
|
@@ -1191,7 +1212,18 @@ var init_CrudifyDataProvider = __esm({
|
|
|
1191
1212
|
tokenManager: tokenManager.getDebugInfo(),
|
|
1192
1213
|
crudifyInitializer: crudifyInitializer.getStatus()
|
|
1193
1214
|
};
|
|
1194
|
-
}, [
|
|
1215
|
+
}, [
|
|
1216
|
+
isConfigured,
|
|
1217
|
+
configError,
|
|
1218
|
+
isInitialized,
|
|
1219
|
+
isInitializing,
|
|
1220
|
+
initializationError,
|
|
1221
|
+
isAuthenticated,
|
|
1222
|
+
config,
|
|
1223
|
+
token,
|
|
1224
|
+
user,
|
|
1225
|
+
tokenExpiration
|
|
1226
|
+
]);
|
|
1195
1227
|
(0, import_react5.useEffect)(() => {
|
|
1196
1228
|
const resolvedConfig = initializeConfiguration();
|
|
1197
1229
|
updateAuthenticationState();
|
|
@@ -2820,7 +2852,14 @@ var useCrudifyLogin = (config, _options = {}) => {
|
|
|
2820
2852
|
const finalConfig = (0, import_react10.useMemo)(() => {
|
|
2821
2853
|
const publicApiKey = config.publicApiKey || (isConfigured ? dataProviderConfig?.publicApiKey : null) || getCookie("publicApiKey") || null;
|
|
2822
2854
|
console.log("\u{1F50D} useCrudifyLogin - Resolved publicApiKey:", publicApiKey);
|
|
2823
|
-
console.log(
|
|
2855
|
+
console.log(
|
|
2856
|
+
"\u{1F50D} useCrudifyLogin - Sources - props:",
|
|
2857
|
+
config.publicApiKey,
|
|
2858
|
+
"dataProvider:",
|
|
2859
|
+
dataProviderConfig?.publicApiKey,
|
|
2860
|
+
"cookie:",
|
|
2861
|
+
getCookie("publicApiKey")
|
|
2862
|
+
);
|
|
2824
2863
|
const rawEnv = config.env || (isConfigured ? dataProviderConfig?.env : null) || getCookie("environment") || "prod";
|
|
2825
2864
|
const env = ["dev", "stg", "prod"].includes(rawEnv) ? rawEnv : "prod";
|
|
2826
2865
|
const appName = config.appName || (isConfigured ? dataProviderConfig?.appName : null) || getCookie("appName") || "Crudia";
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
secureSessionStorage,
|
|
11
11
|
tokenManager,
|
|
12
12
|
useCrudifyDataContext
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LR5FXHGC.mjs";
|
|
14
14
|
|
|
15
15
|
// src/index.ts
|
|
16
16
|
import { default as default2 } from "@nocios/crudify-browser";
|
|
@@ -1551,7 +1551,14 @@ var useCrudifyLogin = (config, _options = {}) => {
|
|
|
1551
1551
|
const finalConfig = useMemo2(() => {
|
|
1552
1552
|
const publicApiKey = config.publicApiKey || (isConfigured ? dataProviderConfig?.publicApiKey : null) || getCookie("publicApiKey") || null;
|
|
1553
1553
|
console.log("\u{1F50D} useCrudifyLogin - Resolved publicApiKey:", publicApiKey);
|
|
1554
|
-
console.log(
|
|
1554
|
+
console.log(
|
|
1555
|
+
"\u{1F50D} useCrudifyLogin - Sources - props:",
|
|
1556
|
+
config.publicApiKey,
|
|
1557
|
+
"dataProvider:",
|
|
1558
|
+
dataProviderConfig?.publicApiKey,
|
|
1559
|
+
"cookie:",
|
|
1560
|
+
getCookie("publicApiKey")
|
|
1561
|
+
);
|
|
1555
1562
|
const rawEnv = config.env || (isConfigured ? dataProviderConfig?.env : null) || getCookie("environment") || "prod";
|
|
1556
1563
|
const env = ["dev", "stg", "prod"].includes(rawEnv) ? rawEnv : "prod";
|
|
1557
1564
|
const appName = config.appName || (isConfigured ? dataProviderConfig?.appName : null) || getCookie("appName") || "Crudia";
|
|
@@ -2381,7 +2388,7 @@ var useCrudifyInstance = () => {
|
|
|
2381
2388
|
}
|
|
2382
2389
|
try {
|
|
2383
2390
|
console.log("\u{1F504} useCrudifyInstance - waitForReady: Using CrudifyInitializer.waitForInitialization()");
|
|
2384
|
-
const { crudifyInitializer: crudifyInitializer2 } = await import("./CrudifyDataProvider-
|
|
2391
|
+
const { crudifyInitializer: crudifyInitializer2 } = await import("./CrudifyDataProvider-BLW4PCVZ.mjs");
|
|
2385
2392
|
await crudifyInitializer2.waitForInitialization();
|
|
2386
2393
|
console.log("\u2705 useCrudifyInstance - waitForReady: CrudifyInitializer completed");
|
|
2387
2394
|
if (!crudifyInitializer2.isReady()) {
|
|
@@ -2523,7 +2530,7 @@ var useCrudifyInstance = () => {
|
|
|
2523
2530
|
};
|
|
2524
2531
|
var getCrudifyInstanceAsync = async () => {
|
|
2525
2532
|
console.log("\u{1F504} getCrudifyInstanceAsync - Starting");
|
|
2526
|
-
const { crudifyInitializer: crudifyInitializer2 } = await import("./CrudifyDataProvider-
|
|
2533
|
+
const { crudifyInitializer: crudifyInitializer2 } = await import("./CrudifyDataProvider-BLW4PCVZ.mjs");
|
|
2527
2534
|
console.log("\u{1F504} getCrudifyInstanceAsync - Checking if ready");
|
|
2528
2535
|
console.log(" - crudifyInitializer.isReady():", crudifyInitializer2.isReady());
|
|
2529
2536
|
console.log(" - crudifyInitializer.getStatus():", crudifyInitializer2.getStatus());
|
|
@@ -2542,7 +2549,7 @@ var getCrudifyInstanceAsync = async () => {
|
|
|
2542
2549
|
return crudify5;
|
|
2543
2550
|
};
|
|
2544
2551
|
var getCrudifyInstanceSync = async () => {
|
|
2545
|
-
const { crudifyInitializer: crudifyInitializer2 } = await import("./CrudifyDataProvider-
|
|
2552
|
+
const { crudifyInitializer: crudifyInitializer2 } = await import("./CrudifyDataProvider-BLW4PCVZ.mjs");
|
|
2546
2553
|
if (!crudifyInitializer2.isReady()) {
|
|
2547
2554
|
throw new Error("Crudify not ready. Use getCrudifyInstanceAsync() or call this from within a React component using useCrudifyInstance()");
|
|
2548
2555
|
}
|