@nocios/crudify-components 2.0.81 → 2.0.88
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/README.md +21 -0
- package/dist/api-jcCTCqPD.d.mts +61 -0
- package/dist/api-jcCTCqPD.d.ts +61 -0
- package/dist/chunk-4I767MRM.mjs +142 -0
- package/dist/chunk-5V5ILPP3.js +1 -0
- package/dist/chunk-BJEDX2HU.js +142 -0
- package/dist/chunk-GZOB4JDB.js +1 -0
- package/dist/chunk-ODKXUEH5.js +1 -0
- package/dist/chunk-U335FNUD.mjs +1 -0
- package/dist/chunk-YRU7AXYV.mjs +1 -0
- package/dist/chunk-Z75DRSTN.mjs +1 -0
- package/dist/{errorTranslation-BEWwDbCH.d.ts → errorTranslation-BdqG-dXD.d.ts} +97 -26
- package/dist/{errorTranslation-DsGZon0M.d.mts → errorTranslation-BxJmBGx0.d.mts} +97 -26
- package/dist/hooks.d.mts +3 -4
- package/dist/hooks.d.ts +3 -4
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/{index-ZcF6nJt4.d.mts → index-Cx9P3ZCG.d.mts} +96 -27
- package/dist/{index-Dnmttf62.d.ts → index-rHtWMls-.d.ts} +96 -27
- package/dist/index.d.mts +366 -118
- package/dist/index.d.ts +366 -118
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/public-policies.d.mts +7 -0
- package/dist/public-policies.d.ts +7 -0
- package/dist/public-policies.js +1 -0
- package/dist/public-policies.mjs +1 -0
- package/dist/utils.d.mts +71 -3
- package/dist/utils.d.ts +71 -3
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +44 -42
- package/.github/workflows/ci.yml +0 -70
- package/.husky/pre-commit +0 -26
- package/.husky/pre-push +0 -30
- package/.nvmrc +0 -1
- package/.prettierignore +0 -18
- package/.prettierrc +0 -9
- package/.scannerwork/.sonar_lock +0 -0
- package/.scannerwork/report-task.txt +0 -6
- package/README_DEPTH.md +0 -1237
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/components/CrudiaAutoGenerate.tsx.html +0 -616
- package/coverage/components/CrudiaFileField/CrudiaFileField.tsx.html +0 -1312
- package/coverage/components/CrudiaFileField/components/DeleteConfirmationDialog.tsx.html +0 -355
- package/coverage/components/CrudiaFileField/components/DropZone.tsx.html +0 -523
- package/coverage/components/CrudiaFileField/components/FileItemRow.tsx.html +0 -835
- package/coverage/components/CrudiaFileField/components/FileThumbnail.tsx.html +0 -1585
- package/coverage/components/CrudiaFileField/components/index.html +0 -176
- package/coverage/components/CrudiaFileField/components/index.ts.html +0 -115
- package/coverage/components/CrudiaFileField/hooks/index.html +0 -146
- package/coverage/components/CrudiaFileField/hooks/index.ts.html +0 -112
- package/coverage/components/CrudiaFileField/hooks/useDeleteConfirmation.ts.html +0 -433
- package/coverage/components/CrudiaFileField/hooks/useDragDrop.ts.html +0 -409
- package/coverage/components/CrudiaFileField/index.html +0 -131
- package/coverage/components/CrudiaFileField/index.ts.html +0 -112
- package/coverage/components/CrudiaFileField/utils/formatters.ts.html +0 -169
- package/coverage/components/CrudiaFileField/utils/icons.tsx.html +0 -253
- package/coverage/components/CrudiaFileField/utils/index.html +0 -146
- package/coverage/components/CrudiaFileField/utils/index.ts.html +0 -103
- package/coverage/components/CrudiaMarkdownField.tsx.html +0 -676
- package/coverage/components/CrudifyInitializer.tsx.html +0 -712
- package/coverage/components/CrudifyLogin/Forms/CheckCodeForm.tsx.html +0 -640
- package/coverage/components/CrudifyLogin/Forms/ForgotPasswordForm.tsx.html +0 -730
- package/coverage/components/CrudifyLogin/Forms/LoginForm.tsx.html +0 -892
- package/coverage/components/CrudifyLogin/Forms/ResetPasswordForm.tsx.html +0 -1219
- package/coverage/components/CrudifyLogin/Forms/components/CodeInput.tsx.html +0 -289
- package/coverage/components/CrudifyLogin/Forms/components/FormAlert.tsx.html +0 -202
- package/coverage/components/CrudifyLogin/Forms/components/PasswordInput.tsx.html +0 -346
- package/coverage/components/CrudifyLogin/Forms/components/index.html +0 -161
- package/coverage/components/CrudifyLogin/Forms/components/index.ts.html +0 -106
- package/coverage/components/CrudifyLogin/Forms/index.html +0 -176
- package/coverage/components/CrudifyLogin/Forms/index.ts.html +0 -145
- package/coverage/components/CrudifyLogin/Forms/utils/errorTranslation.ts.html +0 -268
- package/coverage/components/CrudifyLogin/Forms/utils/index.html +0 -161
- package/coverage/components/CrudifyLogin/Forms/utils/index.ts.html +0 -121
- package/coverage/components/CrudifyLogin/Forms/utils/paramUtils.ts.html +0 -496
- package/coverage/components/CrudifyLogin/Forms/utils/validation.ts.html +0 -307
- package/coverage/components/CrudifyLogin/components/CrudifyInitializer.tsx.html +0 -268
- package/coverage/components/CrudifyLogin/components/index.html +0 -116
- package/coverage/components/CrudifyLogin/context/CrudifyProvider.tsx.html +0 -409
- package/coverage/components/CrudifyLogin/context/I18nProvider.tsx.html +0 -430
- package/coverage/components/CrudifyLogin/context/LoginStateProvider.tsx.html +0 -1261
- package/coverage/components/CrudifyLogin/context/index.html +0 -161
- package/coverage/components/CrudifyLogin/context/index.ts.html +0 -91
- package/coverage/components/CrudifyLogin/hooks/index.html +0 -131
- package/coverage/components/CrudifyLogin/hooks/useCrudifyLogin.ts.html +0 -463
- package/coverage/components/CrudifyLogin/hooks/useTranslationsFromUrl.ts.html +0 -391
- package/coverage/components/CrudifyLogin/index.html +0 -116
- package/coverage/components/CrudifyLogin/index.tsx.html +0 -466
- package/coverage/components/CrudifyLogin/utils/index.html +0 -116
- package/coverage/components/CrudifyLogin/utils/secureStorage.ts.html +0 -859
- package/coverage/components/GlobalNotificationProvider.tsx.html +0 -844
- package/coverage/components/LoginComponent.tsx.html +0 -676
- package/coverage/components/PasswordRequirements/index.html +0 -116
- package/coverage/components/PasswordRequirements/index.tsx.html +0 -232
- package/coverage/components/PublicPolicies/FieldSelector/FieldSelector.tsx.html +0 -1078
- package/coverage/components/PublicPolicies/FieldSelector/index.html +0 -131
- package/coverage/components/PublicPolicies/FieldSelector/index.ts.html +0 -88
- package/coverage/components/PublicPolicies/Policies.tsx.html +0 -625
- package/coverage/components/PublicPolicies/PolicyItem/PolicyItem.tsx.html +0 -886
- package/coverage/components/PublicPolicies/PolicyItem/index.html +0 -131
- package/coverage/components/PublicPolicies/PolicyItem/index.ts.html +0 -88
- package/coverage/components/PublicPolicies/constants.ts.html +0 -106
- package/coverage/components/PublicPolicies/index.html +0 -146
- package/coverage/components/PublicPolicies/index.ts.html +0 -88
- package/coverage/components/Routing/AuthRoute.tsx.html +0 -382
- package/coverage/components/Routing/GuestRoute.tsx.html +0 -352
- package/coverage/components/Routing/ProtectedRoute.tsx.html +0 -316
- package/coverage/components/Routing/index.html +0 -161
- package/coverage/components/Routing/index.ts.html +0 -109
- package/coverage/components/SessionLoadingScreen/index.html +0 -116
- package/coverage/components/SessionLoadingScreen/index.tsx.html +0 -379
- package/coverage/components/SessionTimeIndicator/index.html +0 -116
- package/coverage/components/SessionTimeIndicator/index.tsx.html +0 -523
- package/coverage/components/UserProfile/UserProfileDisplay.tsx.html +0 -931
- package/coverage/components/UserProfile/index.html +0 -131
- package/coverage/components/UserProfile/index.ts.html +0 -88
- package/coverage/components/index.html +0 -191
- package/coverage/components/index.ts.html +0 -178
- package/coverage/core/CrossTabSyncManager.ts.html +0 -853
- package/coverage/core/CrudifyInitializationManager.ts.html +0 -1279
- package/coverage/core/SessionManager.ts.html +0 -3064
- package/coverage/core/index.html +0 -146
- package/coverage/coverage-final.json +0 -117
- package/coverage/favicon.png +0 -0
- package/coverage/hooks/index.html +0 -191
- package/coverage/hooks/index.ts.html +0 -136
- package/coverage/hooks/useAuth.ts.html +0 -529
- package/coverage/hooks/useAutoGenerate.ts.html +0 -571
- package/coverage/hooks/useCrudifyWithNotifications/constants.ts.html +0 -247
- package/coverage/hooks/useCrudifyWithNotifications/hooks/index.html +0 -116
- package/coverage/hooks/useCrudifyWithNotifications/hooks/useCrudOperations.ts.html +0 -820
- package/coverage/hooks/useCrudifyWithNotifications/index.html +0 -146
- package/coverage/hooks/useCrudifyWithNotifications/index.ts.html +0 -118
- package/coverage/hooks/useCrudifyWithNotifications/useCrudifyWithNotifications.ts.html +0 -565
- package/coverage/hooks/useCrudifyWithNotifications/utils/errorMessageResolver.ts.html +0 -847
- package/coverage/hooks/useCrudifyWithNotifications/utils/index.html +0 -146
- package/coverage/hooks/useCrudifyWithNotifications/utils/notificationFilters.ts.html +0 -313
- package/coverage/hooks/useCrudifyWithNotifications/utils/successMessageResolver.ts.html +0 -265
- package/coverage/hooks/useData.ts.html +0 -829
- package/coverage/hooks/useFileUpload/index.html +0 -131
- package/coverage/hooks/useFileUpload/index.ts.html +0 -112
- package/coverage/hooks/useFileUpload/services/index.html +0 -131
- package/coverage/hooks/useFileUpload/services/index.ts.html +0 -106
- package/coverage/hooks/useFileUpload/services/uploadService.ts.html +0 -610
- package/coverage/hooks/useFileUpload/useFileUpload.ts.html +0 -2092
- package/coverage/hooks/useFileUpload/utils/fileUtils.ts.html +0 -271
- package/coverage/hooks/useFileUpload/utils/index.html +0 -161
- package/coverage/hooks/useFileUpload/utils/index.ts.html +0 -109
- package/coverage/hooks/useFileUpload/utils/mimeTypes.ts.html +0 -235
- package/coverage/hooks/useFileUpload/utils/validation.ts.html +0 -403
- package/coverage/hooks/useSession/constants.ts.html +0 -217
- package/coverage/hooks/useSession/hooks/index.html +0 -176
- package/coverage/hooks/useSession/hooks/useAuthEventSubscriber.ts.html +0 -331
- package/coverage/hooks/useSession/hooks/useCrossTabSync.ts.html +0 -535
- package/coverage/hooks/useSession/hooks/useSessionActions.ts.html +0 -664
- package/coverage/hooks/useSession/hooks/useSessionState.ts.html +0 -295
- package/coverage/hooks/useSession/hooks/useTokenRefreshScheduler.ts.html +0 -535
- package/coverage/hooks/useSession/index.html +0 -161
- package/coverage/hooks/useSession/index.ts.html +0 -127
- package/coverage/hooks/useSession/types.ts.html +0 -427
- package/coverage/hooks/useSession/useSession.ts.html +0 -526
- package/coverage/hooks/useSession/utils/index.html +0 -131
- package/coverage/hooks/useSession/utils/initializeSession.ts.html +0 -424
- package/coverage/hooks/useSession/utils/tokenUtils.ts.html +0 -298
- package/coverage/hooks/useUserData.ts.html +0 -1210
- package/coverage/hooks/useUserProfile.ts.html +0 -820
- package/coverage/index.html +0 -656
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/components/CrudiaAutoGenerate.tsx.html +0 -616
- package/coverage/lcov-report/components/CrudiaFileField/CrudiaFileField.tsx.html +0 -1312
- package/coverage/lcov-report/components/CrudiaFileField/components/DeleteConfirmationDialog.tsx.html +0 -355
- package/coverage/lcov-report/components/CrudiaFileField/components/DropZone.tsx.html +0 -523
- package/coverage/lcov-report/components/CrudiaFileField/components/FileItemRow.tsx.html +0 -835
- package/coverage/lcov-report/components/CrudiaFileField/components/FileThumbnail.tsx.html +0 -1585
- package/coverage/lcov-report/components/CrudiaFileField/components/index.html +0 -176
- package/coverage/lcov-report/components/CrudiaFileField/components/index.ts.html +0 -115
- package/coverage/lcov-report/components/CrudiaFileField/hooks/index.html +0 -146
- package/coverage/lcov-report/components/CrudiaFileField/hooks/index.ts.html +0 -112
- package/coverage/lcov-report/components/CrudiaFileField/hooks/useDeleteConfirmation.ts.html +0 -433
- package/coverage/lcov-report/components/CrudiaFileField/hooks/useDragDrop.ts.html +0 -409
- package/coverage/lcov-report/components/CrudiaFileField/index.html +0 -131
- package/coverage/lcov-report/components/CrudiaFileField/index.ts.html +0 -112
- package/coverage/lcov-report/components/CrudiaFileField/utils/formatters.ts.html +0 -169
- package/coverage/lcov-report/components/CrudiaFileField/utils/icons.tsx.html +0 -253
- package/coverage/lcov-report/components/CrudiaFileField/utils/index.html +0 -146
- package/coverage/lcov-report/components/CrudiaFileField/utils/index.ts.html +0 -103
- package/coverage/lcov-report/components/CrudiaMarkdownField.tsx.html +0 -676
- package/coverage/lcov-report/components/CrudifyInitializer.tsx.html +0 -712
- package/coverage/lcov-report/components/CrudifyLogin/Forms/CheckCodeForm.tsx.html +0 -640
- package/coverage/lcov-report/components/CrudifyLogin/Forms/ForgotPasswordForm.tsx.html +0 -730
- package/coverage/lcov-report/components/CrudifyLogin/Forms/LoginForm.tsx.html +0 -892
- package/coverage/lcov-report/components/CrudifyLogin/Forms/ResetPasswordForm.tsx.html +0 -1219
- package/coverage/lcov-report/components/CrudifyLogin/Forms/components/CodeInput.tsx.html +0 -289
- package/coverage/lcov-report/components/CrudifyLogin/Forms/components/FormAlert.tsx.html +0 -202
- package/coverage/lcov-report/components/CrudifyLogin/Forms/components/PasswordInput.tsx.html +0 -346
- package/coverage/lcov-report/components/CrudifyLogin/Forms/components/index.html +0 -161
- package/coverage/lcov-report/components/CrudifyLogin/Forms/components/index.ts.html +0 -106
- package/coverage/lcov-report/components/CrudifyLogin/Forms/index.html +0 -176
- package/coverage/lcov-report/components/CrudifyLogin/Forms/index.ts.html +0 -145
- package/coverage/lcov-report/components/CrudifyLogin/Forms/utils/errorTranslation.ts.html +0 -268
- package/coverage/lcov-report/components/CrudifyLogin/Forms/utils/index.html +0 -161
- package/coverage/lcov-report/components/CrudifyLogin/Forms/utils/index.ts.html +0 -121
- package/coverage/lcov-report/components/CrudifyLogin/Forms/utils/paramUtils.ts.html +0 -496
- package/coverage/lcov-report/components/CrudifyLogin/Forms/utils/validation.ts.html +0 -307
- package/coverage/lcov-report/components/CrudifyLogin/components/CrudifyInitializer.tsx.html +0 -268
- package/coverage/lcov-report/components/CrudifyLogin/components/index.html +0 -116
- package/coverage/lcov-report/components/CrudifyLogin/context/CrudifyProvider.tsx.html +0 -409
- package/coverage/lcov-report/components/CrudifyLogin/context/I18nProvider.tsx.html +0 -430
- package/coverage/lcov-report/components/CrudifyLogin/context/LoginStateProvider.tsx.html +0 -1261
- package/coverage/lcov-report/components/CrudifyLogin/context/index.html +0 -161
- package/coverage/lcov-report/components/CrudifyLogin/context/index.ts.html +0 -91
- package/coverage/lcov-report/components/CrudifyLogin/hooks/index.html +0 -131
- package/coverage/lcov-report/components/CrudifyLogin/hooks/useCrudifyLogin.ts.html +0 -463
- package/coverage/lcov-report/components/CrudifyLogin/hooks/useTranslationsFromUrl.ts.html +0 -391
- package/coverage/lcov-report/components/CrudifyLogin/index.html +0 -116
- package/coverage/lcov-report/components/CrudifyLogin/index.tsx.html +0 -466
- package/coverage/lcov-report/components/CrudifyLogin/utils/index.html +0 -116
- package/coverage/lcov-report/components/CrudifyLogin/utils/secureStorage.ts.html +0 -859
- package/coverage/lcov-report/components/GlobalNotificationProvider.tsx.html +0 -844
- package/coverage/lcov-report/components/LoginComponent.tsx.html +0 -676
- package/coverage/lcov-report/components/PasswordRequirements/index.html +0 -116
- package/coverage/lcov-report/components/PasswordRequirements/index.tsx.html +0 -232
- package/coverage/lcov-report/components/PublicPolicies/FieldSelector/FieldSelector.tsx.html +0 -1078
- package/coverage/lcov-report/components/PublicPolicies/FieldSelector/index.html +0 -131
- package/coverage/lcov-report/components/PublicPolicies/FieldSelector/index.ts.html +0 -88
- package/coverage/lcov-report/components/PublicPolicies/Policies.tsx.html +0 -625
- package/coverage/lcov-report/components/PublicPolicies/PolicyItem/PolicyItem.tsx.html +0 -886
- package/coverage/lcov-report/components/PublicPolicies/PolicyItem/index.html +0 -131
- package/coverage/lcov-report/components/PublicPolicies/PolicyItem/index.ts.html +0 -88
- package/coverage/lcov-report/components/PublicPolicies/constants.ts.html +0 -106
- package/coverage/lcov-report/components/PublicPolicies/index.html +0 -146
- package/coverage/lcov-report/components/PublicPolicies/index.ts.html +0 -88
- package/coverage/lcov-report/components/Routing/AuthRoute.tsx.html +0 -382
- package/coverage/lcov-report/components/Routing/GuestRoute.tsx.html +0 -352
- package/coverage/lcov-report/components/Routing/ProtectedRoute.tsx.html +0 -316
- package/coverage/lcov-report/components/Routing/index.html +0 -161
- package/coverage/lcov-report/components/Routing/index.ts.html +0 -109
- package/coverage/lcov-report/components/SessionLoadingScreen/index.html +0 -116
- package/coverage/lcov-report/components/SessionLoadingScreen/index.tsx.html +0 -379
- package/coverage/lcov-report/components/SessionTimeIndicator/index.html +0 -116
- package/coverage/lcov-report/components/SessionTimeIndicator/index.tsx.html +0 -523
- package/coverage/lcov-report/components/UserProfile/UserProfileDisplay.tsx.html +0 -931
- package/coverage/lcov-report/components/UserProfile/index.html +0 -131
- package/coverage/lcov-report/components/UserProfile/index.ts.html +0 -88
- package/coverage/lcov-report/components/index.html +0 -191
- package/coverage/lcov-report/components/index.ts.html +0 -178
- package/coverage/lcov-report/core/CrossTabSyncManager.ts.html +0 -853
- package/coverage/lcov-report/core/CrudifyInitializationManager.ts.html +0 -1279
- package/coverage/lcov-report/core/SessionManager.ts.html +0 -3064
- package/coverage/lcov-report/core/index.html +0 -146
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/hooks/index.html +0 -191
- package/coverage/lcov-report/hooks/index.ts.html +0 -136
- package/coverage/lcov-report/hooks/useAuth.ts.html +0 -529
- package/coverage/lcov-report/hooks/useAutoGenerate.ts.html +0 -571
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/constants.ts.html +0 -247
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/hooks/index.html +0 -116
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/hooks/useCrudOperations.ts.html +0 -820
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/index.html +0 -146
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/index.ts.html +0 -118
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/useCrudifyWithNotifications.ts.html +0 -565
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/utils/errorMessageResolver.ts.html +0 -847
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/utils/index.html +0 -146
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/utils/notificationFilters.ts.html +0 -313
- package/coverage/lcov-report/hooks/useCrudifyWithNotifications/utils/successMessageResolver.ts.html +0 -265
- package/coverage/lcov-report/hooks/useData.ts.html +0 -829
- package/coverage/lcov-report/hooks/useFileUpload/index.html +0 -131
- package/coverage/lcov-report/hooks/useFileUpload/index.ts.html +0 -112
- package/coverage/lcov-report/hooks/useFileUpload/services/index.html +0 -131
- package/coverage/lcov-report/hooks/useFileUpload/services/index.ts.html +0 -106
- package/coverage/lcov-report/hooks/useFileUpload/services/uploadService.ts.html +0 -610
- package/coverage/lcov-report/hooks/useFileUpload/useFileUpload.ts.html +0 -2092
- package/coverage/lcov-report/hooks/useFileUpload/utils/fileUtils.ts.html +0 -271
- package/coverage/lcov-report/hooks/useFileUpload/utils/index.html +0 -161
- package/coverage/lcov-report/hooks/useFileUpload/utils/index.ts.html +0 -109
- package/coverage/lcov-report/hooks/useFileUpload/utils/mimeTypes.ts.html +0 -235
- package/coverage/lcov-report/hooks/useFileUpload/utils/validation.ts.html +0 -403
- package/coverage/lcov-report/hooks/useSession/constants.ts.html +0 -217
- package/coverage/lcov-report/hooks/useSession/hooks/index.html +0 -176
- package/coverage/lcov-report/hooks/useSession/hooks/useAuthEventSubscriber.ts.html +0 -331
- package/coverage/lcov-report/hooks/useSession/hooks/useCrossTabSync.ts.html +0 -535
- package/coverage/lcov-report/hooks/useSession/hooks/useSessionActions.ts.html +0 -664
- package/coverage/lcov-report/hooks/useSession/hooks/useSessionState.ts.html +0 -295
- package/coverage/lcov-report/hooks/useSession/hooks/useTokenRefreshScheduler.ts.html +0 -535
- package/coverage/lcov-report/hooks/useSession/index.html +0 -161
- package/coverage/lcov-report/hooks/useSession/index.ts.html +0 -127
- package/coverage/lcov-report/hooks/useSession/types.ts.html +0 -427
- package/coverage/lcov-report/hooks/useSession/useSession.ts.html +0 -526
- package/coverage/lcov-report/hooks/useSession/utils/index.html +0 -131
- package/coverage/lcov-report/hooks/useSession/utils/initializeSession.ts.html +0 -424
- package/coverage/lcov-report/hooks/useSession/utils/tokenUtils.ts.html +0 -298
- package/coverage/lcov-report/hooks/useUserData.ts.html +0 -1210
- package/coverage/lcov-report/hooks/useUserProfile.ts.html +0 -820
- package/coverage/lcov-report/index.html +0 -656
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/providers/CrudifyThemeProvider.tsx.html +0 -316
- package/coverage/lcov-report/providers/SessionProvider.tsx.html +0 -1120
- package/coverage/lcov-report/providers/TranslationsProvider.tsx.html +0 -1756
- package/coverage/lcov-report/providers/index.html +0 -146
- package/coverage/lcov-report/services/credentialsEventBus.ts.html +0 -319
- package/coverage/lcov-report/services/crudifyAdminWrapper.ts.html +0 -754
- package/coverage/lcov-report/services/index.html +0 -146
- package/coverage/lcov-report/services/translationService.ts.html +0 -1558
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/translations/critical.ts.html +0 -1216
- package/coverage/lcov-report/translations/index.html +0 -116
- package/coverage/lcov-report/types/index.html +0 -116
- package/coverage/lcov-report/types/password.ts.html +0 -178
- package/coverage/lcov-report/utils/authErrorDetector.ts.html +0 -793
- package/coverage/lcov-report/utils/authEventBus.ts.html +0 -454
- package/coverage/lcov-report/utils/configResolver.ts.html +0 -460
- package/coverage/lcov-report/utils/cookieSync.ts.html +0 -595
- package/coverage/lcov-report/utils/errorHandler.ts.html +0 -1480
- package/coverage/lcov-report/utils/errorTranslation.ts.html +0 -868
- package/coverage/lcov-report/utils/index.html +0 -341
- package/coverage/lcov-report/utils/index.ts.html +0 -193
- package/coverage/lcov-report/utils/jwtUtils.ts.html +0 -325
- package/coverage/lcov-report/utils/logger.ts.html +0 -952
- package/coverage/lcov-report/utils/navigationTracker.ts.html +0 -562
- package/coverage/lcov-report/utils/passwordValidation.ts.html +0 -259
- package/coverage/lcov-report/utils/preAuthCheck.ts.html +0 -442
- package/coverage/lcov-report/utils/redirectSecurity.ts.html +0 -733
- package/coverage/lcov-report/utils/tenantConfig.ts.html +0 -712
- package/coverage/lcov-report/utils/tokenStorage.ts.html +0 -1825
- package/coverage/lcov-report/utils/webCrypto.ts.html +0 -490
- package/coverage/lcov.info +0 -23367
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/providers/CrudifyThemeProvider.tsx.html +0 -316
- package/coverage/providers/SessionProvider.tsx.html +0 -1120
- package/coverage/providers/TranslationsProvider.tsx.html +0 -1756
- package/coverage/providers/index.html +0 -146
- package/coverage/services/credentialsEventBus.ts.html +0 -319
- package/coverage/services/crudifyAdminWrapper.ts.html +0 -754
- package/coverage/services/index.html +0 -146
- package/coverage/services/translationService.ts.html +0 -1558
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/translations/critical.ts.html +0 -1216
- package/coverage/translations/index.html +0 -116
- package/coverage/types/index.html +0 -116
- package/coverage/types/password.ts.html +0 -178
- package/coverage/utils/authErrorDetector.ts.html +0 -793
- package/coverage/utils/authEventBus.ts.html +0 -454
- package/coverage/utils/configResolver.ts.html +0 -460
- package/coverage/utils/cookieSync.ts.html +0 -595
- package/coverage/utils/errorHandler.ts.html +0 -1480
- package/coverage/utils/errorTranslation.ts.html +0 -868
- package/coverage/utils/index.html +0 -341
- package/coverage/utils/index.ts.html +0 -193
- package/coverage/utils/jwtUtils.ts.html +0 -325
- package/coverage/utils/logger.ts.html +0 -952
- package/coverage/utils/navigationTracker.ts.html +0 -562
- package/coverage/utils/passwordValidation.ts.html +0 -259
- package/coverage/utils/preAuthCheck.ts.html +0 -442
- package/coverage/utils/redirectSecurity.ts.html +0 -733
- package/coverage/utils/tenantConfig.ts.html +0 -712
- package/coverage/utils/tokenStorage.ts.html +0 -1825
- package/coverage/utils/webCrypto.ts.html +0 -490
- package/dist/CrudiaMarkdownField-DM6NR8zw.d.mts +0 -343
- package/dist/CrudiaMarkdownField-UJaiSq9_.d.ts +0 -343
- package/dist/GlobalNotificationProvider-Cx540WKg.d.mts +0 -96
- package/dist/GlobalNotificationProvider-Cx540WKg.d.ts +0 -96
- package/dist/chunk-2DXLCBOT.mjs +0 -1
- package/dist/chunk-DYRZIARH.js +0 -1
- package/dist/chunk-GCSJXEGT.mjs +0 -1
- package/dist/chunk-GJUZD5ZN.js +0 -1
- package/dist/chunk-K47I475N.js +0 -1
- package/dist/chunk-OCYZGEM5.mjs +0 -1
- package/dist/chunk-PI7HPRDB.js +0 -1
- package/dist/chunk-QVEUGJBY.mjs +0 -1
- package/dist/chunk-UROR7G7N.mjs +0 -1
- package/dist/chunk-XFT47DEL.js +0 -1
- package/dist/components.d.mts +0 -24
- package/dist/components.d.ts +0 -24
- package/dist/components.js +0 -1
- package/dist/components.mjs +0 -1
- package/dist/tenantConfig-DxpfrAof.d.mts +0 -318
- package/dist/tenantConfig-DxpfrAof.d.ts +0 -318
- package/eslint.config.mjs +0 -140
- package/scripts/bump-version.cjs +0 -23
- package/sonar-project.properties +0 -23
- package/tests/helpers/mockFactories.ts +0 -218
- package/tests/helpers/testUtils.tsx +0 -154
- package/tests/hooks/useSession/testUtils.tsx +0 -212
- package/tests/setup.ts +0 -139
- package/tests/vitest.d.ts +0 -1
- package/vitest.config.ts +0 -40
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var k=[/password[^:]*[:=]\s*[^\s,}]+/gi,/token[^:]*[:=]\s*[^\s,}]+/gi,/key[^:]*[:=]\s*["']?[^\s,}"']+/gi,/secret[^:]*[:=]\s*[^\s,}]+/gi,/authorization[^:]*[:=]\s*[^\s,}]+/gi,/mongodb(\+srv)?:\/\/[^\s]+/gi,/postgres:\/\/[^\s]+/gi,/mysql:\/\/[^\s]+/gi],F=e=>e==="prod"||e==="production"||e==="api",V=e=>e instanceof Error?{errorName:e.name,errorMessage:e.message,stack:e.stack}:e,ye=(...e)=>{if(e.length!==0){if(e.length===1&&e[0]instanceof Error){let r=e[0];return{errorName:r.name,errorMessage:r.message,stack:r.stack}}return e.length===1&&typeof e[0]=="object"&&e[0]!==null&&!(e[0]instanceof Error)?e[0]:e.length===1?{value:e[0]}:{args:e.map(r=>r instanceof Error?{errorName:r.name,errorMessage:r.message}:r)}}},O=class{explicitEnvironment=null;config;sanitizePatterns;constructor(e){this.config=e,this.sanitizePatterns=e.sanitizePatterns??k}setEnvironment(e){this.explicitEnvironment=e}clearEnvironment(){this.explicitEnvironment=null}getEnvironment(){return this.explicitEnvironment??this.config.getEnvironment()}isExplicitlyConfigured(){return this.explicitEnvironment!==null}sanitizeMessage(e){let r=e;for(let t of this.sanitizePatterns)r=r.replace(t,"[REDACTED]");return r}sanitizeValue(e,r){if(r!=null){if(e==="userId"&&typeof r=="string")return r.length>8?`${r.substring(0,8)}***`:r;if(e==="email"&&typeof r=="string"){let[t,n]=r.split("@");return t&&n?`${t.substring(0,3)}***@${n}`:"[REDACTED]"}return typeof r=="string"?this.sanitizeMessage(r):Array.isArray(r)?r.map(t=>this.sanitizeValue(e,t)):typeof r=="object"?this.sanitizeContext(r):r}}sanitizeContext(e){let r={};for(let[t,n]of Object.entries(e)){let i=this.sanitizeValue(t,n);i!==void 0&&(r[t]=i)}return r}shouldLog(e){if(this.config.isForcedLogging?.())return!0;let r=this.getEnvironment();return this.config.shouldLogLevel?this.config.shouldLogLevel(e,r):!(F(r)&&e!=="error")}write(e,r,t){if(!this.shouldLog(e))return;let n=this.sanitizeMessage(r),i=t?this.sanitizeContext(t):void 0,a={timestamp:new Date().toISOString(),level:e,environment:this.getEnvironment(),service:this.config.prefix,message:n,...i&&Object.keys(i).length>0&&{context:i}},c=JSON.stringify(a);switch(e){case"error":console.error(c);break;case"warn":console.warn(c);break;case"info":console.info(c);break;case"debug":console.log(c);break}}error(e,r){this.write("error",e,V(r))}warn(e,r){this.write("warn",e,r)}info(e,r){this.write("info",e,r)}debug(e,r){this.write("debug",e,r)}},K=/^[A-Za-z0-9+/_-]+={0,2}$/,M=e=>{let r=e.replaceAll("-","+").replaceAll("_","/"),t=(4-r.length%4)%4;return r+"=".repeat(t)},B=e=>{if(typeof e!="string"||e.length===0)return!1;let r=e.split(".");return r.length!==3?!1:r.every(t=>t.length>0&&K.test(t))},S=e=>{if(!B(e))return null;try{let r=e.split(".")[1];if(!r)return null;let t=atob(M(r)),n=JSON.parse(t);return typeof n!="object"||n===null?null:n}catch{return null}},b=(e,r=Date.now())=>{if(!e||typeof e.exp!="number")return!0;let t=Math.floor(r/1e3);return e.exp<t},C=(e,r)=>{if(!e)return null;for(let t of r){let n=e[t];if(typeof n=="string"&&n.trim()!=="")return n}return null},N="AES-GCM",z=256,$=12,W=16,Y=1e5,h="v2:";async function H(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(a=>a.toString(16).padStart(2,"0")).join("")}async function w(e,r){let t=new TextEncoder,n=await crypto.subtle.importKey("raw",t.encode(e),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:r.buffer,iterations:Y,hash:"SHA-256"},n,{name:N,length:z},!1,["encrypt","decrypt"])}async function j(e,r,t){let n=new TextEncoder,i=crypto.getRandomValues(new Uint8Array($)),a=await crypto.subtle.encrypt({name:N,iv:i},r,n.encode(e)),c=T(i),u=T(t),g=T(new Uint8Array(a));return`${h}${c}:${u}:${g}`}async function G(e,r){if(!e.startsWith(h))return null;try{let t=e.slice(h.length).split(":");if(t.length!==3)return null;let[n,i,a]=t,c=m(n),u=m(i),g=m(a),E=await w(r,u),s=await crypto.subtle.decrypt({name:N,iv:c.buffer},E,g.buffer);return new TextDecoder().decode(s)}catch{return null}}function J(){return crypto.getRandomValues(new Uint8Array(W))}function A(e){return e.startsWith(h)}function T(e){let r="";for(let t of e)r+=String.fromCodePoint(t);return btoa(r)}function m(e){let r=atob(e),t=new Uint8Array(r.length),n=0;for(let i of r)t[n]=i.codePointAt(0)??0,n++;return t}var Re=class{storage;storageVersionKey;saltKey;currentVersion;fingerprintSeed;defaultTokenExpiryMinutes;logger;encryptionKey=null;salt=null;initPromise=null;initialized=!1;constructor(e,r){this.storage=e==="localStorage"?globalThis.localStorage:globalThis.sessionStorage,this.storageVersionKey=`${r.namespace}_storage_version`,this.saltKey=`${r.namespace}_encryption_salt`,this.currentVersion=r.currentVersion??2,this.fingerprintSeed=r.fingerprintSeed,this.defaultTokenExpiryMinutes=r.defaultTokenExpiryMinutes??1440,this.logger=r.logger}logError(e,r){if(this.logger){if(r instanceof Error){this.logger.error(e,r);return}this.logger.error(e,{error:r})}}logWarn(e,r){this.logger&&this.logger.warn(e,r)}async ensureInitialized(){if(!(this.initialized&&this.encryptionKey)){if(this.initPromise){await this.initPromise;return}this.initPromise=this.initialize(),await this.initPromise}}async initialize(){try{Number.parseInt(this.storage.getItem(this.storageVersionKey)??"1",10)<this.currentVersion&&(this.clearLegacyData(),this.storage.setItem(this.storageVersionKey,this.currentVersion.toString()));let r=this.storage.getItem(this.saltKey);r&&A(`v2:x:${r}:x`)?this.salt=this.base64ToUint8Array(r):(this.salt=J(),this.storage.setItem(this.saltKey,this.uint8ArrayToBase64(this.salt)));let t=await this.generateFingerprint();this.encryptionKey=await w(t,this.salt),this.initialized=!0}catch(e){this.logError("SecureStorage initialization failed",e),this.initialized=!1}}async generateFingerprint(){let e=[navigator.userAgent,navigator.language,new Date().getTimezoneOffset().toString(),screen.colorDepth.toString(),screen.width.toString(),screen.height.toString(),this.fingerprintSeed].join("|");return H(e)}clearLegacyData(){let e=[];for(let r=0;r<this.storage.length;r++){let t=this.storage.key(r);t&&!t.startsWith(this.storageVersionKey)&&!t.startsWith(this.saltKey)&&e.push(t)}e.forEach(r=>this.storage.removeItem(r))}async setItem(e,r,t){try{if(await this.ensureInitialized(),!this.encryptionKey||!this.salt){this.logWarn("SecureStorage not properly initialized");return}let n=await j(r,this.encryptionKey,this.salt);if(this.storage.setItem(e,n),typeof t=="number"&&t>0){let i=Date.now()+t*60*1e3;this.storage.setItem(`${e}_expiry`,i.toString())}}catch(n){this.logError("Failed to encrypt and store data",n)}}async getItem(e){try{await this.ensureInitialized();let r=`${e}_expiry`,t=this.storage.getItem(r);if(t){let c=Number.parseInt(t,10);if(Date.now()>c)return this.removeItem(e),null}let n=this.storage.getItem(e);if(!n)return null;if(!A(n))return this.removeItem(e),null;let i=await this.generateFingerprint(),a=await G(n,i);return a||(this.logWarn("Failed to decrypt stored data - may be corrupted"),this.removeItem(e),null)}catch(r){return this.logError("Failed to decrypt data",r),this.removeItem(e),null}}removeItem(e){this.storage.removeItem(e),this.storage.removeItem(`${e}_expiry`)}clear(){this.storage.clear()}async setToken(e){try{let r=e.split(".");if(r.length===3&&r[1]){let t=JSON.parse(atob(r[1]));if(typeof t.exp=="number"){let n=t.exp*1e3,i=Date.now(),a=Math.floor((n-i)/(60*1e3));if(a>0){await this.setItem("authToken",e,a);return}}}}catch{this.logWarn("Failed to parse token expiry, using default expiry")}await this.setItem("authToken",e,this.defaultTokenExpiryMinutes)}async getToken(){let e=await this.getItem("authToken");if(e)try{let r=e.split(".");if(r.length===3&&r[1]){let t=JSON.parse(atob(r[1]));if(typeof t.exp=="number"){let n=Math.floor(Date.now()/1e3);if(t.exp<n)return this.removeItem("authToken"),null}}}catch{return this.logWarn("Failed to validate token expiry"),this.removeItem("authToken"),null}return e}async hasValidToken(){return await this.getToken()!==null}async migrateFromLocalStorage(e){let r=globalThis.localStorage.getItem(e);r&&(globalThis.localStorage.removeItem(e),e==="authToken"?await this.setToken(r):await this.setItem(e,r))}uint8ArrayToBase64(e){let r="";for(let t of e)r+=String.fromCodePoint(t);return btoa(r)}base64ToUint8Array(e){let r=atob(e),t=new Uint8Array(r.length),n=0;for(let i of r)t[n]=i.codePointAt(0)??0,n++;return t}};function Q(){if(globalThis.window===void 0)return"prod";let e=globalThis.window.__TENANT_CONFIG__;return e?.environment&&["dev","stg","api","prod"].includes(e.environment)?e.environment:globalThis.window.__CRUDIFY_ENV__?globalThis.window.__CRUDIFY_ENV__:"prod"}var y=null,I=class{core;constructor(){this.core=new O({prefix:"CrudifyUI",getEnvironment:()=>y??Q(),isForcedLogging:()=>globalThis.window?.__CRUDIFY_DEBUG_MODE__===!0}),y&&this.core.setEnvironment(y)}error(r,t){this.core.error(r,t)}warn(r,t){this.core.warn(r,t)}info(r,t){this.core.info(r,t)}debug(r,t){this.core.debug(r,t)}getEnvironment(){return this.core.getEnvironment()}setEnvironment(r){if(this.core.setEnvironment(r),y=r,globalThis.window!==void 0){let t=["dev","stg","api","prod"];globalThis.window.__CRUDIFY_ENV__=t.includes(r)?r:void 0}}isExplicitlyConfigured(){return this.core.isExplicitlyConfigured()}},l=new I;var q=new Set(["dev","stg","api","prod"]);function Z(e){return!!e&&q.has(e)}function X(){if(globalThis.window===void 0)return null;let e=globalThis.window.__TENANT_CONFIG__;return e?.publicApiKey?e:null}function v(e={}){let{publicApiKey:r,env:t,appName:n,logo:i,loginActions:a,featureKeys:c,theme:u,enabledServices:g,enableDebug:E=!1}=e,s=X();if(s){E&&l.info("[TenantConfig] Using INJECTED configuration (Lambda@Edge)",{hasApiKey:!!s.publicApiKey,environment:s.environment,hasAppName:!!s.appName,hasLogo:!!s.logo,loginActionsCount:s.loginActions?.length,featureKeysCount:s.featureKeys?.length,hasTheme:!!s.theme});let d=Z(s.environment)?s.environment:"prod";return{publicApiKey:s.publicApiKey,environment:d,appName:s.appName,logo:s.logo,loginActions:s.loginActions,featureKeys:s.featureKeys,theme:s.theme,enabledServices:s.enabledServices,configSource:"injected"}}return r?(E&&l.info("[TenantConfig] Using PROPS configuration (development)",{environment:t,hasAppName:!!n,hasLogo:!!i,loginActionsCount:a?.length,featureKeysCount:c?.length,hasTheme:!!u}),{publicApiKey:r,environment:t||"prod",appName:n,logo:i,loginActions:a,featureKeys:c,theme:u,enabledServices:g,configSource:"props"}):(E&&l.error("[TenantConfig] No configuration found! Ensure Lambda@Edge injects window.__TENANT_CONFIG__ (production) or provide props (development)."),{configSource:"none"})}function Ae(e={}){return v(e)}function ee(e){return e==="injected"?"cookies":e}function re(e={}){let r={publicApiKey:e.publicApiKey,env:e.env,appName:e.appName,logo:e.logo,loginActions:e.loginActions,featureKeys:e.featureKeys,enableDebug:e.enableDebug},t=v(r),n={publicApiKey:t.publicApiKey,env:t.environment,appName:t.appName,logo:t.logo,loginActions:t.loginActions,featureKeys:t.featureKeys,theme:t.theme,configSource:ee(t.configSource)};return e.enableDebug&&globalThis.window!==void 0&&(globalThis.window.__CRUDIFY_RESOLVED_CONFIG=n),n}function be(e={}){return re(e)}var _=class e{static instance;listeners=new Set;isHandlingAuthError=!1;lastErrorTime=0;lastEventType=null;DEBOUNCE_TIME=1e3;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}emit(r,t){let n=Date.now();if(this.isHandlingAuthError&&this.lastEventType===r&&n-this.lastErrorTime<this.DEBOUNCE_TIME){l.debug(`AuthEventBus: Ignoring duplicate ${r} event (debounced)`);return}this.isHandlingAuthError=!0,this.lastErrorTime=n,this.lastEventType=r,l.debug(`AuthEventBus: Emitting ${r} event`,t?{details:t}:void 0);let i={type:r,details:t,timestamp:n};this.listeners.forEach(a=>{try{a(i)}catch(c){l.error("AuthEventBus: Error in listener",c instanceof Error?c:{message:String(c)})}}),setTimeout(()=>{this.isHandlingAuthError=!1,this.lastEventType=null},2e3)}subscribe(r){return this.listeners.add(r),()=>{this.listeners.delete(r)}}clear(){this.listeners.clear(),this.isHandlingAuthError=!1,this.lastEventType=null}isHandling(){return this.isHandlingAuthError}},De=_.getInstance();var te=["errors.{category}.{code}","errors.{code}","login.{code}","error.{code}","messages.{code}","{code}"],ne={INVALID_CREDENTIALS:"auth",UNAUTHORIZED:"auth",INVALID_API_KEY:"auth",USER_NOT_FOUND:"auth",USER_NOT_ACTIVE:"auth",NO_PERMISSION:"auth",SESSION_EXPIRED:"auth",ITEM_NOT_FOUND:"data",NOT_FOUND:"data",IN_USE:"data",DUPLICATE_ENTRY:"data",FIELD_ERROR:"validation",BAD_REQUEST:"validation",INVALID_EMAIL:"validation",INVALID_CODE:"validation",REQUIRED_FIELD:"validation",INTERNAL_SERVER_ERROR:"system",DATABASE_CONNECTION_ERROR:"system",INVALID_CONFIGURATION:"system",UNKNOWN_OPERATION:"system",TIMEOUT_ERROR:"system",NETWORK_ERROR:"system",TOO_MANY_REQUESTS:"rate_limit"},oe={INVALID_CREDENTIALS:"Invalid username or password",UNAUTHORIZED:"You are not authorized to perform this action",SESSION_EXPIRED:"Your session has expired. Please log in again.",USER_NOT_FOUND:"User not found",ITEM_NOT_FOUND:"Item not found",FIELD_ERROR:"Invalid field value",INTERNAL_SERVER_ERROR:"An internal error occurred",NETWORK_ERROR:"Network connection error",TIMEOUT_ERROR:"Request timeout",UNKNOWN_OPERATION:"Unknown operation",INVALID_EMAIL:"Invalid email format",INVALID_CODE:"Invalid code",TOO_MANY_REQUESTS:"Too many requests, please try again later"};function f(e,r){let{translateFn:t,currentLanguage:n,enableDebug:i}=r;i&&l.debug(`[ErrorTranslation] Translating error code: ${e} (lang: ${n||"unknown"})`);let a=e.toUpperCase(),c=ne[a],u=te.map(s=>s.replace("{category}",c||"general").replace("{code}",a));i&&l.debug("[ErrorTranslation] Searching keys:",{translationKeys:u});for(let s of u){let d=t(s);if(i&&l.debug(`[ErrorTranslation] Checking key: "${s}" -> result: "${d}" (same as key: ${d===s})`),d&&d!==s)return i&&l.debug(`[ErrorTranslation] Found translation at key: ${s} = "${d}"`),d}let g=oe[a];if(g)return i&&l.debug(`[ErrorTranslation] Using default message: "${g}"`),g;let E=a.replaceAll("_"," ").toLowerCase().replaceAll(/\b\w/g,s=>s.toUpperCase());return i&&l.debug(`[ErrorTranslation] No translation found, using friendly code: "${E}"`),E}function ie(e,r){return e.map(t=>f(t,r))}function se(e,r){let{enableDebug:t}=r;t&&l.debug("[ErrorTranslation] Translating error:",{error:e});let n=f(e.code,r);return n!==e.code.toUpperCase()&&n!==e.code?(t&&l.debug(`[ErrorTranslation] Using hierarchical translation: "${n}"`),e.field?`${e.field}: ${n}`:n):e.message&&!e.message.includes("Error:")&&e.message.length>0&&e.message!==e.code?(t&&l.debug(`[ErrorTranslation] No hierarchical translation found, using API message: "${e.message}"`),e.message):(t&&l.debug(`[ErrorTranslation] Using final fallback: "${n}"`),e.field?`${e.field}: ${n}`:n)}function Pe(e,r={}){let t={translateFn:e,currentLanguage:r.currentLanguage,enableDebug:r.enableDebug||!1};return{translateErrorCode:n=>f(n,t),translateErrorCodes:n=>ie(n,t),translateError:n=>se(n,t),translateApiError:n=>n?.data?.response?.status?f(n.data.response.status,t):n?.status?f(n.status,t):n?.code?f(n.code,t):"Unknown error"}}var D=class e{static instance=null;isPatched=!1;refCount=0;listeners=new Set;originalPushState;originalReplaceState;constructor(){this.originalPushState=globalThis.history.pushState,this.originalReplaceState=globalThis.history.replaceState}static getInstance(){return e.instance??=new e,e.instance}subscribe(r){return this.listeners.add(r),this.refCount++,this.isPatched||this.applyPatches(),()=>{this.unsubscribe(r)}}unsubscribe(r){this.listeners.delete(r),this.refCount--,this.refCount===0&&this.isPatched&&this.removePatches()}applyPatches(){globalThis.history.pushState=(...r)=>{let t=this.originalPushState.apply(globalThis.history,r);return this.notifyListeners(),t},globalThis.history.replaceState=(...r)=>{let t=this.originalReplaceState.apply(globalThis.history,r);return this.notifyListeners(),t},this.isPatched=!0}removePatches(){globalThis.history.pushState=this.originalPushState,globalThis.history.replaceState=this.originalReplaceState,this.isPatched=!1}notifyListeners(){this.listeners.forEach(r=>{try{r()}catch(t){l.error("NavigationTracker: Error in navigation listener",t instanceof Error?t:{message:String(t)})}})}static reset(){e.instance?.isPatched&&e.instance.removePatches(),e.instance=null}getSubscriberCount(){return this.refCount}isActive(){return this.isPatched}};var U=e=>{let r=S(e);return r||(l.warn("Invalid JWT format: token must have 3 parts"),null)},Me=()=>{try{let e=null;if(e=sessionStorage.getItem("authToken"),e||(e=sessionStorage.getItem("token")),e||(e=localStorage.getItem("authToken")||localStorage.getItem("token")),!e)return null;let r=U(e);return r?C(r,["email","cognito:username"]):null}catch(e){return l.warn("Failed to get current user email",e instanceof Error?{errorMessage:e.message}:{message:String(e)}),null}},Be=e=>{let r=U(e);return b(r)};var o={INVALID_CREDENTIALS:"INVALID_CREDENTIALS",UNAUTHORIZED:"UNAUTHORIZED",INVALID_API_KEY:"INVALID_API_KEY",USER_NOT_FOUND:"USER_NOT_FOUND",USER_NOT_ACTIVE:"USER_NOT_ACTIVE",NO_PERMISSION:"NO_PERMISSION",ITEM_NOT_FOUND:"ITEM_NOT_FOUND",NOT_FOUND:"NOT_FOUND",IN_USE:"IN_USE",FIELD_ERROR:"FIELD_ERROR",BAD_REQUEST:"BAD_REQUEST",INVALID_EMAIL:"INVALID_EMAIL",INVALID_CODE:"INVALID_CODE",INTERNAL_SERVER_ERROR:"INTERNAL_SERVER_ERROR",DATABASE_CONNECTION_ERROR:"DATABASE_CONNECTION_ERROR",INVALID_CONFIGURATION:"INVALID_CONFIGURATION",UNKNOWN_OPERATION:"UNKNOWN_OPERATION",TOO_MANY_REQUESTS:"TOO_MANY_REQUESTS",NETWORK_ERROR:"NETWORK_ERROR",TIMEOUT_ERROR:"TIMEOUT_ERROR"},R={[o.INVALID_CREDENTIALS]:"warning",[o.UNAUTHORIZED]:"warning",[o.INVALID_API_KEY]:"error",[o.USER_NOT_FOUND]:"warning",[o.USER_NOT_ACTIVE]:"warning",[o.NO_PERMISSION]:"warning",[o.ITEM_NOT_FOUND]:"info",[o.NOT_FOUND]:"info",[o.IN_USE]:"warning",[o.FIELD_ERROR]:"warning",[o.BAD_REQUEST]:"warning",[o.INVALID_EMAIL]:"warning",[o.INVALID_CODE]:"warning",[o.INTERNAL_SERVER_ERROR]:"error",[o.DATABASE_CONNECTION_ERROR]:"error",[o.INVALID_CONFIGURATION]:"error",[o.UNKNOWN_OPERATION]:"error",[o.TOO_MANY_REQUESTS]:"warning",[o.NETWORK_ERROR]:"error",[o.TIMEOUT_ERROR]:"error"};function ae(e){let r=[];return Object.entries(e).forEach(([t,n])=>{Array.isArray(n)&&n.length>0&&r.push({code:o.FIELD_ERROR,message:n[0],severity:"warning",field:t})}),r}function le(e){let r=e;return R[r]?{code:r,message:p(r),severity:R[r]}:null}function ce(e){if(!e.data||typeof e.data!="object")return[];let r=e.data;if(!r.response)return[];let t=[],{status:n,fieldsWarning:i}=r.response;if(i&&typeof i=="object"&&t.push(...ae(i)),n&&typeof n=="string"){let a=le(n);a&&t.push(a)}return t}function L(e){return e.map(r=>{let t=typeof r=="string"&&x(r)?r:o.BAD_REQUEST;return{code:t,message:typeof r=="string"?r:p(t),severity:R[t]||"warning"}})}function ue(e){let r=[];return e.forEach(t=>{if(typeof t=="string"){let n=x(t)?t:o.BAD_REQUEST;r.push({code:n,message:p(n),severity:R[n]||"warning"})}}),r}function ge(e,r){return{code:o.FIELD_ERROR,message:typeof r[0]=="string"?r[0]:"Validation error",severity:"warning",field:e}}function Ee(e){let r=[];return Object.entries(e).forEach(([t,n])=>{!Array.isArray(n)||n.length===0||(t==="_error"?r.push(...L(n)):t==="_graphql"?r.push(...ue(n)):r.push(ge(t,n)))}),r}function de(e){return e.errors?typeof e.errors=="string"?[{code:o.BAD_REQUEST,message:e.errors,severity:"warning"}]:Array.isArray(e.errors)?L(e.errors):typeof e.errors=="object"?Ee(e.errors):[]:[]}function P(e){let r=[];try{let t=e;r.push(...ce(t),...de(t)),r.length===0&&t.success===!1&&r.push({code:o.BAD_REQUEST,message:"Request failed",severity:"warning"})}catch(t){r.push({code:o.INTERNAL_SERVER_ERROR,message:"Failed to parse error response",severity:"error",details:{originalError:t}})}return r.length>0?r:[{code:o.INTERNAL_SERVER_ERROR,message:"Unknown error occurred",severity:"error"}]}function fe(e){try{let r=e;if(r.data&&Array.isArray(r.data)){let t=[];return r.data.forEach((n,i)=>{n.response?.status==="TOO_MANY_REQUESTS"?t.push({code:o.TOO_MANY_REQUESTS,message:p(o.TOO_MANY_REQUESTS),severity:"warning",details:{transactionIndex:i}}):n.response?.status!=="OK"&&t.push({code:o.BAD_REQUEST,message:"Transaction failed",severity:"warning",details:{transactionIndex:i,response:n.response}})}),t}return P(e)}catch(r){return[{code:o.INTERNAL_SERVER_ERROR,message:"Failed to parse transaction error",severity:"error",details:{originalError:r}}]}}function x(e){return Object.values(o).includes(e)}function p(e){return{[o.INVALID_CREDENTIALS]:"Invalid email or password",[o.UNAUTHORIZED]:"You are not authorized to perform this action",[o.INVALID_API_KEY]:"Invalid API key",[o.USER_NOT_FOUND]:"User not found",[o.USER_NOT_ACTIVE]:"User account is not active",[o.NO_PERMISSION]:"You do not have permission to perform this action",[o.ITEM_NOT_FOUND]:"Item not found",[o.NOT_FOUND]:"Resource not found",[o.IN_USE]:"Resource is currently in use",[o.FIELD_ERROR]:"Validation error",[o.BAD_REQUEST]:"Invalid request",[o.INVALID_EMAIL]:"Please enter a valid email address",[o.INVALID_CODE]:"Invalid or expired code",[o.INTERNAL_SERVER_ERROR]:"Internal server error",[o.DATABASE_CONNECTION_ERROR]:"Database connection error",[o.INVALID_CONFIGURATION]:"Invalid configuration",[o.UNKNOWN_OPERATION]:"Unknown operation",[o.TOO_MANY_REQUESTS]:"Too many requests. Please try again later.",[o.NETWORK_ERROR]:"Network error. Please check your connection.",[o.TIMEOUT_ERROR]:"Request timed out. Please try again."}[e]||"An unknown error occurred"}function pe(e){return e instanceof Error?e.name==="AbortError"?{code:o.TIMEOUT_ERROR,message:"Request was cancelled",severity:"info"}:e.message.includes("NetworkError")||e.message.includes("Failed to fetch")?{code:o.NETWORK_ERROR,message:p(o.NETWORK_ERROR),severity:"error"}:{code:o.INTERNAL_SERVER_ERROR,message:e.message||"An unexpected error occurred",severity:"error",details:{originalError:e}}:{code:o.INTERNAL_SERVER_ERROR,message:"An unknown error occurred",severity:"error",details:{originalError:e}}}function he(e){if(!(!e||typeof e!="object"))return Reflect.get(e,"data")}function $e(e){if(e instanceof Error)return[pe(e)];if(typeof e=="object"&&e!==null){let r=he(e);return Array.isArray(r)?fe(e):P(e)}return[{code:o.INTERNAL_SERVER_ERROR,message:"An unknown error occurred",severity:"error",details:{originalError:e}}]}export{ye as a,O as b,H as c,w as d,j as e,G as f,J as g,A as h,Re as i,l as j,v as k,Ae as l,re as m,be as n,De as o,f as p,ie as q,se as r,Pe as s,D as t,U as u,Me as v,Be as w,o as x,R as y,P as z,fe as A,p as B,pe as C,$e as D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as t,j as o}from"./chunk-YRU7AXYV.mjs";var g={error:(e,r)=>{if(r instanceof Error){o.error(e,r);return}if(typeof r=="object"&&r!==null){o.error(e,r);return}o.error(e)},warn:(e,r)=>{if(typeof r=="object"&&r!==null){o.warn(e,r);return}o.warn(e)}},n=class extends t{constructor(r="sessionStorage"){super(r,{namespace:"crudify_login",fingerprintSeed:"crudify-login",logger:g})}},i=new n("sessionStorage"),u=new n("localStorage");export{i as a,u as b};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { J as JwtPayload } from './
|
|
1
|
+
import { J as JwtPayload } from './api-jcCTCqPD.js';
|
|
2
|
+
import { FrontendEnvironment } from '@nocios/frontend-types';
|
|
3
|
+
import { SecureStorage as SecureStorage$1 } from '@nocios/frontend-types/shared';
|
|
2
4
|
|
|
3
5
|
interface JWTPayload extends JwtPayload {
|
|
4
6
|
'cognito:username'?: string;
|
|
@@ -7,31 +9,100 @@ declare const decodeJwtSafely: (token: string) => JWTPayload | null;
|
|
|
7
9
|
declare const getCurrentUserEmail: () => string | null;
|
|
8
10
|
declare const isTokenExpired: (token: string) => boolean;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Centralized tenant configuration system for crudify-components
|
|
14
|
+
*
|
|
15
|
+
* This module provides a unified way to access tenant configuration
|
|
16
|
+
* that is injected by Lambda@Edge in production or provided via props
|
|
17
|
+
* in development.
|
|
18
|
+
*
|
|
19
|
+
* PRIORITY:
|
|
20
|
+
* 1. window.__TENANT_CONFIG__ (production - injected by Lambda@Edge)
|
|
21
|
+
* 2. Props (development - from .env variables)
|
|
22
|
+
* 3. Error (no configuration available)
|
|
23
|
+
*
|
|
24
|
+
* This replaces the cookie-based system to avoid race conditions
|
|
25
|
+
* where cookies from Set-Cookie headers are not immediately available
|
|
26
|
+
* to JavaScript on the first page load.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
type CrudifyEnvironment = FrontendEnvironment;
|
|
30
|
+
interface ResolvedTenantConfig {
|
|
31
|
+
publicApiKey?: string;
|
|
32
|
+
environment?: FrontendEnvironment;
|
|
33
|
+
appName?: string;
|
|
34
|
+
logo?: string;
|
|
35
|
+
loginActions?: string[];
|
|
36
|
+
featureKeys?: string[];
|
|
37
|
+
theme?: Record<string, unknown>;
|
|
38
|
+
enabledServices?: string[];
|
|
39
|
+
configSource: 'injected' | 'props' | 'none';
|
|
40
|
+
}
|
|
41
|
+
interface TenantConfigOptions {
|
|
42
|
+
publicApiKey?: string;
|
|
43
|
+
env?: FrontendEnvironment;
|
|
44
|
+
appName?: string;
|
|
45
|
+
logo?: string;
|
|
46
|
+
loginActions?: string[];
|
|
47
|
+
featureKeys?: string[];
|
|
48
|
+
theme?: Record<string, unknown>;
|
|
49
|
+
enabledServices?: string[];
|
|
50
|
+
enableDebug?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolves tenant configuration with the following priority:
|
|
54
|
+
* 1. window.__TENANT_CONFIG__ (production - injected by Lambda@Edge) - HIGHEST PRIORITY
|
|
55
|
+
* 2. Props (development - from .env variables) - FALLBACK
|
|
56
|
+
* 3. None (error - no configuration available)
|
|
57
|
+
*
|
|
58
|
+
* @param options - Configuration options including props for development
|
|
59
|
+
* @returns Resolved configuration with source indicator
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // In production (Lambda@Edge injects window.__TENANT_CONFIG__)
|
|
64
|
+
* const config = resolveTenantConfig();
|
|
65
|
+
* console.log(config.publicApiKey); // From injected config
|
|
66
|
+
* console.log(config.configSource); // "injected"
|
|
67
|
+
*
|
|
68
|
+
* // In development (with .env variables)
|
|
69
|
+
* const config = resolveTenantConfig({
|
|
70
|
+
* publicApiKey: import.meta.env.VITE_PUBLIC_API_KEY,
|
|
71
|
+
* env: import.meta.env.VITE_ENV,
|
|
72
|
+
* });
|
|
73
|
+
* console.log(config.configSource); // "props"
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function resolveTenantConfig(options?: TenantConfigOptions): ResolvedTenantConfig;
|
|
77
|
+
/**
|
|
78
|
+
* React hook to access tenant configuration
|
|
79
|
+
*
|
|
80
|
+
* @param options - Configuration options
|
|
81
|
+
* @returns Resolved tenant configuration
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* function MyComponent() {
|
|
86
|
+
* const config = useTenantConfig();
|
|
87
|
+
*
|
|
88
|
+
* if (config.configSource === "none") {
|
|
89
|
+
* return <Error>No configuration available</Error>;
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* return <div>API Key: {config.publicApiKey}</div>;
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
declare function useTenantConfig(options?: TenantConfigOptions): ResolvedTenantConfig;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* SecureStorage wrapper for CrudifyLogin.
|
|
100
|
+
*
|
|
101
|
+
* Implementation is centralized in @nocios/frontend-types/shared.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
declare class SecureStorage extends SecureStorage$1 {
|
|
16
105
|
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
106
|
}
|
|
36
107
|
declare const secureSessionStorage: SecureStorage;
|
|
37
108
|
declare const secureLocalStorage: SecureStorage;
|
|
@@ -138,4 +209,4 @@ declare function createErrorTranslator(translateFn: (key: string) => string, opt
|
|
|
138
209
|
} | null | undefined) => string;
|
|
139
210
|
};
|
|
140
211
|
|
|
141
|
-
export { ERROR_CODES as E, type ParsedError as P, ERROR_SEVERITY_MAP as a, type ErrorCode as b, type ErrorSeverity as c, type ErrorTranslationConfig as d, createErrorTranslator as e, decodeJwtSafely as f, getCurrentUserEmail as g, getErrorMessage as h, handleCrudifyError as i, isTokenExpired as j, parseJavaScriptError as k, parseTransactionError as l, secureSessionStorage as m, translateErrorCode as n, translateErrorCodes as o, parseApiError as p, secureLocalStorage as s, translateError as t };
|
|
212
|
+
export { type CrudifyEnvironment as C, ERROR_CODES as E, type ParsedError as P, type ResolvedTenantConfig as R, type TenantConfigOptions as T, ERROR_SEVERITY_MAP as a, type ErrorCode as b, type ErrorSeverity as c, type ErrorTranslationConfig as d, createErrorTranslator as e, decodeJwtSafely as f, getCurrentUserEmail as g, getErrorMessage as h, handleCrudifyError as i, isTokenExpired as j, parseJavaScriptError as k, parseTransactionError as l, secureSessionStorage as m, translateErrorCode as n, translateErrorCodes as o, parseApiError as p, resolveTenantConfig as r, secureLocalStorage as s, translateError as t, useTenantConfig as u };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { J as JwtPayload } from './
|
|
1
|
+
import { J as JwtPayload } from './api-jcCTCqPD.mjs';
|
|
2
|
+
import { FrontendEnvironment } from '@nocios/frontend-types';
|
|
3
|
+
import { SecureStorage as SecureStorage$1 } from '@nocios/frontend-types/shared';
|
|
2
4
|
|
|
3
5
|
interface JWTPayload extends JwtPayload {
|
|
4
6
|
'cognito:username'?: string;
|
|
@@ -7,31 +9,100 @@ declare const decodeJwtSafely: (token: string) => JWTPayload | null;
|
|
|
7
9
|
declare const getCurrentUserEmail: () => string | null;
|
|
8
10
|
declare const isTokenExpired: (token: string) => boolean;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Centralized tenant configuration system for crudify-components
|
|
14
|
+
*
|
|
15
|
+
* This module provides a unified way to access tenant configuration
|
|
16
|
+
* that is injected by Lambda@Edge in production or provided via props
|
|
17
|
+
* in development.
|
|
18
|
+
*
|
|
19
|
+
* PRIORITY:
|
|
20
|
+
* 1. window.__TENANT_CONFIG__ (production - injected by Lambda@Edge)
|
|
21
|
+
* 2. Props (development - from .env variables)
|
|
22
|
+
* 3. Error (no configuration available)
|
|
23
|
+
*
|
|
24
|
+
* This replaces the cookie-based system to avoid race conditions
|
|
25
|
+
* where cookies from Set-Cookie headers are not immediately available
|
|
26
|
+
* to JavaScript on the first page load.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
type CrudifyEnvironment = FrontendEnvironment;
|
|
30
|
+
interface ResolvedTenantConfig {
|
|
31
|
+
publicApiKey?: string;
|
|
32
|
+
environment?: FrontendEnvironment;
|
|
33
|
+
appName?: string;
|
|
34
|
+
logo?: string;
|
|
35
|
+
loginActions?: string[];
|
|
36
|
+
featureKeys?: string[];
|
|
37
|
+
theme?: Record<string, unknown>;
|
|
38
|
+
enabledServices?: string[];
|
|
39
|
+
configSource: 'injected' | 'props' | 'none';
|
|
40
|
+
}
|
|
41
|
+
interface TenantConfigOptions {
|
|
42
|
+
publicApiKey?: string;
|
|
43
|
+
env?: FrontendEnvironment;
|
|
44
|
+
appName?: string;
|
|
45
|
+
logo?: string;
|
|
46
|
+
loginActions?: string[];
|
|
47
|
+
featureKeys?: string[];
|
|
48
|
+
theme?: Record<string, unknown>;
|
|
49
|
+
enabledServices?: string[];
|
|
50
|
+
enableDebug?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolves tenant configuration with the following priority:
|
|
54
|
+
* 1. window.__TENANT_CONFIG__ (production - injected by Lambda@Edge) - HIGHEST PRIORITY
|
|
55
|
+
* 2. Props (development - from .env variables) - FALLBACK
|
|
56
|
+
* 3. None (error - no configuration available)
|
|
57
|
+
*
|
|
58
|
+
* @param options - Configuration options including props for development
|
|
59
|
+
* @returns Resolved configuration with source indicator
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // In production (Lambda@Edge injects window.__TENANT_CONFIG__)
|
|
64
|
+
* const config = resolveTenantConfig();
|
|
65
|
+
* console.log(config.publicApiKey); // From injected config
|
|
66
|
+
* console.log(config.configSource); // "injected"
|
|
67
|
+
*
|
|
68
|
+
* // In development (with .env variables)
|
|
69
|
+
* const config = resolveTenantConfig({
|
|
70
|
+
* publicApiKey: import.meta.env.VITE_PUBLIC_API_KEY,
|
|
71
|
+
* env: import.meta.env.VITE_ENV,
|
|
72
|
+
* });
|
|
73
|
+
* console.log(config.configSource); // "props"
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function resolveTenantConfig(options?: TenantConfigOptions): ResolvedTenantConfig;
|
|
77
|
+
/**
|
|
78
|
+
* React hook to access tenant configuration
|
|
79
|
+
*
|
|
80
|
+
* @param options - Configuration options
|
|
81
|
+
* @returns Resolved tenant configuration
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* function MyComponent() {
|
|
86
|
+
* const config = useTenantConfig();
|
|
87
|
+
*
|
|
88
|
+
* if (config.configSource === "none") {
|
|
89
|
+
* return <Error>No configuration available</Error>;
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* return <div>API Key: {config.publicApiKey}</div>;
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
declare function useTenantConfig(options?: TenantConfigOptions): ResolvedTenantConfig;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* SecureStorage wrapper for CrudifyLogin.
|
|
100
|
+
*
|
|
101
|
+
* Implementation is centralized in @nocios/frontend-types/shared.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
declare class SecureStorage extends SecureStorage$1 {
|
|
16
105
|
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
106
|
}
|
|
36
107
|
declare const secureSessionStorage: SecureStorage;
|
|
37
108
|
declare const secureLocalStorage: SecureStorage;
|
|
@@ -138,4 +209,4 @@ declare function createErrorTranslator(translateFn: (key: string) => string, opt
|
|
|
138
209
|
} | null | undefined) => string;
|
|
139
210
|
};
|
|
140
211
|
|
|
141
|
-
export { ERROR_CODES as E, type ParsedError as P, ERROR_SEVERITY_MAP as a, type ErrorCode as b, type ErrorSeverity as c, type ErrorTranslationConfig as d, createErrorTranslator as e, decodeJwtSafely as f, getCurrentUserEmail as g, getErrorMessage as h, handleCrudifyError as i, isTokenExpired as j, parseJavaScriptError as k, parseTransactionError as l, secureSessionStorage as m, translateErrorCode as n, translateErrorCodes as o, parseApiError as p, secureLocalStorage as s, translateError as t };
|
|
212
|
+
export { type CrudifyEnvironment as C, ERROR_CODES as E, type ParsedError as P, type ResolvedTenantConfig as R, type TenantConfigOptions as T, ERROR_SEVERITY_MAP as a, type ErrorCode as b, type ErrorSeverity as c, type ErrorTranslationConfig as d, createErrorTranslator as e, decodeJwtSafely as f, getCurrentUserEmail as g, getErrorMessage as h, handleCrudifyError as i, isTokenExpired as j, parseJavaScriptError as k, parseTransactionError as l, secureSessionStorage as m, translateErrorCode as n, translateErrorCodes as o, parseApiError as p, resolveTenantConfig as r, secureLocalStorage as s, translateError as t, useTenantConfig as u };
|
package/dist/hooks.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { F as FileItem, a as FileStatus,
|
|
2
|
-
|
|
3
|
-
import './
|
|
1
|
+
export { A as AutoGenerateConfig, F as FileItem, a as FileStatus, i as SessionState, U as UseAuthReturn, l as UseAutoGenerateOptions, m as UseAutoGenerateReturn, n as UseDataReturn, o as UseFileUploadOptions, p as UseFileUploadReturn, q as UseSessionOptions, r as UseUserDataOptions, s as UseUserDataReturn, t as UserData, u as useAuth, v as useAutoGenerate, w as useCrudifyWithNotifications, x as useData, y as useFileUpload, B as useSession, D as useUserData, E as useUserProfile } from './index-Cx9P3ZCG.mjs';
|
|
2
|
+
import '@nocios/frontend-types';
|
|
3
|
+
import './api-jcCTCqPD.mjs';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import 'react';
|
|
6
|
-
import '@nocios/crudify-sdk';
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { F as FileItem, a as FileStatus,
|
|
2
|
-
|
|
3
|
-
import './
|
|
1
|
+
export { A as AutoGenerateConfig, F as FileItem, a as FileStatus, i as SessionState, U as UseAuthReturn, l as UseAutoGenerateOptions, m as UseAutoGenerateReturn, n as UseDataReturn, o as UseFileUploadOptions, p as UseFileUploadReturn, q as UseSessionOptions, r as UseUserDataOptions, s as UseUserDataReturn, t as UserData, u as useAuth, v as useAutoGenerate, w as useCrudifyWithNotifications, x as useData, y as useFileUpload, B as useSession, D as useUserData, E as useUserProfile } from './index-rHtWMls-.js';
|
|
2
|
+
import '@nocios/frontend-types';
|
|
3
|
+
import './api-jcCTCqPD.js';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import 'react';
|
|
6
|
-
import '@nocios/crudify-sdk';
|
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 _chunkBJEDX2HUjs = require('./chunk-BJEDX2HU.js');require('./chunk-GZOB4JDB.js');exports.useAuth = _chunkBJEDX2HUjs.v; exports.useAutoGenerate = _chunkBJEDX2HUjs.q; exports.useCrudifyWithNotifications = _chunkBJEDX2HUjs.x; exports.useData = _chunkBJEDX2HUjs.w; exports.useFileUpload = _chunkBJEDX2HUjs.t; exports.useSession = _chunkBJEDX2HUjs.g; exports.useUserData = _chunkBJEDX2HUjs.u; exports.useUserProfile = _chunkBJEDX2HUjs.p;
|
package/dist/hooks.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{g as e,p as t,q as o,t as r,u as s,v as p,w as u,x as a}from"./chunk-4I767MRM.mjs";import"./chunk-YRU7AXYV.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
|
|
1
|
+
import * as _nocios_frontend_types from '@nocios/frontend-types';
|
|
2
|
+
import { CrudifyResponse, FrontendEnvironment, CrudifyRequestOptions, TransactionInput, ActionDefinition } from '@nocios/frontend-types';
|
|
3
|
+
import { U as UserProfile } from './api-jcCTCqPD.mjs';
|
|
2
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
import { CrudifyResponse } from '@nocios/crudify-sdk';
|
|
5
|
-
import { b as NotificationSeverity } from './GlobalNotificationProvider-Cx540WKg.mjs';
|
|
5
|
+
import React, { ReactNode } from 'react';
|
|
6
6
|
|
|
7
7
|
type TokenData = {
|
|
8
8
|
accessToken: string;
|
|
@@ -170,7 +170,7 @@ type SessionConfig = {
|
|
|
170
170
|
apiEndpointAdmin?: string;
|
|
171
171
|
apiKeyEndpointAdmin?: string;
|
|
172
172
|
publicApiKey?: string;
|
|
173
|
-
env?:
|
|
173
|
+
env?: FrontendEnvironment;
|
|
174
174
|
};
|
|
175
175
|
/**
|
|
176
176
|
* Response data from a successful login
|
|
@@ -187,7 +187,7 @@ type LoginResult = {
|
|
|
187
187
|
tokens?: TokenData;
|
|
188
188
|
data?: LoginResponseData;
|
|
189
189
|
error?: string;
|
|
190
|
-
rawResponse?:
|
|
190
|
+
rawResponse?: CrudifyResponse;
|
|
191
191
|
};
|
|
192
192
|
declare class SessionManager {
|
|
193
193
|
private static instance;
|
|
@@ -372,7 +372,7 @@ type UseSessionOptions = {
|
|
|
372
372
|
apiEndpointAdmin?: string;
|
|
373
373
|
apiKeyEndpointAdmin?: string;
|
|
374
374
|
publicApiKey?: string;
|
|
375
|
-
env?:
|
|
375
|
+
env?: FrontendEnvironment;
|
|
376
376
|
};
|
|
377
377
|
/**
|
|
378
378
|
* Full return type of the useSession hook
|
|
@@ -425,7 +425,7 @@ type SessionData = {
|
|
|
425
425
|
} | null;
|
|
426
426
|
type CrudifyConfig = {
|
|
427
427
|
publicApiKey?: string;
|
|
428
|
-
env?:
|
|
428
|
+
env?: FrontendEnvironment;
|
|
429
429
|
appName?: string;
|
|
430
430
|
loginActions?: string[];
|
|
431
431
|
logo?: string;
|
|
@@ -479,6 +479,25 @@ declare function useSessionContext(): SessionContextType;
|
|
|
479
479
|
*/
|
|
480
480
|
declare function SessionDebugInfo(): react_jsx_runtime.JSX.Element;
|
|
481
481
|
|
|
482
|
+
interface AutoGenerateConfig {
|
|
483
|
+
prefix: string;
|
|
484
|
+
padding?: number;
|
|
485
|
+
separator?: string;
|
|
486
|
+
}
|
|
487
|
+
interface UseAutoGenerateReturn {
|
|
488
|
+
value: string;
|
|
489
|
+
loading: boolean;
|
|
490
|
+
error: string | null;
|
|
491
|
+
regenerate: () => Promise<void>;
|
|
492
|
+
clearError: () => void;
|
|
493
|
+
}
|
|
494
|
+
interface UseAutoGenerateOptions {
|
|
495
|
+
autoFetch?: boolean;
|
|
496
|
+
onSuccess?: (value: string) => void;
|
|
497
|
+
onError?: (error: string) => void;
|
|
498
|
+
}
|
|
499
|
+
declare const useAutoGenerate: (config: AutoGenerateConfig, options?: UseAutoGenerateOptions) => UseAutoGenerateReturn;
|
|
500
|
+
|
|
482
501
|
/**
|
|
483
502
|
* Individual file status
|
|
484
503
|
*/
|
|
@@ -775,13 +794,13 @@ declare const useAuth: () => UseAuthReturn;
|
|
|
775
794
|
* Return type compatible with legacy useCrudifyData
|
|
776
795
|
*/
|
|
777
796
|
interface UseDataReturn {
|
|
778
|
-
readItems: (moduleKey: string, filter?: object, options?: CrudifyRequestOptions) => Promise<
|
|
779
|
-
readItem: (moduleKey: string, filter: object, options?: CrudifyRequestOptions) => Promise<
|
|
780
|
-
createItem: (moduleKey: string, data: object, options?: CrudifyRequestOptions) => Promise<
|
|
781
|
-
updateItem: (moduleKey: string, data: object, options?: CrudifyRequestOptions) => Promise<
|
|
782
|
-
deleteItem: (moduleKey: string, id: string, options?: CrudifyRequestOptions) => Promise<
|
|
783
|
-
transaction: (operations: TransactionInput, options?: CrudifyRequestOptions) => Promise<
|
|
784
|
-
login: (email: string, password: string) => Promise<
|
|
797
|
+
readItems: (moduleKey: string, filter?: object, options?: CrudifyRequestOptions) => Promise<CrudifyResponse>;
|
|
798
|
+
readItem: (moduleKey: string, filter: object, options?: CrudifyRequestOptions) => Promise<CrudifyResponse>;
|
|
799
|
+
createItem: (moduleKey: string, data: object, options?: CrudifyRequestOptions) => Promise<CrudifyResponse>;
|
|
800
|
+
updateItem: (moduleKey: string, data: object, options?: CrudifyRequestOptions) => Promise<CrudifyResponse>;
|
|
801
|
+
deleteItem: (moduleKey: string, id: string, options?: CrudifyRequestOptions) => Promise<CrudifyResponse>;
|
|
802
|
+
transaction: (operations: TransactionInput, options?: CrudifyRequestOptions) => Promise<CrudifyResponse>;
|
|
803
|
+
login: (email: string, password: string) => Promise<CrudifyResponse>;
|
|
785
804
|
isInitialized: boolean;
|
|
786
805
|
isInitializing: boolean;
|
|
787
806
|
initializationError: string | null;
|
|
@@ -850,16 +869,68 @@ interface UseUserProfileOptions {
|
|
|
850
869
|
retryOnError?: boolean;
|
|
851
870
|
maxRetries?: number;
|
|
852
871
|
}
|
|
872
|
+
type UserProfileDisplayData = Record<string, unknown> & {
|
|
873
|
+
id?: string | number;
|
|
874
|
+
email?: string;
|
|
875
|
+
username?: string;
|
|
876
|
+
firstName?: string;
|
|
877
|
+
lastName?: string;
|
|
878
|
+
fullName?: string;
|
|
879
|
+
role?: string;
|
|
880
|
+
permissions?: string[];
|
|
881
|
+
isActive?: boolean;
|
|
882
|
+
lastLogin?: string;
|
|
883
|
+
createdAt?: string;
|
|
884
|
+
updatedAt?: string;
|
|
885
|
+
avatar?: string;
|
|
886
|
+
};
|
|
887
|
+
type ExtendedUserData = {
|
|
888
|
+
fullProfile?: UserProfile | null;
|
|
889
|
+
totalFields?: number;
|
|
890
|
+
displayData?: UserProfileDisplayData;
|
|
891
|
+
};
|
|
853
892
|
interface UseUserProfileReturn {
|
|
854
893
|
userProfile: UserProfile | null;
|
|
855
894
|
loading: boolean;
|
|
856
895
|
error: string | null;
|
|
857
|
-
extendedData:
|
|
896
|
+
extendedData: ExtendedUserData;
|
|
858
897
|
refreshProfile: () => Promise<void>;
|
|
859
898
|
clearProfile: () => void;
|
|
860
899
|
}
|
|
861
900
|
declare const useUserProfile: (options?: UseUserProfileOptions) => UseUserProfileReturn;
|
|
862
901
|
|
|
902
|
+
type NotificationSeverity = 'error' | 'info' | 'success' | 'warning';
|
|
903
|
+
interface Notification {
|
|
904
|
+
id: string;
|
|
905
|
+
message: string;
|
|
906
|
+
severity: NotificationSeverity;
|
|
907
|
+
autoHideDuration?: number;
|
|
908
|
+
persistent?: boolean;
|
|
909
|
+
allowHtml?: boolean;
|
|
910
|
+
}
|
|
911
|
+
interface GlobalNotificationContextValue {
|
|
912
|
+
showNotification: (message: string, severity?: NotificationSeverity, options?: {
|
|
913
|
+
autoHideDuration?: number;
|
|
914
|
+
persistent?: boolean;
|
|
915
|
+
allowHtml?: boolean;
|
|
916
|
+
}) => string;
|
|
917
|
+
hideNotification: (id: string) => void;
|
|
918
|
+
clearAllNotifications: () => void;
|
|
919
|
+
}
|
|
920
|
+
interface GlobalNotificationProviderProps {
|
|
921
|
+
children: React.ReactNode;
|
|
922
|
+
maxNotifications?: number;
|
|
923
|
+
defaultAutoHideDuration?: number;
|
|
924
|
+
position?: {
|
|
925
|
+
vertical: 'top' | 'bottom';
|
|
926
|
+
horizontal: 'left' | 'center' | 'right';
|
|
927
|
+
};
|
|
928
|
+
enabled?: boolean;
|
|
929
|
+
allowHtml?: boolean;
|
|
930
|
+
}
|
|
931
|
+
declare const GlobalNotificationProvider: React.FC<GlobalNotificationProviderProps>;
|
|
932
|
+
declare const useGlobalNotification: () => GlobalNotificationContextValue;
|
|
933
|
+
|
|
863
934
|
/**
|
|
864
935
|
* Types and interfaces for useCrudifyWithNotifications
|
|
865
936
|
*/
|
|
@@ -867,11 +938,9 @@ declare const useUserProfile: (options?: UseUserProfileOptions) => UseUserProfil
|
|
|
867
938
|
/**
|
|
868
939
|
* App structure action configuration
|
|
869
940
|
*/
|
|
870
|
-
|
|
871
|
-
key: string;
|
|
941
|
+
type AppStructureAction = Pick<ActionDefinition, 'key'> & {
|
|
872
942
|
moduleKey?: string;
|
|
873
|
-
|
|
874
|
-
}
|
|
943
|
+
} & Record<string, unknown>;
|
|
875
944
|
/**
|
|
876
945
|
* Options for the useCrudifyWithNotifications hook
|
|
877
946
|
*/
|
|
@@ -908,16 +977,16 @@ declare function shouldShowNotification(response: CrudifyResponse): boolean;
|
|
|
908
977
|
* @returns Object with wrapped CRUD operations and utility functions
|
|
909
978
|
*/
|
|
910
979
|
declare const useCrudifyWithNotifications: (options?: CrudifyWithNotificationsOptions) => {
|
|
911
|
-
createItem: (moduleKey: string, data: object, options?: CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
912
|
-
updateItem: (moduleKey: string, data: object, options?: CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
913
|
-
deleteItem: (moduleKey: string, id: string, options?: CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
914
|
-
readItem: (moduleKey: string, filter: object, options?: CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
915
|
-
readItems: (moduleKey: string, filter: object, options?: CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
916
|
-
transaction: (data: TransactionInput, options?: CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
980
|
+
createItem: (moduleKey: string, data: object, options?: _nocios_frontend_types.CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
981
|
+
updateItem: (moduleKey: string, data: object, options?: _nocios_frontend_types.CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
982
|
+
deleteItem: (moduleKey: string, id: string, options?: _nocios_frontend_types.CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
983
|
+
readItem: (moduleKey: string, filter: object, options?: _nocios_frontend_types.CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
984
|
+
readItems: (moduleKey: string, filter: object, options?: _nocios_frontend_types.CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
985
|
+
transaction: (data: _nocios_frontend_types.TransactionInput, options?: _nocios_frontend_types.CrudifyOperationOptions) => Promise<CrudifyResponse>;
|
|
917
986
|
handleResponse: (response: CrudifyResponse, successMessage?: string) => CrudifyResponse;
|
|
918
987
|
getErrorMessage: (response: CrudifyResponse) => string;
|
|
919
988
|
getErrorSeverity: (response: CrudifyResponse) => NotificationSeverity;
|
|
920
989
|
shouldShowNotification: typeof shouldShowNotification;
|
|
921
990
|
};
|
|
922
991
|
|
|
923
|
-
export { type FileItem as F, type LoginResult as L, type
|
|
992
|
+
export { type AutoGenerateConfig as A, useSession as B, useSessionContext as C, useUserData as D, useUserProfile as E, type FileItem as F, GlobalNotificationProvider as G, type LoginResult as L, type Notification as N, type SessionConfig as S, type TokenData as T, type UseAuthReturn as U, type FileStatus as a, type GlobalNotificationProviderProps as b, type NotificationOptions as c, type NotificationSeverity as d, SessionDebugInfo as e, SessionManager as f, SessionProvider as g, type SessionProviderProps as h, type SessionState as i, type StorageType as j, TokenStorage as k, type UseAutoGenerateOptions as l, type UseAutoGenerateReturn as m, type UseDataReturn as n, type UseFileUploadOptions as o, type UseFileUploadReturn as p, type UseSessionOptions as q, type UseUserDataOptions as r, type UseUserDataReturn as s, type UserData as t, useAuth as u, useAutoGenerate as v, useCrudifyWithNotifications as w, useData as x, useFileUpload as y, useGlobalNotification as z };
|