@nocios/crudify-ui 4.0.94 → 4.0.98
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-DxFMT2hN.d.ts → LoginComponent-saSn0o5x.d.mts} +0 -1
- package/dist/{index-CY6Qkw3q.d.mts → LoginComponent-saSn0o5x.d.ts} +0 -1
- package/dist/{chunk-3SLGRD36.js → chunk-5AQJTODW.js} +1 -1
- package/dist/chunk-5JKS55SE.mjs +1 -0
- package/dist/{chunk-5PZJJNHP.mjs → chunk-6WYDSIJ6.mjs} +1 -1
- package/dist/chunk-AT74WV5W.js +1 -0
- package/dist/{chunk-Q7FTH5JW.js → chunk-IJOEEO3Z.js} +1 -1
- package/dist/chunk-IO4RPCSZ.mjs +1 -0
- package/dist/{chunk-5INZZQD6.mjs → chunk-O52COIJA.mjs} +1 -1
- package/dist/chunk-VQUXX5W3.js +1 -0
- package/dist/components.d.mts +22 -2
- package/dist/components.d.ts +22 -2
- package/dist/components.js +1 -1
- package/dist/components.mjs +1 -1
- package/dist/errorTranslation-CBbQYNWR.d.ts +124 -0
- package/dist/errorTranslation-DqdgLEUy.d.mts +124 -0
- package/dist/hooks.d.mts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/{index-BoWx_rFw.d.mts → index-BwF68SOh.d.mts} +19 -3
- package/dist/{index-CQttyYlB.d.ts → index-Fkm9ErmY.d.ts} +19 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/utils.d.mts +121 -116
- package/dist/utils.d.ts +121 -116
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +13 -3
- package/vitest.config.ts +27 -0
- package/dist/chunk-2OSNNNID.js +0 -1
- package/dist/chunk-6EBMA4HZ.js +0 -1
- package/dist/chunk-VVXZWBHL.mjs +0 -1
- package/dist/chunk-YS3C7YG5.mjs +0 -1
package/dist/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIJOEEO3Zjs = require('./chunk-IJOEEO3Z.js');var _chunkVQUXX5W3js = require('./chunk-VQUXX5W3.js');require('./chunk-YIIUEOXC.js');require('./chunk-AT74WV5W.js');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function G({showBelowMinutes:d=5,position:f="bottom-right",colorNormal:m="#ed6c02",colorCritical:x="#d32f2f",style:g,className:u}={}){let{isAuthenticated:o,tokens:t}=_chunkVQUXX5W3js.c.call(void 0, ),[i,h]=_react.useState.call(void 0, 0),[y,S]=_react.useState.call(void 0, 100);if(_react.useEffect.call(void 0, ()=>{if(!o||!t)return;let P=setInterval(()=>{let C=Date.now(),p=t.expiresAt-C,w=900*1e3;h(Math.max(0,p)),S(Math.max(0,p/w*100))},1e3);return()=>clearInterval(P)},[o,t]),!o||i<=0)return null;let e=Math.floor(i/6e4),b=Math.floor(i%6e4/1e3);if(e>=d)return null;let s=e<2,a=s?x:m,v={"top-left":{top:"16px",left:"16px"},"top-right":{top:"16px",right:"16px"},"bottom-left":{bottom:"16px",left:"16px"},"bottom-right":{bottom:"16px",right:"16px"}}[f];return _jsxruntime.jsxs.call(void 0, "div",{className:u,style:{position:"fixed",...v,padding:"12px 16px",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",minWidth:"200px",zIndex:9999,fontFamily:"system-ui, -apple-system, sans-serif",...g},children:[_jsxruntime.jsxs.call(void 0, "div",{style:{marginBottom:"8px"},children:[_jsxruntime.jsx.call(void 0, "div",{style:{fontSize:"12px",fontWeight:600,color:a,marginBottom:"4px"},children:s?"\u26A0\uFE0F Sesi\xF3n expirando":"\u23F0 Sesi\xF3n por expirar"}),_jsxruntime.jsxs.call(void 0, "div",{style:{fontSize:"14px",color:"#333",fontWeight:500},children:[e,":",b.toString().padStart(2,"0")]})]}),_jsxruntime.jsx.call(void 0, "div",{style:{width:"100%",height:"6px",backgroundColor:"#e0e0e0",borderRadius:"3px",overflow:"hidden"},children:_jsxruntime.jsx.call(void 0, "div",{style:{width:`${y}%`,height:"100%",backgroundColor:a,transition:"width 1s linear"}})})]})}exports.CrudifyLogin = _chunkIJOEEO3Zjs.a; exports.GlobalNotificationProvider = _chunkVQUXX5W3js.d; exports.LoginComponent = _chunkIJOEEO3Zjs.f; exports.Policies = _chunkIJOEEO3Zjs.e; exports.SessionStatus = _chunkIJOEEO3Zjs.g; exports.SessionTimeIndicator = G; exports.UserProfileDisplay = _chunkIJOEEO3Zjs.b; exports.useGlobalNotification = _chunkVQUXX5W3js.e;
|
package/dist/components.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as T,b as L,e as M,f as R,g as k}from"./chunk-6WYDSIJ6.mjs";import{c as l,d as I,e as N}from"./chunk-IO4RPCSZ.mjs";import"./chunk-BJ6PIVZR.mjs";import"./chunk-5JKS55SE.mjs";import{useEffect as B,useState as c}from"react";import{jsx as r,jsxs as n}from"react/jsx-runtime";function G({showBelowMinutes:d=5,position:f="bottom-right",colorNormal:m="#ed6c02",colorCritical:x="#d32f2f",style:g,className:u}={}){let{isAuthenticated:o,tokens:t}=l(),[i,h]=c(0),[y,S]=c(100);if(B(()=>{if(!o||!t)return;let P=setInterval(()=>{let C=Date.now(),p=t.expiresAt-C,w=900*1e3;h(Math.max(0,p)),S(Math.max(0,p/w*100))},1e3);return()=>clearInterval(P)},[o,t]),!o||i<=0)return null;let e=Math.floor(i/6e4),b=Math.floor(i%6e4/1e3);if(e>=d)return null;let s=e<2,a=s?x:m,v={"top-left":{top:"16px",left:"16px"},"top-right":{top:"16px",right:"16px"},"bottom-left":{bottom:"16px",left:"16px"},"bottom-right":{bottom:"16px",right:"16px"}}[f];return n("div",{className:u,style:{position:"fixed",...v,padding:"12px 16px",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",minWidth:"200px",zIndex:9999,fontFamily:"system-ui, -apple-system, sans-serif",...g},children:[n("div",{style:{marginBottom:"8px"},children:[r("div",{style:{fontSize:"12px",fontWeight:600,color:a,marginBottom:"4px"},children:s?"\u26A0\uFE0F Sesi\xF3n expirando":"\u23F0 Sesi\xF3n por expirar"}),n("div",{style:{fontSize:"14px",color:"#333",fontWeight:500},children:[e,":",b.toString().padStart(2,"0")]})]}),r("div",{style:{width:"100%",height:"6px",backgroundColor:"#e0e0e0",borderRadius:"3px",overflow:"hidden"},children:r("div",{style:{width:`${y}%`,height:"100%",backgroundColor:a,transition:"width 1s linear"}})})]})}export{T as CrudifyLogin,I as GlobalNotificationProvider,R as LoginComponent,M as Policies,k as SessionStatus,G as SessionTimeIndicator,L as UserProfileDisplay,N as useGlobalNotification};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { J as JwtPayload } from './api-Djqihi4n.js';
|
|
2
|
+
|
|
3
|
+
interface JWTPayload extends JwtPayload {
|
|
4
|
+
"cognito:username"?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const decodeJwtSafely: (token: string) => JWTPayload | null;
|
|
7
|
+
declare const getCurrentUserEmail: () => string | null;
|
|
8
|
+
declare const isTokenExpired: (token: string) => boolean;
|
|
9
|
+
|
|
10
|
+
declare const getCookie: (name: string) => string | null;
|
|
11
|
+
|
|
12
|
+
declare class SecureStorage {
|
|
13
|
+
private readonly encryptionKey;
|
|
14
|
+
private readonly storage;
|
|
15
|
+
constructor(storageType?: "localStorage" | "sessionStorage");
|
|
16
|
+
private generateEncryptionKey;
|
|
17
|
+
setItem(key: string, value: string, expiryMinutes?: number): void;
|
|
18
|
+
getItem(key: string): string | null;
|
|
19
|
+
removeItem(key: string): void;
|
|
20
|
+
setToken(token: string): void;
|
|
21
|
+
getToken(): string | null;
|
|
22
|
+
}
|
|
23
|
+
declare const secureSessionStorage: SecureStorage;
|
|
24
|
+
declare const secureLocalStorage: SecureStorage;
|
|
25
|
+
|
|
26
|
+
declare const ERROR_CODES: {
|
|
27
|
+
readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
|
|
28
|
+
readonly UNAUTHORIZED: "UNAUTHORIZED";
|
|
29
|
+
readonly INVALID_API_KEY: "INVALID_API_KEY";
|
|
30
|
+
readonly USER_NOT_FOUND: "USER_NOT_FOUND";
|
|
31
|
+
readonly USER_NOT_ACTIVE: "USER_NOT_ACTIVE";
|
|
32
|
+
readonly NO_PERMISSION: "NO_PERMISSION";
|
|
33
|
+
readonly ITEM_NOT_FOUND: "ITEM_NOT_FOUND";
|
|
34
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
35
|
+
readonly IN_USE: "IN_USE";
|
|
36
|
+
readonly FIELD_ERROR: "FIELD_ERROR";
|
|
37
|
+
readonly BAD_REQUEST: "BAD_REQUEST";
|
|
38
|
+
readonly INVALID_EMAIL: "INVALID_EMAIL";
|
|
39
|
+
readonly INVALID_CODE: "INVALID_CODE";
|
|
40
|
+
readonly INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR";
|
|
41
|
+
readonly DATABASE_CONNECTION_ERROR: "DATABASE_CONNECTION_ERROR";
|
|
42
|
+
readonly INVALID_CONFIGURATION: "INVALID_CONFIGURATION";
|
|
43
|
+
readonly UNKNOWN_OPERATION: "UNKNOWN_OPERATION";
|
|
44
|
+
readonly TOO_MANY_REQUESTS: "TOO_MANY_REQUESTS";
|
|
45
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
46
|
+
readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
|
|
47
|
+
};
|
|
48
|
+
type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
|
|
49
|
+
type ErrorSeverity = "info" | "warning" | "error" | "critical";
|
|
50
|
+
declare const ERROR_SEVERITY_MAP: Record<ErrorCode, ErrorSeverity>;
|
|
51
|
+
interface ParsedError {
|
|
52
|
+
code: ErrorCode;
|
|
53
|
+
message: string;
|
|
54
|
+
severity: ErrorSeverity;
|
|
55
|
+
field?: string;
|
|
56
|
+
details?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parse a Crudify API response and extract standardized error information
|
|
60
|
+
*/
|
|
61
|
+
declare function parseApiError(response: unknown): ParsedError[];
|
|
62
|
+
/**
|
|
63
|
+
* Parse transaction response errors
|
|
64
|
+
*/
|
|
65
|
+
declare function parseTransactionError(response: unknown): ParsedError[];
|
|
66
|
+
/**
|
|
67
|
+
* Get a human-readable error message for an error code
|
|
68
|
+
*/
|
|
69
|
+
declare function getErrorMessage(code: ErrorCode): string;
|
|
70
|
+
/**
|
|
71
|
+
* Handle JavaScript/Network errors and convert to ParsedError
|
|
72
|
+
*/
|
|
73
|
+
declare function parseJavaScriptError(error: unknown): ParsedError;
|
|
74
|
+
/**
|
|
75
|
+
* Universal error handler that can process any type of error from Crudify APIs
|
|
76
|
+
*/
|
|
77
|
+
declare function handleCrudifyError(error: unknown): ParsedError[];
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Utilidad robusta para traducir códigos de error con fallbacks inteligentes
|
|
81
|
+
* Busca en múltiples namespaces y devuelve la traducción más específica disponible
|
|
82
|
+
*/
|
|
83
|
+
interface ErrorTranslationConfig {
|
|
84
|
+
/** Función de traducción de i18next */
|
|
85
|
+
translateFn: (key: string) => string;
|
|
86
|
+
/** Idioma actual (opcional, para logging) */
|
|
87
|
+
currentLanguage?: string;
|
|
88
|
+
/** Habilitar logs de debug */
|
|
89
|
+
enableDebug?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Traduce un código de error usando jerarquía de fallbacks
|
|
93
|
+
*/
|
|
94
|
+
declare function translateErrorCode(errorCode: string, config: ErrorTranslationConfig): string;
|
|
95
|
+
/**
|
|
96
|
+
* Traduce múltiples códigos de error
|
|
97
|
+
*/
|
|
98
|
+
declare function translateErrorCodes(errorCodes: string[], config: ErrorTranslationConfig): string[];
|
|
99
|
+
/**
|
|
100
|
+
* Traduce un error completo (código + mensaje personalizado)
|
|
101
|
+
*/
|
|
102
|
+
declare function translateError(error: {
|
|
103
|
+
code: string;
|
|
104
|
+
message?: string;
|
|
105
|
+
field?: string;
|
|
106
|
+
}, config: ErrorTranslationConfig): string;
|
|
107
|
+
/**
|
|
108
|
+
* Hook para usar en componentes React con i18next
|
|
109
|
+
*/
|
|
110
|
+
declare function createErrorTranslator(translateFn: (key: string) => string, options?: {
|
|
111
|
+
currentLanguage?: string;
|
|
112
|
+
enableDebug?: boolean;
|
|
113
|
+
}): {
|
|
114
|
+
translateErrorCode: (code: string) => string;
|
|
115
|
+
translateErrorCodes: (codes: string[]) => string[];
|
|
116
|
+
translateError: (error: {
|
|
117
|
+
code: string;
|
|
118
|
+
message?: string;
|
|
119
|
+
field?: string;
|
|
120
|
+
}) => string;
|
|
121
|
+
translateApiError: (apiResponse: any) => string;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export { ERROR_CODES as E, type ParsedError as P, getCookie as a, secureLocalStorage as b, parseTransactionError as c, decodeJwtSafely as d, parseJavaScriptError as e, getErrorMessage as f, getCurrentUserEmail as g, handleCrudifyError as h, isTokenExpired as i, ERROR_SEVERITY_MAP as j, type ErrorCode as k, type ErrorSeverity as l, translateErrorCodes as m, translateError as n, createErrorTranslator as o, parseApiError as p, type ErrorTranslationConfig as q, secureSessionStorage as s, translateErrorCode as t };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { J as JwtPayload } from './api-Djqihi4n.mjs';
|
|
2
|
+
|
|
3
|
+
interface JWTPayload extends JwtPayload {
|
|
4
|
+
"cognito:username"?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const decodeJwtSafely: (token: string) => JWTPayload | null;
|
|
7
|
+
declare const getCurrentUserEmail: () => string | null;
|
|
8
|
+
declare const isTokenExpired: (token: string) => boolean;
|
|
9
|
+
|
|
10
|
+
declare const getCookie: (name: string) => string | null;
|
|
11
|
+
|
|
12
|
+
declare class SecureStorage {
|
|
13
|
+
private readonly encryptionKey;
|
|
14
|
+
private readonly storage;
|
|
15
|
+
constructor(storageType?: "localStorage" | "sessionStorage");
|
|
16
|
+
private generateEncryptionKey;
|
|
17
|
+
setItem(key: string, value: string, expiryMinutes?: number): void;
|
|
18
|
+
getItem(key: string): string | null;
|
|
19
|
+
removeItem(key: string): void;
|
|
20
|
+
setToken(token: string): void;
|
|
21
|
+
getToken(): string | null;
|
|
22
|
+
}
|
|
23
|
+
declare const secureSessionStorage: SecureStorage;
|
|
24
|
+
declare const secureLocalStorage: SecureStorage;
|
|
25
|
+
|
|
26
|
+
declare const ERROR_CODES: {
|
|
27
|
+
readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
|
|
28
|
+
readonly UNAUTHORIZED: "UNAUTHORIZED";
|
|
29
|
+
readonly INVALID_API_KEY: "INVALID_API_KEY";
|
|
30
|
+
readonly USER_NOT_FOUND: "USER_NOT_FOUND";
|
|
31
|
+
readonly USER_NOT_ACTIVE: "USER_NOT_ACTIVE";
|
|
32
|
+
readonly NO_PERMISSION: "NO_PERMISSION";
|
|
33
|
+
readonly ITEM_NOT_FOUND: "ITEM_NOT_FOUND";
|
|
34
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
35
|
+
readonly IN_USE: "IN_USE";
|
|
36
|
+
readonly FIELD_ERROR: "FIELD_ERROR";
|
|
37
|
+
readonly BAD_REQUEST: "BAD_REQUEST";
|
|
38
|
+
readonly INVALID_EMAIL: "INVALID_EMAIL";
|
|
39
|
+
readonly INVALID_CODE: "INVALID_CODE";
|
|
40
|
+
readonly INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR";
|
|
41
|
+
readonly DATABASE_CONNECTION_ERROR: "DATABASE_CONNECTION_ERROR";
|
|
42
|
+
readonly INVALID_CONFIGURATION: "INVALID_CONFIGURATION";
|
|
43
|
+
readonly UNKNOWN_OPERATION: "UNKNOWN_OPERATION";
|
|
44
|
+
readonly TOO_MANY_REQUESTS: "TOO_MANY_REQUESTS";
|
|
45
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
46
|
+
readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
|
|
47
|
+
};
|
|
48
|
+
type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
|
|
49
|
+
type ErrorSeverity = "info" | "warning" | "error" | "critical";
|
|
50
|
+
declare const ERROR_SEVERITY_MAP: Record<ErrorCode, ErrorSeverity>;
|
|
51
|
+
interface ParsedError {
|
|
52
|
+
code: ErrorCode;
|
|
53
|
+
message: string;
|
|
54
|
+
severity: ErrorSeverity;
|
|
55
|
+
field?: string;
|
|
56
|
+
details?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parse a Crudify API response and extract standardized error information
|
|
60
|
+
*/
|
|
61
|
+
declare function parseApiError(response: unknown): ParsedError[];
|
|
62
|
+
/**
|
|
63
|
+
* Parse transaction response errors
|
|
64
|
+
*/
|
|
65
|
+
declare function parseTransactionError(response: unknown): ParsedError[];
|
|
66
|
+
/**
|
|
67
|
+
* Get a human-readable error message for an error code
|
|
68
|
+
*/
|
|
69
|
+
declare function getErrorMessage(code: ErrorCode): string;
|
|
70
|
+
/**
|
|
71
|
+
* Handle JavaScript/Network errors and convert to ParsedError
|
|
72
|
+
*/
|
|
73
|
+
declare function parseJavaScriptError(error: unknown): ParsedError;
|
|
74
|
+
/**
|
|
75
|
+
* Universal error handler that can process any type of error from Crudify APIs
|
|
76
|
+
*/
|
|
77
|
+
declare function handleCrudifyError(error: unknown): ParsedError[];
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Utilidad robusta para traducir códigos de error con fallbacks inteligentes
|
|
81
|
+
* Busca en múltiples namespaces y devuelve la traducción más específica disponible
|
|
82
|
+
*/
|
|
83
|
+
interface ErrorTranslationConfig {
|
|
84
|
+
/** Función de traducción de i18next */
|
|
85
|
+
translateFn: (key: string) => string;
|
|
86
|
+
/** Idioma actual (opcional, para logging) */
|
|
87
|
+
currentLanguage?: string;
|
|
88
|
+
/** Habilitar logs de debug */
|
|
89
|
+
enableDebug?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Traduce un código de error usando jerarquía de fallbacks
|
|
93
|
+
*/
|
|
94
|
+
declare function translateErrorCode(errorCode: string, config: ErrorTranslationConfig): string;
|
|
95
|
+
/**
|
|
96
|
+
* Traduce múltiples códigos de error
|
|
97
|
+
*/
|
|
98
|
+
declare function translateErrorCodes(errorCodes: string[], config: ErrorTranslationConfig): string[];
|
|
99
|
+
/**
|
|
100
|
+
* Traduce un error completo (código + mensaje personalizado)
|
|
101
|
+
*/
|
|
102
|
+
declare function translateError(error: {
|
|
103
|
+
code: string;
|
|
104
|
+
message?: string;
|
|
105
|
+
field?: string;
|
|
106
|
+
}, config: ErrorTranslationConfig): string;
|
|
107
|
+
/**
|
|
108
|
+
* Hook para usar en componentes React con i18next
|
|
109
|
+
*/
|
|
110
|
+
declare function createErrorTranslator(translateFn: (key: string) => string, options?: {
|
|
111
|
+
currentLanguage?: string;
|
|
112
|
+
enableDebug?: boolean;
|
|
113
|
+
}): {
|
|
114
|
+
translateErrorCode: (code: string) => string;
|
|
115
|
+
translateErrorCodes: (codes: string[]) => string[];
|
|
116
|
+
translateError: (error: {
|
|
117
|
+
code: string;
|
|
118
|
+
message?: string;
|
|
119
|
+
field?: string;
|
|
120
|
+
}) => string;
|
|
121
|
+
translateApiError: (apiResponse: any) => string;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export { ERROR_CODES as E, type ParsedError as P, getCookie as a, secureLocalStorage as b, parseTransactionError as c, decodeJwtSafely as d, parseJavaScriptError as e, getErrorMessage as f, getCurrentUserEmail as g, handleCrudifyError as h, isTokenExpired as i, ERROR_SEVERITY_MAP as j, type ErrorCode as k, type ErrorSeverity as l, translateErrorCodes as m, translateError as n, createErrorTranslator as o, parseApiError as p, type ErrorTranslationConfig as q, secureSessionStorage as s, translateErrorCode as t };
|
package/dist/hooks.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as SessionState, j as UseAuthReturn, l as UseDataReturn, U as UseSessionOptions, g as UseUserDataOptions, f as UseUserDataReturn, h as UserData, i as useAuth, n as useCrudifyWithNotifications, k as useData, u as useSession, e as useUserData, m as useUserProfile } from './index-
|
|
1
|
+
export { d as SessionState, j as UseAuthReturn, l as UseDataReturn, U as UseSessionOptions, g as UseUserDataOptions, f as UseUserDataReturn, h as UserData, i as useAuth, n as useCrudifyWithNotifications, k as useData, u as useSession, e as useUserData, m as useUserProfile } from './index-BwF68SOh.mjs';
|
|
2
2
|
import './api-Djqihi4n.mjs';
|
|
3
3
|
import './GlobalNotificationProvider-C3iWgM1z.mjs';
|
|
4
4
|
import 'react';
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as SessionState, j as UseAuthReturn, l as UseDataReturn, U as UseSessionOptions, g as UseUserDataOptions, f as UseUserDataReturn, h as UserData, i as useAuth, n as useCrudifyWithNotifications, k as useData, u as useSession, e as useUserData, m as useUserProfile } from './index-
|
|
1
|
+
export { d as SessionState, j as UseAuthReturn, l as UseDataReturn, U as UseSessionOptions, g as UseUserDataOptions, f as UseUserDataReturn, h as UserData, i as useAuth, n as useCrudifyWithNotifications, k as useData, u as useSession, e as useUserData, m as useUserProfile } from './index-Fkm9ErmY.js';
|
|
2
2
|
import './api-Djqihi4n.js';
|
|
3
3
|
import './GlobalNotificationProvider-C3iWgM1z.js';
|
|
4
4
|
import 'react';
|
package/dist/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5AQJTODWjs = require('./chunk-5AQJTODW.js');var _chunkVQUXX5W3js = require('./chunk-VQUXX5W3.js');require('./chunk-AT74WV5W.js');exports.useAuth = _chunk5AQJTODWjs.b; exports.useCrudifyWithNotifications = _chunk5AQJTODWjs.d; exports.useData = _chunk5AQJTODWjs.c; exports.useSession = _chunkVQUXX5W3js.c; exports.useUserData = _chunk5AQJTODWjs.a; exports.useUserProfile = _chunkVQUXX5W3js.j;
|
package/dist/hooks.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as r,c as o,d as a}from"./chunk-
|
|
1
|
+
import{a as s,b as r,c as o,d as a}from"./chunk-O52COIJA.mjs";import{c as e,j as t}from"./chunk-IO4RPCSZ.mjs";import"./chunk-5JKS55SE.mjs";export{r as useAuth,a as useCrudifyWithNotifications,o as useData,e as useSession,s as useUserData,t as useUserProfile};
|
|
@@ -75,6 +75,11 @@ declare class TokenStorage {
|
|
|
75
75
|
* Actualizar solo el access token (después de refresh)
|
|
76
76
|
*/
|
|
77
77
|
static updateAccessToken(newAccessToken: string, newExpiresAt: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* ✅ FASE 4.2: Suscribirse a cambios de tokens entre tabs
|
|
80
|
+
* Permite sincronizar logout/login entre múltiples tabs/ventanas
|
|
81
|
+
*/
|
|
82
|
+
static subscribeToChanges(callback: (tokens: TokenData | null) => void): () => void;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
type SessionConfig = {
|
|
@@ -100,6 +105,8 @@ declare class SessionManager {
|
|
|
100
105
|
private config;
|
|
101
106
|
private initialized;
|
|
102
107
|
private lastActivityTime;
|
|
108
|
+
private isRefreshingLocally;
|
|
109
|
+
private refreshPromise;
|
|
103
110
|
private constructor();
|
|
104
111
|
static getInstance(): SessionManager;
|
|
105
112
|
/**
|
|
@@ -147,15 +154,24 @@ declare class SessionManager {
|
|
|
147
154
|
hasValidTokens: boolean;
|
|
148
155
|
};
|
|
149
156
|
/**
|
|
150
|
-
* Refrescar tokens
|
|
157
|
+
* ✅ FASE 4: Refrescar tokens con protección contra concurrencia
|
|
151
158
|
*/
|
|
152
159
|
refreshTokens(): Promise<boolean>;
|
|
153
160
|
/**
|
|
154
|
-
*
|
|
161
|
+
* ✅ FASE 4: Método privado que realiza el refresh real
|
|
162
|
+
*/
|
|
163
|
+
private _performRefresh;
|
|
164
|
+
/**
|
|
165
|
+
* ✅ FASE 4: Verificar si hay un refresh en progreso
|
|
166
|
+
*/
|
|
167
|
+
isRefreshing(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* ✅ MEJORADO FASE 3: Configurar interceptor de respuesta NON-BLOCKING
|
|
170
|
+
* El interceptor NO debe hacer await, solo detectar y emitir eventos
|
|
155
171
|
*/
|
|
156
172
|
setupResponseInterceptor(): void;
|
|
157
173
|
/**
|
|
158
|
-
* Detectar errores de autorización en todos los formatos posibles
|
|
174
|
+
* ✅ FASE 3.1: Detectar errores de autorización en todos los formatos posibles (mejorado)
|
|
159
175
|
*/
|
|
160
176
|
private detectAuthorizationError;
|
|
161
177
|
/**
|
|
@@ -75,6 +75,11 @@ declare class TokenStorage {
|
|
|
75
75
|
* Actualizar solo el access token (después de refresh)
|
|
76
76
|
*/
|
|
77
77
|
static updateAccessToken(newAccessToken: string, newExpiresAt: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* ✅ FASE 4.2: Suscribirse a cambios de tokens entre tabs
|
|
80
|
+
* Permite sincronizar logout/login entre múltiples tabs/ventanas
|
|
81
|
+
*/
|
|
82
|
+
static subscribeToChanges(callback: (tokens: TokenData | null) => void): () => void;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
type SessionConfig = {
|
|
@@ -100,6 +105,8 @@ declare class SessionManager {
|
|
|
100
105
|
private config;
|
|
101
106
|
private initialized;
|
|
102
107
|
private lastActivityTime;
|
|
108
|
+
private isRefreshingLocally;
|
|
109
|
+
private refreshPromise;
|
|
103
110
|
private constructor();
|
|
104
111
|
static getInstance(): SessionManager;
|
|
105
112
|
/**
|
|
@@ -147,15 +154,24 @@ declare class SessionManager {
|
|
|
147
154
|
hasValidTokens: boolean;
|
|
148
155
|
};
|
|
149
156
|
/**
|
|
150
|
-
* Refrescar tokens
|
|
157
|
+
* ✅ FASE 4: Refrescar tokens con protección contra concurrencia
|
|
151
158
|
*/
|
|
152
159
|
refreshTokens(): Promise<boolean>;
|
|
153
160
|
/**
|
|
154
|
-
*
|
|
161
|
+
* ✅ FASE 4: Método privado que realiza el refresh real
|
|
162
|
+
*/
|
|
163
|
+
private _performRefresh;
|
|
164
|
+
/**
|
|
165
|
+
* ✅ FASE 4: Verificar si hay un refresh en progreso
|
|
166
|
+
*/
|
|
167
|
+
isRefreshing(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* ✅ MEJORADO FASE 3: Configurar interceptor de respuesta NON-BLOCKING
|
|
170
|
+
* El interceptor NO debe hacer await, solo detectar y emitir eventos
|
|
155
171
|
*/
|
|
156
172
|
setupResponseInterceptor(): void;
|
|
157
173
|
/**
|
|
158
|
-
* Detectar errores de autorización en todos los formatos posibles
|
|
174
|
+
* ✅ FASE 3.1: Detectar errores de autorización en todos los formatos posibles (mejorado)
|
|
159
175
|
*/
|
|
160
176
|
private detectAuthorizationError;
|
|
161
177
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * from '@nocios/crudify-browser';
|
|
2
2
|
export { default as crudify } from '@nocios/crudify-browser';
|
|
3
|
-
export { B as BoxScreenType, C as CrudifyLogin, d as CrudifyLoginConfig, e as CrudifyLoginProps, f as CrudifyLoginTranslations, L as LoginComponent, a as POLICY_ACTIONS, b as PREFERRED_POLICY_ORDER, P as Policies, c as PolicyAction, S as SessionStatus, g as UserLoginData, U as UserProfileDisplay } from './
|
|
3
|
+
export { B as BoxScreenType, C as CrudifyLogin, d as CrudifyLoginConfig, e as CrudifyLoginProps, f as CrudifyLoginTranslations, L as LoginComponent, a as POLICY_ACTIONS, b as PREFERRED_POLICY_ORDER, P as Policies, c as PolicyAction, S as SessionStatus, g as UserLoginData, U as UserProfileDisplay } from './LoginComponent-saSn0o5x.mjs';
|
|
4
4
|
export { A as ApiError, C as CrudifyApiResponse, a as CrudifyTransactionResponse, F as ForgotPasswordRequest, J as JwtPayload, b as LoginRequest, L as LoginResponse, R as ResetPasswordRequest, T as TransactionResponseData, U as UserProfile, V as ValidateCodeRequest, c as ValidationError } from './api-Djqihi4n.mjs';
|
|
5
|
-
import { U as UseSessionOptions, T as TokenData, L as LoginResult } from './index-
|
|
6
|
-
export { a as SessionConfig, S as SessionManager, d as SessionState, c as StorageType, b as TokenStorage, j as UseAuthReturn, l as UseDataReturn, g as UseUserDataOptions, f as UseUserDataReturn, h as UserData, i as useAuth, n as useCrudifyWithNotifications, k as useData, u as useSession, e as useUserData, m as useUserProfile } from './index-
|
|
5
|
+
import { U as UseSessionOptions, T as TokenData, L as LoginResult } from './index-BwF68SOh.mjs';
|
|
6
|
+
export { a as SessionConfig, S as SessionManager, d as SessionState, c as StorageType, b as TokenStorage, j as UseAuthReturn, l as UseDataReturn, g as UseUserDataOptions, f as UseUserDataReturn, h as UserData, i as useAuth, n as useCrudifyWithNotifications, k as useData, u as useSession, e as useUserData, m as useUserProfile } from './index-BwF68SOh.mjs';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
import { ReactNode } from 'react';
|
|
9
|
-
export { ERROR_CODES, ERROR_SEVERITY_MAP, ErrorCode, ErrorSeverity, ErrorTranslationConfig, ParsedError, createErrorTranslator, decodeJwtSafely, getCookie, getCurrentUserEmail, getErrorMessage, handleCrudifyError, isTokenExpired, parseApiError, parseJavaScriptError, parseTransactionError, secureLocalStorage, secureSessionStorage, translateError, translateErrorCode, translateErrorCodes } from './
|
|
9
|
+
export { E as ERROR_CODES, j as ERROR_SEVERITY_MAP, k as ErrorCode, l as ErrorSeverity, q as ErrorTranslationConfig, P as ParsedError, o as createErrorTranslator, d as decodeJwtSafely, a as getCookie, g as getCurrentUserEmail, f as getErrorMessage, h as handleCrudifyError, i as isTokenExpired, p as parseApiError, e as parseJavaScriptError, c as parseTransactionError, b as secureLocalStorage, s as secureSessionStorage, n as translateError, t as translateErrorCode, m as translateErrorCodes } from './errorTranslation-DqdgLEUy.mjs';
|
|
10
10
|
export { G as GlobalNotificationProvider, a as GlobalNotificationProviderProps, N as Notification, b as NotificationSeverity, u as useGlobalNotification } from './GlobalNotificationProvider-C3iWgM1z.mjs';
|
|
11
11
|
|
|
12
12
|
type SessionData = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * from '@nocios/crudify-browser';
|
|
2
2
|
export { default as crudify } from '@nocios/crudify-browser';
|
|
3
|
-
export { B as BoxScreenType, C as CrudifyLogin, d as CrudifyLoginConfig, e as CrudifyLoginProps, f as CrudifyLoginTranslations, L as LoginComponent, a as POLICY_ACTIONS, b as PREFERRED_POLICY_ORDER, P as Policies, c as PolicyAction, S as SessionStatus, g as UserLoginData, U as UserProfileDisplay } from './
|
|
3
|
+
export { B as BoxScreenType, C as CrudifyLogin, d as CrudifyLoginConfig, e as CrudifyLoginProps, f as CrudifyLoginTranslations, L as LoginComponent, a as POLICY_ACTIONS, b as PREFERRED_POLICY_ORDER, P as Policies, c as PolicyAction, S as SessionStatus, g as UserLoginData, U as UserProfileDisplay } from './LoginComponent-saSn0o5x.js';
|
|
4
4
|
export { A as ApiError, C as CrudifyApiResponse, a as CrudifyTransactionResponse, F as ForgotPasswordRequest, J as JwtPayload, b as LoginRequest, L as LoginResponse, R as ResetPasswordRequest, T as TransactionResponseData, U as UserProfile, V as ValidateCodeRequest, c as ValidationError } from './api-Djqihi4n.js';
|
|
5
|
-
import { U as UseSessionOptions, T as TokenData, L as LoginResult } from './index-
|
|
6
|
-
export { a as SessionConfig, S as SessionManager, d as SessionState, c as StorageType, b as TokenStorage, j as UseAuthReturn, l as UseDataReturn, g as UseUserDataOptions, f as UseUserDataReturn, h as UserData, i as useAuth, n as useCrudifyWithNotifications, k as useData, u as useSession, e as useUserData, m as useUserProfile } from './index-
|
|
5
|
+
import { U as UseSessionOptions, T as TokenData, L as LoginResult } from './index-Fkm9ErmY.js';
|
|
6
|
+
export { a as SessionConfig, S as SessionManager, d as SessionState, c as StorageType, b as TokenStorage, j as UseAuthReturn, l as UseDataReturn, g as UseUserDataOptions, f as UseUserDataReturn, h as UserData, i as useAuth, n as useCrudifyWithNotifications, k as useData, u as useSession, e as useUserData, m as useUserProfile } from './index-Fkm9ErmY.js';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
import { ReactNode } from 'react';
|
|
9
|
-
export { ERROR_CODES, ERROR_SEVERITY_MAP, ErrorCode, ErrorSeverity, ErrorTranslationConfig, ParsedError, createErrorTranslator, decodeJwtSafely, getCookie, getCurrentUserEmail, getErrorMessage, handleCrudifyError, isTokenExpired, parseApiError, parseJavaScriptError, parseTransactionError, secureLocalStorage, secureSessionStorage, translateError, translateErrorCode, translateErrorCodes } from './
|
|
9
|
+
export { E as ERROR_CODES, j as ERROR_SEVERITY_MAP, k as ErrorCode, l as ErrorSeverity, q as ErrorTranslationConfig, P as ParsedError, o as createErrorTranslator, d as decodeJwtSafely, a as getCookie, g as getCurrentUserEmail, f as getErrorMessage, h as handleCrudifyError, i as isTokenExpired, p as parseApiError, e as parseJavaScriptError, c as parseTransactionError, b as secureLocalStorage, s as secureSessionStorage, n as translateError, t as translateErrorCode, m as translateErrorCodes } from './errorTranslation-CBbQYNWR.js';
|
|
10
10
|
export { G as GlobalNotificationProvider, a as GlobalNotificationProviderProps, N as Notification, b as NotificationSeverity, u as useGlobalNotification } from './GlobalNotificationProvider-C3iWgM1z.js';
|
|
11
11
|
|
|
12
12
|
type SessionData = {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkIJOEEO3Zjs = require('./chunk-IJOEEO3Z.js');var _chunk5AQJTODWjs = require('./chunk-5AQJTODW.js');var _chunkVQUXX5W3js = require('./chunk-VQUXX5W3.js');var _chunkNNY4A73Vjs = require('./chunk-NNY4A73V.js');var _chunkYIIUEOXCjs = require('./chunk-YIIUEOXC.js');var _chunkAT74WV5Wjs = require('./chunk-AT74WV5W.js');var _crudifybrowser = require('@nocios/crudify-browser'); var _crudifybrowser2 = _interopRequireDefault(_crudifybrowser); _createStarExport(_crudifybrowser);exports.CrudifyLogin = _chunkIJOEEO3Zjs.a; exports.ERROR_CODES = _chunkYIIUEOXCjs.a; exports.ERROR_SEVERITY_MAP = _chunkYIIUEOXCjs.b; exports.GlobalNotificationProvider = _chunkVQUXX5W3js.d; exports.LoginComponent = _chunkIJOEEO3Zjs.f; exports.POLICY_ACTIONS = _chunkIJOEEO3Zjs.c; exports.PREFERRED_POLICY_ORDER = _chunkIJOEEO3Zjs.d; exports.Policies = _chunkIJOEEO3Zjs.e; exports.ProtectedRoute = _chunkVQUXX5W3js.h; exports.SessionDebugInfo = _chunkVQUXX5W3js.i; exports.SessionManager = _chunkVQUXX5W3js.b; exports.SessionProvider = _chunkVQUXX5W3js.f; exports.SessionStatus = _chunkIJOEEO3Zjs.g; exports.TokenStorage = _chunkVQUXX5W3js.a; exports.UserProfileDisplay = _chunkIJOEEO3Zjs.b; exports.createErrorTranslator = _chunkAT74WV5Wjs.e; exports.crudify = _crudifybrowser2.default; exports.decodeJwtSafely = _chunkAT74WV5Wjs.h; exports.getCookie = _chunkAT74WV5Wjs.a; exports.getCurrentUserEmail = _chunkAT74WV5Wjs.i; exports.getErrorMessage = _chunkYIIUEOXCjs.e; exports.handleCrudifyError = _chunkYIIUEOXCjs.g; exports.isTokenExpired = _chunkAT74WV5Wjs.j; exports.parseApiError = _chunkYIIUEOXCjs.c; exports.parseJavaScriptError = _chunkYIIUEOXCjs.f; exports.parseTransactionError = _chunkYIIUEOXCjs.d; exports.secureLocalStorage = _chunkNNY4A73Vjs.b; exports.secureSessionStorage = _chunkNNY4A73Vjs.a; exports.translateError = _chunkAT74WV5Wjs.d; exports.translateErrorCode = _chunkAT74WV5Wjs.b; exports.translateErrorCodes = _chunkAT74WV5Wjs.c; exports.useAuth = _chunk5AQJTODWjs.b; exports.useCrudifyWithNotifications = _chunk5AQJTODWjs.d; exports.useData = _chunk5AQJTODWjs.c; exports.useGlobalNotification = _chunkVQUXX5W3js.e; exports.useSession = _chunkVQUXX5W3js.c; exports.useSessionContext = _chunkVQUXX5W3js.g; exports.useUserData = _chunk5AQJTODWjs.a; exports.useUserProfile = _chunkVQUXX5W3js.j;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as U,b as L,c as v,d as O,e as h,f as k,g as A}from"./chunk-
|
|
1
|
+
import{a as U,b as L,c as v,d as O,e as h,f as k,g as A}from"./chunk-6WYDSIJ6.mjs";import{a as N,b,c as _,d as w}from"./chunk-O52COIJA.mjs";import{a as r,b as a,c as n,d as m,e as l,f as x,g as d,h as y,i as c,j as T}from"./chunk-IO4RPCSZ.mjs";import{a as I,b as q}from"./chunk-T2CPA46I.mjs";import{a as S,b as P,c as R,d as g,e as E,f as C,g as D}from"./chunk-BJ6PIVZR.mjs";import{a as o,b as e,c as t,d as s,e as i,h as p,i as f,j as u}from"./chunk-5JKS55SE.mjs";import{default as J}from"@nocios/crudify-browser";export*from"@nocios/crudify-browser";export{U as CrudifyLogin,S as ERROR_CODES,P as ERROR_SEVERITY_MAP,m as GlobalNotificationProvider,k as LoginComponent,v as POLICY_ACTIONS,O as PREFERRED_POLICY_ORDER,h as Policies,y as ProtectedRoute,c as SessionDebugInfo,a as SessionManager,x as SessionProvider,A as SessionStatus,r as TokenStorage,L as UserProfileDisplay,i as createErrorTranslator,J as crudify,p as decodeJwtSafely,o as getCookie,f as getCurrentUserEmail,E as getErrorMessage,D as handleCrudifyError,u as isTokenExpired,R as parseApiError,C as parseJavaScriptError,g as parseTransactionError,q as secureLocalStorage,I as secureSessionStorage,s as translateError,e as translateErrorCode,t as translateErrorCodes,b as useAuth,w as useCrudifyWithNotifications,_ as useData,l as useGlobalNotification,n as useSession,d as useSessionContext,N as useUserData,T as useUserProfile};
|