@nocios/crudify-components 2.0.32 → 2.0.38

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.
Files changed (178) hide show
  1. package/coverage/base.css +224 -0
  2. package/coverage/block-navigation.js +87 -0
  3. package/coverage/components/CrudiaAutoGenerate.tsx.html +583 -0
  4. package/coverage/components/CrudiaFileField/CrudiaFileField.tsx.html +1276 -0
  5. package/coverage/components/CrudiaFileField/components/DeleteConfirmationDialog.tsx.html +355 -0
  6. package/coverage/components/CrudiaFileField/components/DropZone.tsx.html +433 -0
  7. package/coverage/components/CrudiaFileField/components/FileItemRow.tsx.html +751 -0
  8. package/coverage/components/CrudiaFileField/components/FileThumbnail.tsx.html +1195 -0
  9. package/coverage/components/CrudiaFileField/components/index.html +176 -0
  10. package/coverage/components/CrudiaFileField/components/index.ts.html +115 -0
  11. package/coverage/components/CrudiaFileField/hooks/index.html +146 -0
  12. package/coverage/components/CrudiaFileField/hooks/index.ts.html +112 -0
  13. package/coverage/components/CrudiaFileField/hooks/useDeleteConfirmation.ts.html +421 -0
  14. package/coverage/components/CrudiaFileField/hooks/useDragDrop.ts.html +403 -0
  15. package/coverage/components/CrudiaFileField/index.html +131 -0
  16. package/coverage/components/CrudiaFileField/index.ts.html +112 -0
  17. package/coverage/components/CrudiaFileField/utils/formatters.ts.html +163 -0
  18. package/coverage/components/CrudiaFileField/utils/icons.tsx.html +253 -0
  19. package/coverage/components/CrudiaFileField/utils/index.html +131 -0
  20. package/coverage/components/CrudiaMarkdownField.tsx.html +619 -0
  21. package/coverage/components/CrudifyLogin/Forms/CheckCodeForm.tsx.html +586 -0
  22. package/coverage/components/CrudifyLogin/Forms/ForgotPasswordForm.tsx.html +694 -0
  23. package/coverage/components/CrudifyLogin/Forms/LoginForm.tsx.html +835 -0
  24. package/coverage/components/CrudifyLogin/Forms/ResetPasswordForm.tsx.html +1180 -0
  25. package/coverage/components/CrudifyLogin/Forms/components/CodeInput.tsx.html +283 -0
  26. package/coverage/components/CrudifyLogin/Forms/components/FormAlert.tsx.html +202 -0
  27. package/coverage/components/CrudifyLogin/Forms/components/PasswordInput.tsx.html +340 -0
  28. package/coverage/components/CrudifyLogin/Forms/components/index.html +161 -0
  29. package/coverage/components/CrudifyLogin/Forms/components/index.ts.html +106 -0
  30. package/coverage/components/CrudifyLogin/Forms/index.html +161 -0
  31. package/coverage/components/CrudifyLogin/Forms/utils/errorTranslation.ts.html +268 -0
  32. package/coverage/components/CrudifyLogin/Forms/utils/index.html +161 -0
  33. package/coverage/components/CrudifyLogin/Forms/utils/index.ts.html +106 -0
  34. package/coverage/components/CrudifyLogin/Forms/utils/paramUtils.ts.html +478 -0
  35. package/coverage/components/CrudifyLogin/Forms/utils/validation.ts.html +289 -0
  36. package/coverage/components/CrudifyLogin/components/CrudifyInitializer.tsx.html +262 -0
  37. package/coverage/components/CrudifyLogin/components/index.html +116 -0
  38. package/coverage/components/CrudifyLogin/context/CrudifyProvider.tsx.html +382 -0
  39. package/coverage/components/CrudifyLogin/context/I18nProvider.tsx.html +397 -0
  40. package/coverage/components/CrudifyLogin/context/LoginStateProvider.tsx.html +1249 -0
  41. package/coverage/components/CrudifyLogin/context/index.html +146 -0
  42. package/coverage/components/CrudifyLogin/hooks/index.html +116 -0
  43. package/coverage/components/CrudifyLogin/hooks/useTranslationsFromUrl.ts.html +292 -0
  44. package/coverage/components/CrudifyLogin/index.html +116 -0
  45. package/coverage/components/CrudifyLogin/index.tsx.html +475 -0
  46. package/coverage/components/GlobalNotificationProvider.tsx.html +781 -0
  47. package/coverage/components/LoginComponent.tsx.html +727 -0
  48. package/coverage/components/PasswordRequirements/index.html +116 -0
  49. package/coverage/components/PasswordRequirements/index.tsx.html +226 -0
  50. package/coverage/components/PublicPolicies/FieldSelector/FieldSelector.tsx.html +982 -0
  51. package/coverage/components/PublicPolicies/FieldSelector/index.html +131 -0
  52. package/coverage/components/PublicPolicies/FieldSelector/index.ts.html +85 -0
  53. package/coverage/components/PublicPolicies/Policies.tsx.html +610 -0
  54. package/coverage/components/PublicPolicies/PolicyItem/PolicyItem.tsx.html +856 -0
  55. package/coverage/components/PublicPolicies/PolicyItem/index.html +131 -0
  56. package/coverage/components/PublicPolicies/PolicyItem/index.ts.html +85 -0
  57. package/coverage/components/PublicPolicies/constants.ts.html +127 -0
  58. package/coverage/components/PublicPolicies/index.html +131 -0
  59. package/coverage/components/SessionTimeIndicator/index.html +116 -0
  60. package/coverage/components/SessionTimeIndicator/index.tsx.html +505 -0
  61. package/coverage/components/UserProfile/UserProfileDisplay.tsx.html +826 -0
  62. package/coverage/components/UserProfile/index.html +131 -0
  63. package/coverage/components/UserProfile/index.ts.html +85 -0
  64. package/coverage/components/index.html +176 -0
  65. package/coverage/components/index.ts.html +160 -0
  66. package/coverage/core/CrossTabSyncManager.ts.html +814 -0
  67. package/coverage/core/CrudifyInitializationManager.ts.html +1132 -0
  68. package/coverage/core/SessionManager.ts.html +2764 -0
  69. package/coverage/core/index.html +146 -0
  70. package/coverage/coverage-final.json +87 -0
  71. package/coverage/favicon.png +0 -0
  72. package/coverage/hooks/index.html +131 -0
  73. package/coverage/hooks/useAutoGenerate.ts.html +562 -0
  74. package/coverage/hooks/useFileUpload/index.html +131 -0
  75. package/coverage/hooks/useFileUpload/index.ts.html +112 -0
  76. package/coverage/hooks/useFileUpload/services/index.html +116 -0
  77. package/coverage/hooks/useFileUpload/services/uploadService.ts.html +610 -0
  78. package/coverage/hooks/useFileUpload/useFileUpload.ts.html +1870 -0
  79. package/coverage/hooks/useFileUpload/utils/fileUtils.ts.html +271 -0
  80. package/coverage/hooks/useFileUpload/utils/index.html +146 -0
  81. package/coverage/hooks/useFileUpload/utils/mimeTypes.ts.html +235 -0
  82. package/coverage/hooks/useFileUpload/utils/validation.ts.html +379 -0
  83. package/coverage/hooks/useSession/constants.ts.html +217 -0
  84. package/coverage/hooks/useSession/hooks/index.html +176 -0
  85. package/coverage/hooks/useSession/hooks/useAuthEventSubscriber.ts.html +331 -0
  86. package/coverage/hooks/useSession/hooks/useCrossTabSync.ts.html +433 -0
  87. package/coverage/hooks/useSession/hooks/useSessionActions.ts.html +664 -0
  88. package/coverage/hooks/useSession/hooks/useSessionState.ts.html +295 -0
  89. package/coverage/hooks/useSession/hooks/useTokenRefreshScheduler.ts.html +490 -0
  90. package/coverage/hooks/useSession/index.html +161 -0
  91. package/coverage/hooks/useSession/index.ts.html +127 -0
  92. package/coverage/hooks/useSession/types.ts.html +427 -0
  93. package/coverage/hooks/useSession/useSession.ts.html +526 -0
  94. package/coverage/hooks/useSession/utils/index.html +131 -0
  95. package/coverage/hooks/useSession/utils/initializeSession.ts.html +424 -0
  96. package/coverage/hooks/useSession/utils/tokenUtils.ts.html +280 -0
  97. package/coverage/hooks/useUserProfile.ts.html +658 -0
  98. package/coverage/index.html +566 -0
  99. package/coverage/prettify.css +1 -0
  100. package/coverage/prettify.js +2 -0
  101. package/coverage/providers/SessionProvider.tsx.html +1150 -0
  102. package/coverage/providers/TranslationsProvider.tsx.html +1450 -0
  103. package/coverage/providers/index.html +131 -0
  104. package/coverage/services/credentialsEventBus.ts.html +310 -0
  105. package/coverage/services/index.html +131 -0
  106. package/coverage/services/translationService.ts.html +1318 -0
  107. package/coverage/sort-arrow-sprite.png +0 -0
  108. package/coverage/sorter.js +210 -0
  109. package/coverage/translations/critical.ts.html +1195 -0
  110. package/coverage/translations/index.html +116 -0
  111. package/coverage/types/index.html +116 -0
  112. package/coverage/types/password.ts.html +178 -0
  113. package/coverage/utils/authEventBus.ts.html +454 -0
  114. package/coverage/utils/configResolver.ts.html +460 -0
  115. package/coverage/utils/cookieSync.ts.html +580 -0
  116. package/coverage/utils/errorHandler.ts.html +1264 -0
  117. package/coverage/utils/errorTranslation.ts.html +862 -0
  118. package/coverage/utils/index.html +296 -0
  119. package/coverage/utils/jwtUtils.ts.html +301 -0
  120. package/coverage/utils/logger.ts.html +901 -0
  121. package/coverage/utils/navigationTracker.ts.html +565 -0
  122. package/coverage/utils/passwordValidation.ts.html +259 -0
  123. package/coverage/utils/redirectSecurity.ts.html +715 -0
  124. package/coverage/utils/tenantConfig.ts.html +700 -0
  125. package/coverage/utils/tokenStorage.ts.html +1768 -0
  126. package/coverage/utils/webCrypto.ts.html +472 -0
  127. package/dist/{CrudiaMarkdownField-C54-A_J3.d.mts → CrudiaMarkdownField-BvJn2GL8.d.mts} +17 -7
  128. package/dist/{CrudiaMarkdownField-C8HQh7s5.d.ts → CrudiaMarkdownField-CggOpcBM.d.ts} +17 -7
  129. package/dist/chunk-44VU4TSP.mjs +1 -0
  130. package/dist/chunk-4LMFQECS.js +1 -0
  131. package/dist/chunk-77UKXG5L.mjs +1 -0
  132. package/dist/{chunk-4VN5YRYZ.js → chunk-BXFEQ6KP.js} +1 -1
  133. package/dist/{chunk-6ONAT4QU.js → chunk-H6XXWDUT.js} +1 -1
  134. package/dist/chunk-NIRLP2TC.js +1 -0
  135. package/dist/chunk-O4FUHIQG.mjs +1 -0
  136. package/dist/chunk-SYHNHKFA.mjs +1 -0
  137. package/dist/chunk-W4ZYKPOK.js +1 -0
  138. package/dist/{chunk-RJBX4MWF.mjs → chunk-WMLIOPUC.mjs} +1 -1
  139. package/dist/components.d.mts +1 -1
  140. package/dist/components.d.ts +1 -1
  141. package/dist/components.js +1 -1
  142. package/dist/components.mjs +1 -1
  143. package/dist/errorTranslation-D-Y7uNN_.d.mts +141 -0
  144. package/dist/errorTranslation-DDlAXpMl.d.ts +141 -0
  145. package/dist/hooks.d.mts +2 -2
  146. package/dist/hooks.d.ts +2 -2
  147. package/dist/hooks.js +1 -1
  148. package/dist/hooks.mjs +1 -1
  149. package/dist/{index-DY90WVQQ.d.mts → index-U--xRr8A.d.mts} +225 -191
  150. package/dist/{index-d1vE803G.d.ts → index-dXVRVcEB.d.ts} +225 -191
  151. package/dist/index.d.mts +179 -6
  152. package/dist/index.d.ts +179 -6
  153. package/dist/index.js +2 -2
  154. package/dist/index.mjs +1 -1
  155. package/dist/{errorTranslation-By5Av0tL.d.ts → tenantConfig-DqJqQkoR.d.mts} +116 -139
  156. package/dist/{errorTranslation-DeeDj7Vt.d.mts → tenantConfig-DqJqQkoR.d.ts} +116 -139
  157. package/dist/utils.d.mts +2 -2
  158. package/dist/utils.d.ts +2 -2
  159. package/dist/utils.js +1 -1
  160. package/dist/utils.mjs +1 -1
  161. package/package.json +1 -1
  162. package/coverage/.tmp/coverage-102.json +0 -1
  163. package/coverage/.tmp/coverage-103.json +0 -1
  164. package/coverage/.tmp/coverage-104.json +0 -1
  165. package/coverage/.tmp/coverage-105.json +0 -1
  166. package/coverage/.tmp/coverage-106.json +0 -1
  167. package/coverage/.tmp/coverage-107.json +0 -1
  168. package/dist/api-B4uXiHF0.d.mts +0 -118
  169. package/dist/api-B4uXiHF0.d.ts +0 -118
  170. package/dist/chunk-4ILUXVPW.mjs +0 -1
  171. package/dist/chunk-5XBTRBE5.js +0 -1
  172. package/dist/chunk-CR5KJUST.js +0 -1
  173. package/dist/chunk-H5M2Q6PB.mjs +0 -1
  174. package/dist/chunk-JAPL7EZJ.mjs +0 -1
  175. package/dist/chunk-L7GKP6XY.mjs +0 -1
  176. package/dist/chunk-NSV6ECYO.js +0 -1
  177. package/dist/chunk-PTUSZGL4.mjs +0 -1
  178. package/dist/chunk-T6R65ROU.js +0 -1
@@ -0,0 +1,141 @@
1
+ import { J as JwtPayload } from './tenantConfig-DqJqQkoR.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 class SecureStorage {
11
+ private readonly storage;
12
+ private encryptionKey;
13
+ private salt;
14
+ private initPromise;
15
+ private initialized;
16
+ constructor(storageType?: "localStorage" | "sessionStorage");
17
+ /**
18
+ * Initialize encryption key asynchronously
19
+ * Must be called before using encryption methods
20
+ */
21
+ private ensureInitialized;
22
+ private initialize;
23
+ private generateFingerprint;
24
+ private clearLegacyData;
25
+ setItem(key: string, value: string, expiryMinutes?: number): Promise<void>;
26
+ getItem(key: string): Promise<string | null>;
27
+ removeItem(key: string): void;
28
+ clear(): void;
29
+ setToken(token: string): Promise<void>;
30
+ getToken(): Promise<string | null>;
31
+ hasValidToken(): Promise<boolean>;
32
+ migrateFromLocalStorage(key: string): Promise<void>;
33
+ private uint8ArrayToBase64;
34
+ private base64ToUint8Array;
35
+ }
36
+ declare const secureSessionStorage: SecureStorage;
37
+ declare const secureLocalStorage: SecureStorage;
38
+
39
+ declare const ERROR_CODES: {
40
+ readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
41
+ readonly UNAUTHORIZED: "UNAUTHORIZED";
42
+ readonly INVALID_API_KEY: "INVALID_API_KEY";
43
+ readonly USER_NOT_FOUND: "USER_NOT_FOUND";
44
+ readonly USER_NOT_ACTIVE: "USER_NOT_ACTIVE";
45
+ readonly NO_PERMISSION: "NO_PERMISSION";
46
+ readonly ITEM_NOT_FOUND: "ITEM_NOT_FOUND";
47
+ readonly NOT_FOUND: "NOT_FOUND";
48
+ readonly IN_USE: "IN_USE";
49
+ readonly FIELD_ERROR: "FIELD_ERROR";
50
+ readonly BAD_REQUEST: "BAD_REQUEST";
51
+ readonly INVALID_EMAIL: "INVALID_EMAIL";
52
+ readonly INVALID_CODE: "INVALID_CODE";
53
+ readonly INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR";
54
+ readonly DATABASE_CONNECTION_ERROR: "DATABASE_CONNECTION_ERROR";
55
+ readonly INVALID_CONFIGURATION: "INVALID_CONFIGURATION";
56
+ readonly UNKNOWN_OPERATION: "UNKNOWN_OPERATION";
57
+ readonly TOO_MANY_REQUESTS: "TOO_MANY_REQUESTS";
58
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
59
+ readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
60
+ };
61
+ type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
62
+ type ErrorSeverity = "info" | "warning" | "error" | "critical";
63
+ declare const ERROR_SEVERITY_MAP: Record<ErrorCode, ErrorSeverity>;
64
+ interface ParsedError {
65
+ code: ErrorCode;
66
+ message: string;
67
+ severity: ErrorSeverity;
68
+ field?: string;
69
+ details?: Record<string, unknown>;
70
+ }
71
+ /**
72
+ * Parse a Crudify API response and extract standardized error information
73
+ */
74
+ declare function parseApiError(response: unknown): ParsedError[];
75
+ /**
76
+ * Parse transaction response errors
77
+ */
78
+ declare function parseTransactionError(response: unknown): ParsedError[];
79
+ /**
80
+ * Get a human-readable error message for an error code
81
+ */
82
+ declare function getErrorMessage(code: ErrorCode): string;
83
+ /**
84
+ * Handle JavaScript/Network errors and convert to ParsedError
85
+ */
86
+ declare function parseJavaScriptError(error: unknown): ParsedError;
87
+ /**
88
+ * Universal error handler that can process any type of error from Crudify APIs
89
+ */
90
+ declare function handleCrudifyError(error: unknown): ParsedError[];
91
+
92
+ interface ErrorTranslationConfig {
93
+ /** Función de traducción de i18next */
94
+ translateFn: (key: string) => string;
95
+ /** Idioma actual (opcional, para logging) */
96
+ currentLanguage?: string;
97
+ /** Habilitar logs de debug */
98
+ enableDebug?: boolean;
99
+ }
100
+ /**
101
+ * Traduce un código de error usando jerarquía de fallbacks
102
+ */
103
+ declare function translateErrorCode(errorCode: string, config: ErrorTranslationConfig): string;
104
+ /**
105
+ * Traduce múltiples códigos de error
106
+ */
107
+ declare function translateErrorCodes(errorCodes: string[], config: ErrorTranslationConfig): string[];
108
+ /**
109
+ * Traduce un error completo (código + mensaje personalizado)
110
+ */
111
+ declare function translateError(error: {
112
+ code: string;
113
+ message?: string;
114
+ field?: string;
115
+ }, config: ErrorTranslationConfig): string;
116
+ /**
117
+ * Hook para usar en componentes React con i18next
118
+ */
119
+ declare function createErrorTranslator(translateFn: (key: string) => string, options?: {
120
+ currentLanguage?: string;
121
+ enableDebug?: boolean;
122
+ }): {
123
+ translateErrorCode: (code: string) => string;
124
+ translateErrorCodes: (codes: string[]) => string[];
125
+ translateError: (error: {
126
+ code: string;
127
+ message?: string;
128
+ field?: string;
129
+ }) => string;
130
+ translateApiError: (apiResponse: {
131
+ data?: {
132
+ response?: {
133
+ status?: string;
134
+ };
135
+ };
136
+ status?: string;
137
+ code?: string;
138
+ } | null | undefined) => string;
139
+ };
140
+
141
+ export { ERROR_CODES as E, type ParsedError as P, secureLocalStorage as a, parseTransactionError as b, parseJavaScriptError as c, decodeJwtSafely as d, getErrorMessage as e, ERROR_SEVERITY_MAP as f, getCurrentUserEmail as g, handleCrudifyError as h, isTokenExpired as i, translateErrorCodes as j, translateError as k, createErrorTranslator as l, type ErrorCode as m, type ErrorSeverity as n, type ErrorTranslationConfig as o, parseApiError as p, secureSessionStorage as s, translateErrorCode as t };
package/dist/hooks.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- export { F as FileItem, v as FileStatus, d as SessionState, n as UseAuthReturn, p as UseDataReturn, s as UseFileUploadOptions, t as UseFileUploadReturn, U as UseSessionOptions, k as UseUserDataOptions, j as UseUserDataReturn, l as UserData, m as useAuth, w as useCrudifyWithNotifications, o as useData, r as useFileUpload, u as useSession, i as useUserData, q as useUserProfile } from './index-DY90WVQQ.mjs';
1
+ export { F as FileItem, v as FileStatus, d as SessionState, n as UseAuthReturn, p as UseDataReturn, s as UseFileUploadOptions, t as UseFileUploadReturn, U as UseSessionOptions, k as UseUserDataOptions, j as UseUserDataReturn, l as UserData, m as useAuth, w as useCrudifyWithNotifications, o as useData, r as useFileUpload, u as useSession, i as useUserData, q as useUserProfile } from './index-U--xRr8A.mjs';
2
2
  export { A as AutoGenerateConfig, d as UseAutoGenerateOptions, U as UseAutoGenerateReturn, c as useAutoGenerate } from './GlobalNotificationProvider-Zq18OkpI.mjs';
3
- import './api-B4uXiHF0.mjs';
3
+ import './tenantConfig-DqJqQkoR.mjs';
4
4
  import 'react/jsx-runtime';
5
5
  import 'react';
6
6
  import '@nocios/crudify-sdk';
package/dist/hooks.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { F as FileItem, v as FileStatus, d as SessionState, n as UseAuthReturn, p as UseDataReturn, s as UseFileUploadOptions, t as UseFileUploadReturn, U as UseSessionOptions, k as UseUserDataOptions, j as UseUserDataReturn, l as UserData, m as useAuth, w as useCrudifyWithNotifications, o as useData, r as useFileUpload, u as useSession, i as useUserData, q as useUserProfile } from './index-d1vE803G.js';
1
+ export { F as FileItem, v as FileStatus, d as SessionState, n as UseAuthReturn, p as UseDataReturn, s as UseFileUploadOptions, t as UseFileUploadReturn, U as UseSessionOptions, k as UseUserDataOptions, j as UseUserDataReturn, l as UserData, m as useAuth, w as useCrudifyWithNotifications, o as useData, r as useFileUpload, u as useSession, i as useUserData, q as useUserProfile } from './index-dXVRVcEB.js';
2
2
  export { A as AutoGenerateConfig, d as UseAutoGenerateOptions, U as UseAutoGenerateReturn, c as useAutoGenerate } from './GlobalNotificationProvider-Zq18OkpI.js';
3
- import './api-B4uXiHF0.js';
3
+ import './tenantConfig-DqJqQkoR.js';
4
4
  import 'react/jsx-runtime';
5
5
  import 'react';
6
6
  import '@nocios/crudify-sdk';
package/dist/hooks.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkT6R65ROUjs = require('./chunk-T6R65ROU.js');var _chunk6ONAT4QUjs = require('./chunk-6ONAT4QU.js');require('./chunk-CR5KJUST.js');exports.useAuth = _chunkT6R65ROUjs.b; exports.useAutoGenerate = _chunk6ONAT4QUjs.o; exports.useCrudifyWithNotifications = _chunkT6R65ROUjs.d; exports.useData = _chunkT6R65ROUjs.c; exports.useFileUpload = _chunk6ONAT4QUjs.r; exports.useSession = _chunk6ONAT4QUjs.e; exports.useUserData = _chunkT6R65ROUjs.a; exports.useUserProfile = _chunk6ONAT4QUjs.n;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNIRLP2TCjs = require('./chunk-NIRLP2TC.js');var _chunkH6XXWDUTjs = require('./chunk-H6XXWDUT.js');require('./chunk-4LMFQECS.js');exports.useAuth = _chunkNIRLP2TCjs.b; exports.useAutoGenerate = _chunkH6XXWDUTjs.o; exports.useCrudifyWithNotifications = _chunkNIRLP2TCjs.d; exports.useData = _chunkNIRLP2TCjs.c; exports.useFileUpload = _chunkH6XXWDUTjs.r; exports.useSession = _chunkH6XXWDUTjs.e; exports.useUserData = _chunkNIRLP2TCjs.a; exports.useUserProfile = _chunkH6XXWDUTjs.n;
package/dist/hooks.mjs CHANGED
@@ -1 +1 @@
1
- import{a as s,b as p,c as u,d as a}from"./chunk-H5M2Q6PB.mjs";import{e,n as t,o,r}from"./chunk-PTUSZGL4.mjs";import"./chunk-4ILUXVPW.mjs";export{p as useAuth,o as useAutoGenerate,a as useCrudifyWithNotifications,u as useData,r as useFileUpload,e as useSession,s as useUserData,t as useUserProfile};
1
+ import{a as s,b as p,c as u,d as a}from"./chunk-77UKXG5L.mjs";import{e,n as t,o,r}from"./chunk-O4FUHIQG.mjs";import"./chunk-44VU4TSP.mjs";export{p as useAuth,o as useAutoGenerate,a as useCrudifyWithNotifications,u as useData,r as useFileUpload,e as useSession,s as useUserData,t as useUserProfile};
@@ -1,8 +1,8 @@
1
- import { U as UserProfile, e as CrudifyRequestOptions, C as CrudifyApiResponse, g as TransactionInput, d as CrudifyOperationOptions } from './api-B4uXiHF0.mjs';
1
+ import { U as UserProfile, m as CrudifyRequestOptions, f as CrudifyApiResponse, o as TransactionInput, l as CrudifyOperationOptions } from './tenantConfig-DqJqQkoR.mjs';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { ReactNode } from 'react';
4
- import { b as NotificationSeverity } from './GlobalNotificationProvider-Zq18OkpI.mjs';
5
4
  import { CrudifyResponse } from '@nocios/crudify-sdk';
5
+ import { b as NotificationSeverity } from './GlobalNotificationProvider-Zq18OkpI.mjs';
6
6
 
7
7
  type TokenData = {
8
8
  accessToken: string;
@@ -462,6 +462,199 @@ declare function useSessionContext(): SessionContextType;
462
462
  */
463
463
  declare function SessionDebugInfo(): react_jsx_runtime.JSX.Element;
464
464
 
465
+ /**
466
+ * Individual file status
467
+ */
468
+ type FileStatus = "pending" | "uploading" | "completed" | "error" | "removing" | "pendingDeletion";
469
+ /**
470
+ * Represents a file in the system
471
+ */
472
+ interface FileItem {
473
+ /** Unique file ID (generated or from server) */
474
+ id: string;
475
+ /** Original file name */
476
+ name: string;
477
+ /** Size in bytes */
478
+ size: number;
479
+ /** MIME content type */
480
+ contentType: string;
481
+ /** Current file status */
482
+ status: FileStatus;
483
+ /** Upload progress (0-100) */
484
+ progress: number;
485
+ /**
486
+ * Relative file path (includes visibility)
487
+ * Format: "public/path/file.ext" or "private/path/file.ext"
488
+ */
489
+ filePath?: string;
490
+ /**
491
+ * File visibility
492
+ * Extracted from filePath for convenience
493
+ */
494
+ visibility?: "public" | "private";
495
+ /** Public URL for public files */
496
+ publicUrl?: string;
497
+ /** Preview URL (for images) */
498
+ previewUrl?: string;
499
+ /** Error message if failed */
500
+ errorMessage?: string;
501
+ /** Creation timestamp */
502
+ createdAt: number;
503
+ /** Original file (only during upload) */
504
+ file?: File;
505
+ /** Whether this file existed before (was loaded from server) */
506
+ isExisting?: boolean;
507
+ }
508
+ /**
509
+ * Hook configuration
510
+ */
511
+ interface UseFileUploadOptions {
512
+ /** Allowed MIME types (e.g., ["image/png", "image/jpeg", "application/pdf"]) */
513
+ acceptedTypes?: string[];
514
+ /** Maximum file size in bytes (default: 10MB) */
515
+ maxFileSize?: number;
516
+ /** Maximum number of files (undefined = no limit) */
517
+ maxFiles?: number;
518
+ /** Minimum number of required files (default: 0) */
519
+ minFiles?: number;
520
+ /**
521
+ * Visibility of uploaded files
522
+ * @default "private"
523
+ */
524
+ visibility?: "public" | "private";
525
+ /** Callback when an upload completes successfully */
526
+ onUploadComplete?: (file: FileItem) => void;
527
+ /** Callback when an upload fails */
528
+ onUploadError?: (file: FileItem, error: string) => void;
529
+ /** Callback when a file is removed */
530
+ onFileRemoved?: (file: FileItem) => void;
531
+ /** Callback when the file list changes */
532
+ onFilesChange?: (files: FileItem[]) => void;
533
+ /** Form mode: 'create' or 'edit' - affects delete behavior */
534
+ mode?: "create" | "edit";
535
+ }
536
+ /**
537
+ * Hook return type
538
+ */
539
+ interface UseFileUploadReturn {
540
+ /** Current file list */
541
+ files: FileItem[];
542
+ /** Active files (excluding pendingDeletion) */
543
+ activeFiles: FileItem[];
544
+ /** Count of active files */
545
+ activeFileCount: number;
546
+ /** Whether uploads are in progress */
547
+ isUploading: boolean;
548
+ /** Number of pending uploads */
549
+ pendingCount: number;
550
+ /** Add files (triggers automatic upload) */
551
+ addFiles: (files: FileList | File[]) => Promise<void>;
552
+ /** Remove a file - returns whether confirmation is needed */
553
+ removeFile: (fileId: string) => Promise<{
554
+ needsConfirmation: boolean;
555
+ isExisting: boolean;
556
+ }>;
557
+ /** Delete a file immediately from server (for new files or create mode) */
558
+ deleteFileImmediately: (fileId: string) => Promise<{
559
+ success: boolean;
560
+ error?: string;
561
+ }>;
562
+ /** Restore a file that was marked for deletion */
563
+ restoreFile: (fileId: string) => boolean;
564
+ /** Clear all files */
565
+ clearFiles: () => void;
566
+ /** Retry upload for a failed file */
567
+ retryUpload: (fileId: string) => Promise<void>;
568
+ /** Validate if minimum requirements are met */
569
+ isValid: boolean;
570
+ /** Validation error message (i18n key) */
571
+ validationError: string | null;
572
+ /** Validation error i18n key */
573
+ validationErrorKey: string | null;
574
+ /** Validation error params for i18n interpolation */
575
+ validationErrorParams: Record<string, string | number>;
576
+ /** Wait for all uploads to complete and return completed file paths */
577
+ waitForUploads: () => Promise<string[]>;
578
+ /**
579
+ * Completed file paths (for saving in form)
580
+ * Relative paths with visibility - subscriberKey is added in backend
581
+ */
582
+ completedFilePaths: string[];
583
+ /** Initialize with existing files (for editing) */
584
+ initializeFiles: (existingFiles: Array<{
585
+ filePath: string;
586
+ name: string;
587
+ size?: number;
588
+ contentType?: string;
589
+ }>, baseUrl?: string) => void;
590
+ /** Whether the user has interacted with the field */
591
+ isTouched: boolean;
592
+ /** Mark the field as touched (to show validation errors) */
593
+ markAsTouched: () => void;
594
+ /** Whether the form has been submitted */
595
+ isSubmitted: boolean;
596
+ /** Mark the form as submitted (to show all validation errors) */
597
+ markAsSubmitted: () => void;
598
+ /**
599
+ * Get URL for file preview
600
+ * - Public: returns publicUrl directly
601
+ * - Private: requests signed URL from backend
602
+ */
603
+ getPreviewUrl: (fileId: string) => Promise<string | null>;
604
+ /** List of file IDs pending deletion */
605
+ pendingDeletions: string[];
606
+ /** Whether there are files pending deletion */
607
+ hasPendingDeletions: boolean;
608
+ /** Execute all pending deletions (call this on form submit) */
609
+ commitDeletions: () => Promise<{
610
+ success: boolean;
611
+ errors: string[];
612
+ }>;
613
+ /** Cancel all pending deletions and restore files */
614
+ restorePendingDeletions: () => void;
615
+ }
616
+
617
+ /**
618
+ * Complete hook for file handling with:
619
+ * - Progressive upload to S3 with pre-signed URLs
620
+ * - Per-file progress tracking
621
+ * - Type and size validation
622
+ * - Soft delete (disableFile)
623
+ * - Multiple file support
624
+ */
625
+
626
+ /**
627
+ * Hook for complete file handling with S3 upload
628
+ *
629
+ * @example
630
+ * ```tsx
631
+ * const {
632
+ * files,
633
+ * addFiles,
634
+ * removeFile,
635
+ * isUploading,
636
+ * isValid,
637
+ * completedS3Keys
638
+ * } = useFileUpload({
639
+ * acceptedTypes: ["image/png", "image/jpeg", "application/pdf"],
640
+ * maxFileSize: 5 * 1024 * 1024, // 5MB
641
+ * maxFiles: 3,
642
+ * minFiles: 1
643
+ * });
644
+ *
645
+ * // In form submit
646
+ * const handleSubmit = async () => {
647
+ * await waitForUploads(); // Wait for pending uploads
648
+ * if (!isValid) return;
649
+ *
650
+ * await crudify.createItem("documents", {
651
+ * files: completedS3Keys
652
+ * });
653
+ * };
654
+ * ```
655
+ */
656
+ declare const useFileUpload: (options?: UseFileUploadOptions) => UseFileUploadReturn;
657
+
465
658
  /**
466
659
  * Complete user data structure (compatible con legacy)
467
660
  */
@@ -651,202 +844,20 @@ interface UseUserProfileReturn {
651
844
  declare const useUserProfile: (options?: UseUserProfileOptions) => UseUserProfileReturn;
652
845
 
653
846
  /**
654
- * Complete hook for file handling with:
655
- * - Progressive upload to S3 with pre-signed URLs
656
- * - Per-file progress tracking
657
- * - Type and size validation
658
- * - Soft delete (disableFile)
659
- * - Multiple file support
660
- */
661
- /**
662
- * Individual file status
663
- */
664
- type FileStatus = "pending" | "uploading" | "completed" | "error" | "removing" | "pendingDeletion";
665
- /**
666
- * Represents a file in the system
667
- */
668
- interface FileItem {
669
- /** Unique file ID (generated or from server) */
670
- id: string;
671
- /** Original file name */
672
- name: string;
673
- /** Size in bytes */
674
- size: number;
675
- /** MIME content type */
676
- contentType: string;
677
- /** Current file status */
678
- status: FileStatus;
679
- /** Upload progress (0-100) */
680
- progress: number;
681
- /**
682
- * Relative file path (includes visibility)
683
- * Format: "public/path/file.ext" or "private/path/file.ext"
684
- */
685
- filePath?: string;
686
- /**
687
- * File visibility
688
- * Extracted from filePath for convenience
689
- */
690
- visibility?: "public" | "private";
691
- /** Public URL for public files */
692
- publicUrl?: string;
693
- /** Preview URL (for images) */
694
- previewUrl?: string;
695
- /** Error message if failed */
696
- errorMessage?: string;
697
- /** Creation timestamp */
698
- createdAt: number;
699
- /** Original file (only during upload) */
700
- file?: File;
701
- /** Whether this file existed before (was loaded from server) */
702
- isExisting?: boolean;
703
- }
704
- /**
705
- * Hook configuration
847
+ * Types and interfaces for useCrudifyWithNotifications
706
848
  */
707
- interface UseFileUploadOptions {
708
- /** Allowed MIME types (e.g., ["image/png", "image/jpeg", "application/pdf"]) */
709
- acceptedTypes?: string[];
710
- /** Maximum file size in bytes (default: 10MB) */
711
- maxFileSize?: number;
712
- /** Maximum number of files (undefined = no limit) */
713
- maxFiles?: number;
714
- /** Minimum number of required files (default: 0) */
715
- minFiles?: number;
716
- /**
717
- * Visibility of uploaded files
718
- * @default "private"
719
- */
720
- visibility?: "public" | "private";
721
- /** Callback when an upload completes successfully */
722
- onUploadComplete?: (file: FileItem) => void;
723
- /** Callback when an upload fails */
724
- onUploadError?: (file: FileItem, error: string) => void;
725
- /** Callback when a file is removed */
726
- onFileRemoved?: (file: FileItem) => void;
727
- /** Callback when the file list changes */
728
- onFilesChange?: (files: FileItem[]) => void;
729
- /** Form mode: 'create' or 'edit' - affects delete behavior */
730
- mode?: "create" | "edit";
731
- }
732
- /**
733
- * Hook return type
734
- */
735
- interface UseFileUploadReturn {
736
- /** Current file list */
737
- files: FileItem[];
738
- /** Active files (excluding pendingDeletion) */
739
- activeFiles: FileItem[];
740
- /** Count of active files */
741
- activeFileCount: number;
742
- /** Whether uploads are in progress */
743
- isUploading: boolean;
744
- /** Number of pending uploads */
745
- pendingCount: number;
746
- /** Add files (triggers automatic upload) */
747
- addFiles: (files: FileList | File[]) => Promise<void>;
748
- /** Remove a file - returns whether confirmation is needed */
749
- removeFile: (fileId: string) => Promise<{
750
- needsConfirmation: boolean;
751
- isExisting: boolean;
752
- }>;
753
- /** Delete a file immediately from server (for new files or create mode) */
754
- deleteFileImmediately: (fileId: string) => Promise<{
755
- success: boolean;
756
- error?: string;
757
- }>;
758
- /** Restore a file that was marked for deletion */
759
- restoreFile: (fileId: string) => boolean;
760
- /** Clear all files */
761
- clearFiles: () => void;
762
- /** Retry upload for a failed file */
763
- retryUpload: (fileId: string) => Promise<void>;
764
- /** Validate if minimum requirements are met */
765
- isValid: boolean;
766
- /** Validation error message (i18n key) */
767
- validationError: string | null;
768
- /** Validation error i18n key */
769
- validationErrorKey: string | null;
770
- /** Validation error params for i18n interpolation */
771
- validationErrorParams: Record<string, string | number>;
772
- /** Wait for all uploads to complete and return completed file paths */
773
- waitForUploads: () => Promise<string[]>;
774
- /**
775
- * Completed file paths (for saving in form)
776
- * Relative paths with visibility - subscriberKey is added in backend
777
- */
778
- completedFilePaths: string[];
779
- /** Initialize with existing files (for editing) */
780
- initializeFiles: (existingFiles: Array<{
781
- filePath: string;
782
- name: string;
783
- size?: number;
784
- contentType?: string;
785
- }>, baseUrl?: string) => void;
786
- /** Whether the user has interacted with the field */
787
- isTouched: boolean;
788
- /** Mark the field as touched (to show validation errors) */
789
- markAsTouched: () => void;
790
- /** Whether the form has been submitted */
791
- isSubmitted: boolean;
792
- /** Mark the form as submitted (to show all validation errors) */
793
- markAsSubmitted: () => void;
794
- /**
795
- * Get URL for file preview
796
- * - Public: returns publicUrl directly
797
- * - Private: requests signed URL from backend
798
- */
799
- getPreviewUrl: (fileId: string) => Promise<string | null>;
800
- /** List of file IDs pending deletion */
801
- pendingDeletions: string[];
802
- /** Whether there are files pending deletion */
803
- hasPendingDeletions: boolean;
804
- /** Execute all pending deletions (call this on form submit) */
805
- commitDeletions: () => Promise<{
806
- success: boolean;
807
- errors: string[];
808
- }>;
809
- /** Cancel all pending deletions and restore files */
810
- restorePendingDeletions: () => void;
811
- }
849
+
812
850
  /**
813
- * Hook for complete file handling with S3 upload
814
- *
815
- * @example
816
- * ```tsx
817
- * const {
818
- * files,
819
- * addFiles,
820
- * removeFile,
821
- * isUploading,
822
- * isValid,
823
- * completedS3Keys
824
- * } = useFileUpload({
825
- * acceptedTypes: ["image/png", "image/jpeg", "application/pdf"],
826
- * maxFileSize: 5 * 1024 * 1024, // 5MB
827
- * maxFiles: 3,
828
- * minFiles: 1
829
- * });
830
- *
831
- * // In form submit
832
- * const handleSubmit = async () => {
833
- * await waitForUploads(); // Wait for pending uploads
834
- * if (!isValid) return;
835
- *
836
- * await crudify.createItem("documents", {
837
- * files: completedS3Keys
838
- * });
839
- * };
840
- * ```
851
+ * App structure action configuration
841
852
  */
842
- declare const useFileUpload: (options?: UseFileUploadOptions) => UseFileUploadReturn;
843
-
844
- /** App structure action configuration */
845
853
  interface AppStructureAction {
846
854
  key: string;
847
855
  moduleKey?: string;
848
856
  [key: string]: unknown;
849
857
  }
858
+ /**
859
+ * Options for the useCrudifyWithNotifications hook
860
+ */
850
861
  interface CrudifyWithNotificationsOptions {
851
862
  showSuccessNotifications?: boolean;
852
863
  showErrorNotifications?: boolean;
@@ -856,6 +867,29 @@ interface CrudifyWithNotificationsOptions {
856
867
  appStructure?: AppStructureAction[];
857
868
  translateFn?: (key: string, options?: Record<string, unknown>) => string;
858
869
  }
870
+
871
+ /**
872
+ * Notification filtering utilities
873
+ *
874
+ * Determines when and which notifications should be shown
875
+ */
876
+
877
+ /**
878
+ * Determines if a notification should be shown for a given response
879
+ *
880
+ * Returns false for:
881
+ * - Field validation errors (these go to form validation)
882
+ * - ONE_OR_MORE_OPERATIONS_FAILED (generic transaction error)
883
+ * - TOO_MANY_REQUESTS (handled by forms)
884
+ */
885
+ declare function shouldShowNotification(response: CrudifyResponse): boolean;
886
+
887
+ /**
888
+ * Hook that wraps crudify SDK operations with automatic notifications
889
+ *
890
+ * @param options - Configuration options
891
+ * @returns Object with wrapped CRUD operations and utility functions
892
+ */
859
893
  declare const useCrudifyWithNotifications: (options?: CrudifyWithNotificationsOptions) => {
860
894
  createItem: (moduleKey: string, data: object, options?: CrudifyOperationOptions) => Promise<CrudifyResponse>;
861
895
  updateItem: (moduleKey: string, data: object, options?: CrudifyOperationOptions) => Promise<CrudifyResponse>;
@@ -866,7 +900,7 @@ declare const useCrudifyWithNotifications: (options?: CrudifyWithNotificationsOp
866
900
  handleResponse: (response: CrudifyResponse, successMessage?: string) => CrudifyResponse;
867
901
  getErrorMessage: (response: CrudifyResponse) => string;
868
902
  getErrorSeverity: (response: CrudifyResponse) => NotificationSeverity;
869
- shouldShowNotification: (response: CrudifyResponse) => boolean;
903
+ shouldShowNotification: typeof shouldShowNotification;
870
904
  };
871
905
 
872
906
  export { type FileItem as F, type LoginResult as L, type NotificationOptions as N, SessionManager as S, TokenStorage as T, type UseSessionOptions as U, type SessionConfig as a, type TokenData as b, type StorageType as c, type SessionState as d, SessionProvider as e, useSessionContext as f, SessionDebugInfo as g, type SessionProviderProps as h, useUserData as i, type UseUserDataReturn as j, type UseUserDataOptions as k, type UserData as l, useAuth as m, type UseAuthReturn as n, useData as o, type UseDataReturn as p, useUserProfile as q, useFileUpload as r, type UseFileUploadOptions as s, type UseFileUploadReturn as t, useSession as u, type FileStatus as v, useCrudifyWithNotifications as w };