@solidxai/core-ui 0.1.8-beta.9 → 0.1.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/adapters/auth/getSession.d.ts.map +1 -1
- package/dist/adapters/auth/getSession.js +1 -1
- package/dist/adapters/auth/getSession.js.map +1 -1
- package/dist/adapters/auth/getSession.ts +1 -0
- package/dist/adapters/auth/helper.d.ts.map +1 -1
- package/dist/adapters/auth/helper.js +1 -0
- package/dist/adapters/auth/helper.js.map +1 -1
- package/dist/adapters/auth/helper.ts +3 -1
- package/dist/adapters/auth/signIn.d.ts.map +1 -1
- package/dist/adapters/auth/signIn.js +1 -0
- package/dist/adapters/auth/signIn.js.map +1 -1
- package/dist/adapters/auth/signIn.ts +3 -1
- package/dist/adapters/auth/signInWithOAuthAccessCode.d.ts +1 -0
- package/dist/adapters/auth/signInWithOAuthAccessCode.d.ts.map +1 -1
- package/dist/adapters/auth/signInWithOAuthAccessCode.js +10 -9
- package/dist/adapters/auth/signInWithOAuthAccessCode.js.map +1 -1
- package/dist/adapters/auth/signInWithOAuthAccessCode.ts +6 -3
- package/dist/adapters/auth/signOut.d.ts.map +1 -1
- package/dist/adapters/auth/signOut.js +7 -1
- package/dist/adapters/auth/signOut.js.map +1 -1
- package/dist/adapters/auth/signOut.ts +7 -1
- package/dist/adapters/auth/types.d.ts +1 -0
- package/dist/adapters/auth/types.d.ts.map +1 -1
- package/dist/adapters/auth/types.js.map +1 -1
- package/dist/adapters/auth/types.ts +1 -0
- package/dist/components/auth/AuthLayout.d.ts +1 -1
- package/dist/components/auth/AuthLayout.d.ts.map +1 -1
- package/dist/components/auth/AuthLayout.js +87 -18
- package/dist/components/auth/AuthLayout.js.map +1 -1
- package/dist/components/auth/AuthLayout.tsx +35 -11
- package/dist/components/auth/AuthSettingsContext.d.ts +10 -0
- package/dist/components/auth/AuthSettingsContext.d.ts.map +1 -0
- package/dist/components/auth/AuthSettingsContext.js +49 -0
- package/dist/components/auth/AuthSettingsContext.js.map +1 -0
- package/dist/components/auth/AuthSettingsContext.tsx +19 -0
- package/dist/components/auth/FacebookAuthChecking.d.ts +2 -0
- package/dist/components/auth/FacebookAuthChecking.d.ts.map +1 -0
- package/dist/components/auth/FacebookAuthChecking.js +98 -0
- package/dist/components/auth/FacebookAuthChecking.js.map +1 -0
- package/dist/components/auth/FacebookAuthChecking.tsx +59 -0
- package/dist/components/auth/ForgotPasswordThankYou.d.ts.map +1 -1
- package/dist/components/auth/ForgotPasswordThankYou.js +2 -6
- package/dist/components/auth/ForgotPasswordThankYou.js.map +1 -1
- package/dist/components/auth/ForgotPasswordThankYou.tsx +2 -7
- package/dist/components/auth/GoogleAuthChecking.d.ts.map +1 -1
- package/dist/components/auth/GoogleAuthChecking.js +10 -16
- package/dist/components/auth/GoogleAuthChecking.js.map +1 -1
- package/dist/components/auth/GoogleAuthChecking.tsx +2 -7
- package/dist/components/auth/MicrosoftAuthChecking.d.ts +2 -0
- package/dist/components/auth/MicrosoftAuthChecking.d.ts.map +1 -0
- package/dist/components/auth/MicrosoftAuthChecking.js +98 -0
- package/dist/components/auth/MicrosoftAuthChecking.js.map +1 -0
- package/dist/components/auth/MicrosoftAuthChecking.tsx +59 -0
- package/dist/components/auth/SolidForgotPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidForgotPassword.js +2 -6
- package/dist/components/auth/SolidForgotPassword.js.map +1 -1
- package/dist/components/auth/SolidForgotPassword.tsx +2 -7
- package/dist/components/auth/SolidInitialLoginOtp.d.ts.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.js +13 -22
- package/dist/components/auth/SolidInitialLoginOtp.js.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.tsx +4 -12
- package/dist/components/auth/SolidInitiateRegisterOtp.d.ts.map +1 -1
- package/dist/components/auth/SolidInitiateRegisterOtp.js +27 -14
- package/dist/components/auth/SolidInitiateRegisterOtp.js.map +1 -1
- package/dist/components/auth/SolidInitiateRegisterOtp.tsx +27 -15
- package/dist/components/auth/SolidLogin.d.ts.map +1 -1
- package/dist/components/auth/SolidLogin.js +18 -23
- package/dist/components/auth/SolidLogin.js.map +1 -1
- package/dist/components/auth/SolidLogin.tsx +18 -15
- package/dist/components/auth/SolidRegister.d.ts.map +1 -1
- package/dist/components/auth/SolidRegister.js +50 -22
- package/dist/components/auth/SolidRegister.js.map +1 -1
- package/dist/components/auth/SolidRegister.tsx +89 -36
- package/dist/components/auth/SolidResetPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidResetPassword.js +2 -6
- package/dist/components/auth/SolidResetPassword.js.map +1 -1
- package/dist/components/auth/SolidResetPassword.tsx +2 -6
- package/dist/components/common/AuthBanner.js.map +1 -1
- package/dist/components/common/GeneralSettings.d.ts.map +1 -1
- package/dist/components/common/GeneralSettings.js +235 -151
- package/dist/components/common/GeneralSettings.js.map +1 -1
- package/dist/components/common/GeneralSettings.tsx +1109 -776
- package/dist/components/common/SettingsComponent.d.ts +2 -0
- package/dist/components/common/SettingsComponent.d.ts.map +1 -0
- package/dist/components/common/SettingsComponent.js +351 -0
- package/dist/components/common/SettingsComponent.js.map +1 -0
- package/dist/components/common/SettingsComponent.module.css +421 -0
- package/dist/components/common/SettingsComponent.tsx +582 -0
- package/dist/components/common/SocialMediaLogin.d.ts +8 -1
- package/dist/components/common/SocialMediaLogin.d.ts.map +1 -1
- package/dist/components/common/SocialMediaLogin.js +6 -13
- package/dist/components/common/SocialMediaLogin.js.map +1 -1
- package/dist/components/common/SocialMediaLogin.tsx +120 -58
- package/dist/components/common/SolidExport.d.ts.map +1 -1
- package/dist/components/common/SolidExport.js +1 -1
- package/dist/components/common/SolidExport.js.map +1 -1
- package/dist/components/common/SolidExport.tsx +2 -1
- package/dist/components/common/SolidFormStepper.d.ts.map +1 -1
- package/dist/components/common/SolidFormStepper.js +2 -1
- package/dist/components/common/SolidFormStepper.js.map +1 -1
- package/dist/components/common/SolidFormStepper.tsx +2 -1
- package/dist/components/common/solid-export.css +26 -0
- package/dist/components/core/card/SolidCardView.d.ts.map +1 -1
- package/dist/components/core/card/SolidCardView.js +24 -25
- package/dist/components/core/card/SolidCardView.js.map +1 -1
- package/dist/components/core/card/SolidCardView.tsx +22 -27
- package/dist/components/core/card/SolidCardViewConfigure.js +1 -1
- package/dist/components/core/card/SolidCardViewConfigure.js.map +1 -1
- package/dist/components/core/card/SolidCardViewConfigure.tsx +1 -1
- package/dist/components/core/chatter/SolidChatter.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatter.js +39 -9
- package/dist/components/core/chatter/SolidChatter.js.map +1 -1
- package/dist/components/core/chatter/SolidChatter.tsx +42 -7
- package/dist/components/core/chatter/SolidChatterAuditMessage.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterAuditMessage.js +19 -1
- package/dist/components/core/chatter/SolidChatterAuditMessage.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterAuditMessage.tsx +22 -1
- package/dist/components/core/chatter/SolidChatterMessageBox.d.ts +3 -0
- package/dist/components/core/chatter/SolidChatterMessageBox.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterMessageBox.js +68 -4
- package/dist/components/core/chatter/SolidChatterMessageBox.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterMessageBox.tsx +45 -3
- package/dist/components/core/chatter/chatter.module.css +0 -3
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.d.ts.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.js +3 -1
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.js.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.module.css +149 -0
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.tsx +3 -1
- package/dist/components/core/common/SolidAccountSettings/SolidNotifications.d.ts.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidNotifications.js +9 -8
- package/dist/components/core/common/SolidAccountSettings/SolidNotifications.js.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidNotifications.tsx +4 -2
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.d.ts.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.js +21 -4
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.js.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.tsx +128 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.tsx +1 -1
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.d.ts +7 -0
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.js +75 -0
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.js.map +1 -0
- package/dist/components/core/extension/solid-core/scheduled-job/scheduleFrequencyOnFieldChangeHandler.ts +45 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.d.ts +3 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.d.ts.map +1 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.js +81 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.js.map +1 -0
- package/dist/components/core/extension/solid-core/settings/solidXGenAiCodeBuilderConfigWidget.tsx +114 -0
- package/dist/components/core/form/SolidFormActionHeader.d.ts +1 -1
- package/dist/components/core/form/SolidFormActionHeader.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormActionHeader.js +5 -3
- package/dist/components/core/form/SolidFormActionHeader.js.map +1 -1
- package/dist/components/core/form/SolidFormActionHeader.tsx +27 -1
- package/dist/components/core/form/SolidFormLayouts.js +1 -1
- package/dist/components/core/form/SolidFormLayouts.js.map +1 -1
- package/dist/components/core/form/SolidFormLayouts.tsx +1 -1
- package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormView.js +117 -27
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/SolidFormView.tsx +107 -9
- package/dist/components/core/form/fields/SolidComputedField.d.ts +25 -0
- package/dist/components/core/form/fields/SolidComputedField.d.ts.map +1 -0
- package/dist/components/core/form/fields/SolidComputedField.js +128 -0
- package/dist/components/core/form/fields/SolidComputedField.js.map +1 -0
- package/dist/components/core/form/fields/SolidComputedField.tsx +134 -0
- package/dist/components/core/form/fields/SolidDateTimeField.js +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.tsx +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js +35 -24
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.tsx +30 -14
- package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.js +29 -28
- package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.tsx +17 -12
- package/dist/components/core/form/fields/SolidTimeField.js +1 -1
- package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
- package/dist/components/core/form/fields/SolidTimeField.tsx +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js +3 -3
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.js.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/InlineRelationEntityDialog.tsx +0 -5
- package/dist/components/core/kanban/KanbanBoard.js +1 -1
- package/dist/components/core/kanban/KanbanBoard.js.map +1 -1
- package/dist/components/core/kanban/KanbanBoard.tsx +1 -1
- package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +216 -102
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.tsx +204 -72
- package/dist/components/core/kanban/SolidKanbanViewConfigure.js +1 -1
- package/dist/components/core/kanban/SolidKanbanViewConfigure.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanViewConfigure.tsx +1 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.js.map +1 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.tsx +1 -2
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js +2 -2
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.tsx +21 -10
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js +2 -2
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +18 -10
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js +3 -6
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +30 -24
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx +2 -2
- package/dist/components/core/list/SolidDataTable.d.ts.map +1 -1
- package/dist/components/core/list/SolidDataTable.js +6 -5
- package/dist/components/core/list/SolidDataTable.js.map +1 -1
- package/dist/components/core/list/SolidDataTable.tsx +6 -5
- package/dist/components/core/list/SolidDataTablePagination.d.ts +15 -0
- package/dist/components/core/list/SolidDataTablePagination.d.ts.map +1 -0
- package/dist/components/core/list/SolidDataTablePagination.js +22 -0
- package/dist/components/core/list/SolidDataTablePagination.js.map +1 -0
- package/dist/components/core/list/SolidDataTablePagination.tsx +71 -0
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.d.ts.map +1 -1
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.js +3 -3
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.js.map +1 -1
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.tsx +1 -0
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +60 -63
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +43 -48
- package/dist/components/core/list/SolidListViewConfigure.js +1 -1
- package/dist/components/core/list/SolidListViewConfigure.js.map +1 -1
- package/dist/components/core/list/SolidListViewConfigure.tsx +1 -1
- package/dist/components/core/list/SolidListViewRowActionsMenu.js +2 -2
- package/dist/components/core/list/SolidListViewRowActionsMenu.js.map +1 -1
- package/dist/components/core/list/SolidListViewRowActionsMenu.tsx +2 -2
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts +1 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts.map +1 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.js +6 -7
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.js.map +1 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.tsx +9 -10
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +1 -1
- package/dist/components/layout/user-profile-menu.d.ts.map +1 -1
- package/dist/components/layout/user-profile-menu.js +15 -14
- package/dist/components/layout/user-profile-menu.js.map +1 -1
- package/dist/components/layout/user-profile-menu.tsx +8 -6
- package/dist/components/shad-cn-ui/SolidAutocomplete.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidAutocomplete.js +9 -1
- package/dist/components/shad-cn-ui/SolidAutocomplete.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidAutocomplete.tsx +10 -1
- package/dist/components/shad-cn-ui/SolidButton.d.ts +14 -15
- package/dist/components/shad-cn-ui/SolidButton.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidButton.js +13 -3
- package/dist/components/shad-cn-ui/SolidButton.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidButton.tsx +24 -4
- package/dist/components/shad-cn-ui/SolidDatePicker.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.js +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.tsx +2 -0
- package/dist/components/shad-cn-ui/SolidDialog.d.ts +1 -1
- package/dist/components/shad-cn-ui/SolidDialog.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidDialog.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidDialog.tsx +1 -1
- package/dist/components/shad-cn-ui/SolidIcon.d.ts +2 -2
- package/dist/components/shad-cn-ui/SolidIcon.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidIcon.js +3 -4
- package/dist/components/shad-cn-ui/SolidIcon.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidIcon.tsx +12 -15
- package/dist/components/shad-cn-ui/SolidRichTextEditor.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidRichTextEditor.js +9 -1
- package/dist/components/shad-cn-ui/SolidRichTextEditor.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidRichTextEditor.tsx +8 -1
- package/dist/components/shad-cn-ui/SolidTabs.d.ts +2 -1
- package/dist/components/shad-cn-ui/SolidTabs.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidTabs.js +2 -2
- package/dist/components/shad-cn-ui/SolidTabs.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidTabs.tsx +12 -1
- package/dist/components/solid-ui/SolidButton.d.ts +14 -0
- package/dist/components/solid-ui/SolidButton.d.ts.map +1 -0
- package/dist/components/solid-ui/SolidButton.js +36 -0
- package/dist/components/solid-ui/SolidButton.js.map +1 -0
- package/dist/components/solid-ui/SolidButton.tsx +54 -0
- package/dist/components/solid-ui/SolidTabs.d.ts +18 -0
- package/dist/components/solid-ui/SolidTabs.d.ts.map +1 -0
- package/dist/components/solid-ui/SolidTabs.js +22 -0
- package/dist/components/solid-ui/SolidTabs.js.map +1 -0
- package/dist/components/solid-ui/SolidTabs.tsx +73 -0
- package/dist/components/solid-ui/index.d.ts +3 -0
- package/dist/components/solid-ui/index.d.ts.map +1 -0
- package/dist/components/solid-ui/index.js +3 -0
- package/dist/components/solid-ui/index.js.map +1 -0
- package/dist/components/solid-ui/index.ts +2 -0
- package/dist/helpers/hydrateRelationRules.js +1 -1
- package/dist/helpers/hydrateRelationRules.js.map +1 -1
- package/dist/helpers/hydrateRelationRules.ts +1 -1
- package/dist/helpers/permissions.js +2 -2
- package/dist/helpers/permissions.js.map +1 -1
- package/dist/helpers/permissions.ts +2 -2
- package/dist/helpers/registry.d.ts +2 -2
- package/dist/helpers/registry.d.ts.map +1 -1
- package/dist/helpers/registry.js +6 -0
- package/dist/helpers/registry.js.map +1 -1
- package/dist/helpers/registry.ts +9 -2
- package/dist/helpers/settingsPayload.d.ts +32 -0
- package/dist/helpers/settingsPayload.d.ts.map +1 -0
- package/dist/helpers/settingsPayload.js +72 -0
- package/dist/helpers/settingsPayload.js.map +1 -0
- package/dist/helpers/settingsPayload.ts +125 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/index.ts +5 -0
- package/dist/redux/api/solidChatterMessageApi.d.ts +2 -1
- package/dist/redux/api/solidChatterMessageApi.d.ts.map +1 -1
- package/dist/redux/api/solidChatterMessageApi.js +11 -1
- package/dist/redux/api/solidChatterMessageApi.js.map +1 -1
- package/dist/redux/api/solidChatterMessageApi.ts +10 -1
- package/dist/redux/api/solidEntityApi.d.ts.map +1 -1
- package/dist/redux/api/solidEntityApi.js +14 -1
- package/dist/redux/api/solidEntityApi.js.map +1 -1
- package/dist/redux/api/solidEntityApi.tsx +17 -1
- package/dist/redux/store/createSolidStore.d.ts +1 -1
- package/dist/redux/store/createSolidStore.d.ts.map +1 -1
- package/dist/redux/store/createSolidStore.js +20 -11
- package/dist/redux/store/createSolidStore.js.map +1 -1
- package/dist/redux/store/createSolidStore.ts +20 -11
- package/dist/redux/store/defaultStoreConfig.d.ts +1 -0
- package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
- package/dist/redux/store/dynamicEntityApiMiddleware.d.ts +10 -0
- package/dist/redux/store/dynamicEntityApiMiddleware.d.ts.map +1 -0
- package/dist/redux/store/dynamicEntityApiMiddleware.js +44 -0
- package/dist/redux/store/dynamicEntityApiMiddleware.js.map +1 -0
- package/dist/redux/store/dynamicEntityApiMiddleware.ts +58 -0
- package/dist/redux/store/dynamicReducerManager.d.ts +10 -0
- package/dist/redux/store/dynamicReducerManager.d.ts.map +1 -0
- package/dist/redux/store/dynamicReducerManager.js +51 -0
- package/dist/redux/store/dynamicReducerManager.js.map +1 -0
- package/dist/redux/store/dynamicReducerManager.ts +51 -0
- package/dist/redux/store/solidEntityApiPool.d.ts +31 -0
- package/dist/redux/store/solidEntityApiPool.d.ts.map +1 -0
- package/dist/redux/store/solidEntityApiPool.js +123 -0
- package/dist/redux/store/solidEntityApiPool.js.map +1 -0
- package/dist/redux/store/solidEntityApiPool.ts +167 -0
- package/dist/resources/globals.css +20 -6
- package/dist/resources/shadcn-base.css +248 -87
- package/dist/resources/solid-responsive.css +22 -4
- package/dist/routes/AppEventListener.js +1 -1
- package/dist/routes/AppEventListener.js.map +1 -1
- package/dist/routes/AppEventListener.tsx +1 -1
- package/dist/routes/pages/admin/core/CardPage.js +1 -1
- package/dist/routes/pages/admin/core/CardPage.js.map +1 -1
- package/dist/routes/pages/admin/core/CardPage.tsx +1 -1
- package/dist/routes/pages/admin/core/DiagnosticsPage.d.ts +2 -0
- package/dist/routes/pages/admin/core/DiagnosticsPage.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/DiagnosticsPage.js +48 -0
- package/dist/routes/pages/admin/core/DiagnosticsPage.js.map +1 -0
- package/dist/routes/pages/admin/core/DiagnosticsPage.tsx +167 -0
- package/dist/routes/pages/admin/core/FormPage.js +1 -1
- package/dist/routes/pages/admin/core/FormPage.js.map +1 -1
- package/dist/routes/pages/admin/core/FormPage.tsx +1 -1
- package/dist/routes/pages/admin/core/KanbanPage.js +1 -1
- package/dist/routes/pages/admin/core/KanbanPage.js.map +1 -1
- package/dist/routes/pages/admin/core/KanbanPage.tsx +1 -1
- package/dist/routes/pages/admin/core/ListPage.js +1 -1
- package/dist/routes/pages/admin/core/ListPage.js.map +1 -1
- package/dist/routes/pages/admin/core/ListPage.tsx +1 -1
- package/dist/routes/pages/admin/core/SettingsPage.js +2 -2
- package/dist/routes/pages/admin/core/SettingsPage.js.map +1 -1
- package/dist/routes/pages/admin/core/SettingsPage.tsx +2 -2
- package/dist/routes/pages/admin/core/TreePage.js +1 -1
- package/dist/routes/pages/admin/core/TreePage.js.map +1 -1
- package/dist/routes/pages/admin/core/TreePage.tsx +1 -1
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.d.ts +2 -0
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.d.ts.map +1 -0
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.js +6 -0
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.js.map +1 -0
- package/dist/routes/pages/auth/InitiateFacebookOauthPage.tsx +5 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.d.ts +2 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.d.ts.map +1 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.js +6 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.js.map +1 -0
- package/dist/routes/pages/auth/InitiateMicrosoftOauthPage.tsx +5 -0
- package/dist/routes/solidRoutes.d.ts.map +1 -1
- package/dist/routes/solidRoutes.js +5 -1
- package/dist/routes/solidRoutes.js.map +1 -1
- package/dist/routes/solidRoutes.tsx +5 -1
- package/dist/routes/types.d.ts +1 -1
- package/dist/routes/types.d.ts.map +1 -1
- package/dist/routes/types.js.map +1 -1
- package/dist/routes/types.ts +2 -0
- package/dist/types/extension-registry.d.ts +1 -0
- package/dist/types/extension-registry.d.ts.map +1 -1
- package/dist/types/extension-registry.js +1 -0
- package/dist/types/extension-registry.js.map +1 -1
- package/dist/types/extension-registry.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/solid-core.d.ts +11 -0
- package/package.json +1 -2
- package/dist/components/auth/SolidOTPVerify.d.ts +0 -3
- package/dist/components/auth/SolidOTPVerify.d.ts.map +0 -1
- package/dist/components/auth/SolidOTPVerify.js +0 -67
- package/dist/components/auth/SolidOTPVerify.js.map +0 -1
- package/dist/components/auth/SolidOTPVerify.tsx +0 -133
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts +0 -2
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts.map +0 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.js +0 -50
- package/dist/components/core/common/LoadDynamicJsxComponent.js.map +0 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.tsx +0 -70
- package/dist/nextAuth/authProviders.d.ts +0 -4
- package/dist/nextAuth/authProviders.d.ts.map +0 -1
- package/dist/nextAuth/authProviders.js +0 -198
- package/dist/nextAuth/authProviders.js.map +0 -1
- package/dist/nextAuth/authProviders.tsx +0 -232
- package/dist/nextAuth/handleLogout.d.ts +0 -2
- package/dist/nextAuth/handleLogout.d.ts.map +0 -1
- package/dist/nextAuth/handleLogout.js +0 -36
- package/dist/nextAuth/handleLogout.js.map +0 -1
- package/dist/nextAuth/handleLogout.tsx +0 -39
- package/dist/nextAuth/refreshAccessToken.d.ts +0 -2
- package/dist/nextAuth/refreshAccessToken.d.ts.map +0 -1
- package/dist/nextAuth/refreshAccessToken.js +0 -24
- package/dist/nextAuth/refreshAccessToken.js.map +0 -1
- package/dist/nextAuth/refreshAccessToken.tsx +0 -28
- package/dist/redux/features/settingsSlice.d.ts +0 -20
- package/dist/redux/features/settingsSlice.d.ts.map +0 -1
- package/dist/redux/features/settingsSlice.js +0 -39
- package/dist/redux/features/settingsSlice.js.map +0 -1
- package/dist/redux/features/settingsSlice.ts +0 -60
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { ERROR_MESSAGES } from "../../../constants/error-messages";
|
|
3
|
-
import dynamic from "next/dynamic";
|
|
4
|
-
import { useState, useEffect } from "react";
|
|
5
|
-
// Fallback component for missing components
|
|
6
|
-
const FallbackComponent = ({ componentName }: any) => (
|
|
7
|
-
<div style={{ color: "red" }}>
|
|
8
|
-
Could not load <strong>{componentName}</strong>
|
|
9
|
-
</div>
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
type Props = {
|
|
13
|
-
context: any;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const LoadDynamicJsxComponent = ({ context }: any) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// const Component = dynamic<Props>(
|
|
20
|
-
// async () => {
|
|
21
|
-
// try {
|
|
22
|
-
|
|
23
|
-
// const componentName = context?.rowAction?.action?.customComponent.split('/').pop();
|
|
24
|
-
// const mod = await import();
|
|
25
|
-
// // Return the default export or a named export matching the componentName
|
|
26
|
-
// return mod.default || mod[componentName];
|
|
27
|
-
// } catch (error) {
|
|
28
|
-
// console.error(`Failed to load component "${context?.rowAction?.action?.customComponent}":`, error);
|
|
29
|
-
// // Return a fallback component if the import fails
|
|
30
|
-
// return () => <GenerateModelCodeRowAction context={context} />;
|
|
31
|
-
// }
|
|
32
|
-
// },
|
|
33
|
-
// { ssr: false } // Disable server-side rendering
|
|
34
|
-
// );
|
|
35
|
-
const [Component, setComponent] = useState<any>(null);
|
|
36
|
-
const componentPath = context?.rowAction?.action?.customComponent;
|
|
37
|
-
const componentKey = componentPath?.split("/")?.pop();
|
|
38
|
-
|
|
39
|
-
const componentMap: Record<string, any> = {
|
|
40
|
-
"GenerateModelCodeRowAction": dynamic(
|
|
41
|
-
() => import("../extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction"),
|
|
42
|
-
{ ssr: false }
|
|
43
|
-
),
|
|
44
|
-
"GenerateModuleCodeRowAction": dynamic(
|
|
45
|
-
() => import("../extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction"),
|
|
46
|
-
{ ssr: false }
|
|
47
|
-
),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (!componentKey) return;
|
|
52
|
-
|
|
53
|
-
if (componentMap[componentKey]) {
|
|
54
|
-
setComponent(() => () => setComponent(() => componentMap[componentKey]));
|
|
55
|
-
} else {
|
|
56
|
-
import(componentPath)
|
|
57
|
-
.then((mod) => setComponent(() => mod.default || mod))
|
|
58
|
-
.catch((err) => {
|
|
59
|
-
console.error(` ${ERROR_MESSAGES.LOADING_COMPONENT} ${componentPath}:`, err);
|
|
60
|
-
setComponent(() => () => <FallbackComponent componentName={componentKey} />);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}, [componentKey]);
|
|
64
|
-
|
|
65
|
-
if (!Component) return <p>Loading...</p>;
|
|
66
|
-
|
|
67
|
-
return <Component context={context} />;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authProviders.d.ts","sourceRoot":"./","sources":["nextAuth/authProviders.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAW5C,QAAA,MAAM,aAAa,EAAE,eAqNpB,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import CredentialsProvider from "next-auth/providers/credentials";
|
|
2
|
-
import GoogleProvider from "next-auth/providers/google";
|
|
3
|
-
import { jwtDecode } from "jwt-decode";
|
|
4
|
-
import axios from "axios";
|
|
5
|
-
import { refreshAccessToken } from "./refreshAccessToken";
|
|
6
|
-
const authProviders = {
|
|
7
|
-
session: {
|
|
8
|
-
strategy: "jwt",
|
|
9
|
-
},
|
|
10
|
-
providers: [
|
|
11
|
-
GoogleProvider({
|
|
12
|
-
clientId: process.env.GOOGLE_ID,
|
|
13
|
-
clientSecret: process.env.GOOGLE_CLIENT_SECRET
|
|
14
|
-
}),
|
|
15
|
-
CredentialsProvider({
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
async authorize(credentials, req) {
|
|
18
|
-
const userAgent = req.headers['user-agent'];
|
|
19
|
-
const { username, email, password, identifier, accessToken, accessCode } = credentials;
|
|
20
|
-
console.log(credentials, '=========================');
|
|
21
|
-
try {
|
|
22
|
-
if (accessCode) {
|
|
23
|
-
let config = {
|
|
24
|
-
method: 'get',
|
|
25
|
-
url: `${process.env.API_URL}/api/iam/google/authenticate?accessCode=${accessCode}`,
|
|
26
|
-
headers: {
|
|
27
|
-
'User-Agent': userAgent,
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const loginResponse = await axios.request(config);
|
|
31
|
-
if (loginResponse.status == 400) {
|
|
32
|
-
throw new Error(loginResponse.data.message);
|
|
33
|
-
}
|
|
34
|
-
if (loginResponse.status == 401) {
|
|
35
|
-
throw new Error(loginResponse.data.message);
|
|
36
|
-
}
|
|
37
|
-
let base64decoded = jwtDecode(loginResponse.data.data.accessToken);
|
|
38
|
-
// let accessTokenExpires = base64decoded.exp;
|
|
39
|
-
let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
|
|
40
|
-
return {
|
|
41
|
-
accessToken: loginResponse.data.data.accessToken,
|
|
42
|
-
refreshToken: loginResponse.data.data.refreshToken,
|
|
43
|
-
accessTokenExpires: accessTokenExpires,
|
|
44
|
-
...loginResponse.data.data,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
if (accessToken) {
|
|
49
|
-
let data = JSON.stringify({
|
|
50
|
-
username: identifier,
|
|
51
|
-
email: identifier.includes('@') ? identifier : null,
|
|
52
|
-
password: password
|
|
53
|
-
});
|
|
54
|
-
let config = {
|
|
55
|
-
method: 'get',
|
|
56
|
-
url: `${process.env.API_URL}/api/iam/me`,
|
|
57
|
-
headers: {
|
|
58
|
-
'accept': '*/*',
|
|
59
|
-
'Content-Type': 'application/json',
|
|
60
|
-
'Authorization': `Bearer ${accessToken}`
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const loginResponse = await axios.request(config);
|
|
64
|
-
if (loginResponse.status == 400) {
|
|
65
|
-
throw new Error(loginResponse.data.message);
|
|
66
|
-
}
|
|
67
|
-
if (loginResponse.status == 401) {
|
|
68
|
-
throw new Error(loginResponse.data.message);
|
|
69
|
-
}
|
|
70
|
-
let base64decoded = jwtDecode(accessToken);
|
|
71
|
-
// let accessTokenExpires = base64decoded.exp;
|
|
72
|
-
let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
|
|
73
|
-
return {
|
|
74
|
-
accessToken: accessToken,
|
|
75
|
-
refreshToken: loginResponse.data.data.refreshToken,
|
|
76
|
-
accessTokenExpires: accessTokenExpires,
|
|
77
|
-
...loginResponse.data.data,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
let data = JSON.stringify({
|
|
82
|
-
username: identifier,
|
|
83
|
-
email: identifier.includes('@') ? identifier : null,
|
|
84
|
-
password: password
|
|
85
|
-
});
|
|
86
|
-
let config = {
|
|
87
|
-
method: 'post',
|
|
88
|
-
maxBodyLength: Infinity,
|
|
89
|
-
url: `${process.env.API_URL}/api/iam/authenticate`,
|
|
90
|
-
headers: {
|
|
91
|
-
'accept': '*/*',
|
|
92
|
-
'Content-Type': 'application/json',
|
|
93
|
-
'User-Agent': userAgent,
|
|
94
|
-
},
|
|
95
|
-
data: data
|
|
96
|
-
};
|
|
97
|
-
const loginResponse = await axios.request(config);
|
|
98
|
-
// const authenticateResponse = await fetch(
|
|
99
|
-
// `${process.env.API_URL}/api/iam/authenticate`,
|
|
100
|
-
// {
|
|
101
|
-
// method: "Post",
|
|
102
|
-
// headers: {
|
|
103
|
-
// 'accept': '*/*',
|
|
104
|
-
// "Content-Type": "application/json"
|
|
105
|
-
// },
|
|
106
|
-
// body: JSON.stringify({
|
|
107
|
-
// username: email,
|
|
108
|
-
// email: email,
|
|
109
|
-
// password: password
|
|
110
|
-
// })
|
|
111
|
-
// }
|
|
112
|
-
// );
|
|
113
|
-
// const loginResponse = await authenticateResponse.json();
|
|
114
|
-
// const response = await fetch(
|
|
115
|
-
// `${process.env.API_URL}/api/iam/me`,
|
|
116
|
-
// {
|
|
117
|
-
// method: "Get",
|
|
118
|
-
// headers: {
|
|
119
|
-
// "Content-Type": "application/json",
|
|
120
|
-
// "Authorization": `Bearer ${loginResponse.data.accessToken}`,
|
|
121
|
-
// },
|
|
122
|
-
// }
|
|
123
|
-
// );
|
|
124
|
-
// const responseData = await response.json();
|
|
125
|
-
if (loginResponse.status == 400) {
|
|
126
|
-
throw new Error(loginResponse.data.message);
|
|
127
|
-
}
|
|
128
|
-
if (loginResponse.status == 401) {
|
|
129
|
-
throw new Error(loginResponse.data.data.message);
|
|
130
|
-
}
|
|
131
|
-
let base64decoded = jwtDecode(loginResponse.data.data.accessToken);
|
|
132
|
-
// let accessTokenExpires = base64decoded.exp;
|
|
133
|
-
let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
|
|
134
|
-
const returnResponse = {
|
|
135
|
-
accessToken: loginResponse.data.data.accessToken,
|
|
136
|
-
refreshToken: loginResponse.data.data.refreshToken,
|
|
137
|
-
accessTokenExpires: accessTokenExpires,
|
|
138
|
-
...loginResponse.data.data,
|
|
139
|
-
};
|
|
140
|
-
return returnResponse;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
throw new Error(error?.response?.data?.message);
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
}),
|
|
149
|
-
],
|
|
150
|
-
callbacks: {
|
|
151
|
-
// @ts-ignore
|
|
152
|
-
jwt: async ({ token, user }) => {
|
|
153
|
-
// console.log("JWT callback called");
|
|
154
|
-
const bufferTime = 60000;
|
|
155
|
-
if (Date.now() >= (token.accessTokenExpires - bufferTime)) {
|
|
156
|
-
// Call the refresh token function
|
|
157
|
-
return await refreshAccessToken(token);
|
|
158
|
-
}
|
|
159
|
-
// If there is no user (first time login or session), we return the user data
|
|
160
|
-
if (user) {
|
|
161
|
-
// const base64decoded = jwtDecode(user.accessToken);
|
|
162
|
-
// Convert from seconds to milliseconds
|
|
163
|
-
// const accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
|
|
164
|
-
// const accessTokenExpires = user.accessTokenExpires * 1000;
|
|
165
|
-
return {
|
|
166
|
-
...token,
|
|
167
|
-
accessToken: user.accessToken,
|
|
168
|
-
refreshToken: user.refreshToken,
|
|
169
|
-
accessTokenExpires: user.accessTokenExpires,
|
|
170
|
-
user: user, // Include the user data here
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
return token; // If no update needed, just return the existing token
|
|
174
|
-
},
|
|
175
|
-
// @ts-ignore
|
|
176
|
-
session: async ({ session, token }) => {
|
|
177
|
-
// console.log("Session callback called");
|
|
178
|
-
const user = token.user || {}; // Default to an empty object if user is undefined or null
|
|
179
|
-
session.error = token.error ? token.error : null;
|
|
180
|
-
// if (token.error) {
|
|
181
|
-
// return null
|
|
182
|
-
// }
|
|
183
|
-
session.user = {
|
|
184
|
-
...user,
|
|
185
|
-
accessToken: token?.accessToken,
|
|
186
|
-
refreshToken: token?.refreshToken,
|
|
187
|
-
accessTokenExpires: token?.accessTokenExpires && token?.accessTokenExpires, // Store the expiry time
|
|
188
|
-
};
|
|
189
|
-
return session;
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
pages: {
|
|
193
|
-
signIn: "/auth/login",
|
|
194
|
-
},
|
|
195
|
-
secret: process.env.NEXTAUTH_SECRET,
|
|
196
|
-
};
|
|
197
|
-
export default authProviders;
|
|
198
|
-
//# sourceMappingURL=authProviders.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authProviders.js","sourceRoot":"./","sources":["nextAuth/authProviders.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,iCAAiC,CAAC;AAClE,OAAO,cAAc,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAY1D,MAAM,aAAa,GAAoB;IACnC,OAAO,EAAE;QACL,QAAQ,EAAE,KAAK;KAClB;IACD,SAAS,EAAE;QACP,cAAc,CAAC;YACX,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAU;YAChC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAqB;SAClD,CAAC;QACF,mBAAmB,CAAC;YAChB,aAAa;YACb,KAAK,CAAC,SAAS,CAAC,WAAwB,EAAE,GAAQ;gBAC9C,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;gBAE5C,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ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AAK,EAAE,EAAE,EAAE;YAClC,0CAA0C;YAE1C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAE,0DAA0D;YAC1F,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YACjD,qBAAqB;YACrB,gBAAgB;YAChB,IAAI;YACJ,OAAO,CAAC,IAAI,GAAG;gBACX,GAAG,IAAI;gBACP,WAAW,EAAE,KAAK,EAAE,WAAW;gBAC/B,YAAY,EAAE,KAAK,EAAE,YAAY;gBACjC,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,IAAI,KAAK,EAAE,kBAAkB,EAAG,wBAAwB;aACxG,CAAC;YACF,OAAO,OAAO,CAAC;QAEnB,CAAC;KACJ;IACD,KAAK,EAAE;QACH,MAAM,EAAE,aAAa;KACxB;IACD,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;CACtC,CAAA;AAED,eAAe,aAAa,CAAA","sourcesContent":["import CredentialsProvider from \"next-auth/providers/credentials\";\nimport GoogleProvider from \"next-auth/providers/google\";\nimport { NextRequest } from \"next/server\";\nimport { jwtDecode } from \"jwt-decode\";\nimport { JWT } from \"next-auth/jwt\";\nimport axios from \"axios\";\nimport { signOut } from \"next-auth/react\";\nimport { refreshAccessToken } from \"./refreshAccessToken\";\nimport { NextAuthOptions } from \"next-auth\";\n\ntype Credentials = {\n username: string,\n email: string,\n password: string,\n identifier:string,\n accessToken: string,\n accessCode: string,\n};\n\nconst authProviders: NextAuthOptions = {\n session: {\n strategy: \"jwt\",\n },\n providers: [\n GoogleProvider({\n clientId: process.env.GOOGLE_ID!,\n clientSecret: process.env.GOOGLE_CLIENT_SECRET!\n }),\n CredentialsProvider({\n // @ts-ignore\n async authorize(credentials: Credentials, req: any) {\n const userAgent = req.headers['user-agent'];\n\n const { username, email, password, identifier, accessToken, accessCode } = credentials;\n\n console.log(credentials , '=========================');\n \n try {\n if (accessCode) {\n let config = {\n method: 'get',\n url: `${process.env.API_URL}/api/iam/google/authenticate?accessCode=${accessCode}`,\n headers: {\n 'User-Agent': userAgent,\n }\n };\n const loginResponse = await axios.request(config);\n if (loginResponse.status == 400) {\n throw new Error(loginResponse.data.message);\n }\n if (loginResponse.status == 401) {\n throw new Error(loginResponse.data.message);\n }\n\n let base64decoded = jwtDecode(loginResponse.data.data.accessToken);\n // let accessTokenExpires = base64decoded.exp;\n let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;\n\n return {\n accessToken: loginResponse.data.data.accessToken,\n refreshToken: loginResponse.data.data.refreshToken,\n accessTokenExpires: accessTokenExpires,\n ...loginResponse.data.data,\n };\n\n } else {\n if (accessToken) {\n let data = JSON.stringify({\n username: identifier,\n email: identifier.includes('@')? identifier : null,\n password: password\n });\n\n let config = {\n method: 'get',\n url: `${process.env.API_URL}/api/iam/me`,\n headers: {\n 'accept': '*/*',\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${accessToken}`\n }\n };\n\n\n const loginResponse = await axios.request(config);\n\n if (loginResponse.status == 400) {\n throw new Error(loginResponse.data.message);\n }\n if (loginResponse.status == 401) {\n throw new Error(loginResponse.data.message);\n }\n \n let base64decoded = jwtDecode(accessToken);\n // let accessTokenExpires = base64decoded.exp;\n let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;\n\n return {\n accessToken: accessToken,\n refreshToken: loginResponse.data.data.refreshToken,\n accessTokenExpires: accessTokenExpires,\n ...loginResponse.data.data,\n };\n\n } else {\n\n let data = JSON.stringify({\n username: identifier,\n email: identifier.includes('@')? identifier : null,\n password: password\n });\n\n let config = {\n method: 'post',\n maxBodyLength: Infinity,\n url: `${process.env.API_URL}/api/iam/authenticate`,\n headers: {\n 'accept': '*/*',\n 'Content-Type': 'application/json',\n 'User-Agent': userAgent,\n },\n data: data\n };\n\n\n const loginResponse = await axios.request(config);\n\n // const authenticateResponse = await fetch(\n // `${process.env.API_URL}/api/iam/authenticate`,\n // {\n // method: \"Post\",\n // headers: {\n // 'accept': '*/*', \n // \"Content-Type\": \"application/json\"\n // },\n // body: JSON.stringify({\n // username: email,\n // email: email,\n // password: password\n // })\n // }\n // );\n\n // const loginResponse = await authenticateResponse.json();\n\n // const response = await fetch(\n // `${process.env.API_URL}/api/iam/me`,\n // {\n // method: \"Get\",\n // headers: {\n // \"Content-Type\": \"application/json\",\n // \"Authorization\": `Bearer ${loginResponse.data.accessToken}`,\n // },\n // }\n // );\n\n // const responseData = await response.json();\n\n if (loginResponse.status == 400) {\n throw new Error(loginResponse.data.message);\n }\n if (loginResponse.status == 401) {\n throw new Error(loginResponse.data.data.message);\n }\n let base64decoded = jwtDecode(loginResponse.data.data.accessToken);\n // let accessTokenExpires = base64decoded.exp;\n let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;\n const returnResponse = {\n accessToken: loginResponse.data.data.accessToken,\n refreshToken: loginResponse.data.data.refreshToken,\n accessTokenExpires: accessTokenExpires,\n ...loginResponse.data.data,\n }\n return returnResponse;\n }\n }\n } catch (error: any) {\n throw new Error(error?.response?.data?.message);\n }\n },\n }),\n ],\n callbacks: {\n // @ts-ignore\n jwt: async ({ token, user }) => {\n // console.log(\"JWT callback called\");\n const bufferTime = 60000;\n if (Date.now() >= (token.accessTokenExpires as number - bufferTime)) {\n // Call the refresh token function\n return await refreshAccessToken(token);\n }\n\n // If there is no user (first time login or session), we return the user data\n if (user) {\n // const base64decoded = jwtDecode(user.accessToken);\n // Convert from seconds to milliseconds\n // const accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000; \n // const accessTokenExpires = user.accessTokenExpires * 1000; \n return {\n ...token,\n accessToken: user.accessToken,\n refreshToken: user.refreshToken,\n accessTokenExpires: user.accessTokenExpires,\n user: user, // Include the user data here\n };\n }\n\n return token; // If no update needed, just return the existing token\n },\n // @ts-ignore\n session: async ({ session, token }) => {\n // console.log(\"Session callback called\");\n\n const user = token.user || {}; // Default to an empty object if user is undefined or null\n session.error = token.error ? token.error : null;\n // if (token.error) {\n // return null\n // }\n session.user = {\n ...user, // Include the user info from the token\n accessToken: token?.accessToken, // Add the access token to session for client use\n refreshToken: token?.refreshToken, // Add refresh token to session for future use\n accessTokenExpires: token?.accessTokenExpires && token?.accessTokenExpires, // Store the expiry time\n };\n return session;\n\n },\n },\n pages: {\n signIn: \"/auth/login\",\n },\n secret: process.env.NEXTAUTH_SECRET,\n}\n\nexport default authProviders"]}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import CredentialsProvider from "next-auth/providers/credentials";
|
|
2
|
-
import GoogleProvider from "next-auth/providers/google";
|
|
3
|
-
import { NextRequest } from "next/server";
|
|
4
|
-
import { jwtDecode } from "jwt-decode";
|
|
5
|
-
import { JWT } from "next-auth/jwt";
|
|
6
|
-
import axios from "axios";
|
|
7
|
-
import { signOut } from "next-auth/react";
|
|
8
|
-
import { refreshAccessToken } from "./refreshAccessToken";
|
|
9
|
-
import { NextAuthOptions } from "next-auth";
|
|
10
|
-
|
|
11
|
-
type Credentials = {
|
|
12
|
-
username: string,
|
|
13
|
-
email: string,
|
|
14
|
-
password: string,
|
|
15
|
-
identifier:string,
|
|
16
|
-
accessToken: string,
|
|
17
|
-
accessCode: string,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const authProviders: NextAuthOptions = {
|
|
21
|
-
session: {
|
|
22
|
-
strategy: "jwt",
|
|
23
|
-
},
|
|
24
|
-
providers: [
|
|
25
|
-
GoogleProvider({
|
|
26
|
-
clientId: process.env.GOOGLE_ID!,
|
|
27
|
-
clientSecret: process.env.GOOGLE_CLIENT_SECRET!
|
|
28
|
-
}),
|
|
29
|
-
CredentialsProvider({
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
async authorize(credentials: Credentials, req: any) {
|
|
32
|
-
const userAgent = req.headers['user-agent'];
|
|
33
|
-
|
|
34
|
-
const { username, email, password, identifier, accessToken, accessCode } = credentials;
|
|
35
|
-
try {
|
|
36
|
-
if (accessCode) {
|
|
37
|
-
let config = {
|
|
38
|
-
method: 'get',
|
|
39
|
-
url: `${process.env.API_URL}/api/iam/google/authenticate?accessCode=${accessCode}`,
|
|
40
|
-
headers: {
|
|
41
|
-
'User-Agent': userAgent,
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const loginResponse = await axios.request(config);
|
|
45
|
-
if (loginResponse.status == 400) {
|
|
46
|
-
throw new Error(loginResponse.data.message);
|
|
47
|
-
}
|
|
48
|
-
if (loginResponse.status == 401) {
|
|
49
|
-
throw new Error(loginResponse.data.message);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
let base64decoded = jwtDecode(loginResponse.data.data.accessToken);
|
|
53
|
-
// let accessTokenExpires = base64decoded.exp;
|
|
54
|
-
let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
accessToken: loginResponse.data.data.accessToken,
|
|
58
|
-
refreshToken: loginResponse.data.data.refreshToken,
|
|
59
|
-
accessTokenExpires: accessTokenExpires,
|
|
60
|
-
...loginResponse.data.data,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
} else {
|
|
64
|
-
if (accessToken) {
|
|
65
|
-
let data = JSON.stringify({
|
|
66
|
-
username: identifier,
|
|
67
|
-
email: identifier.includes('@')? identifier : null,
|
|
68
|
-
password: password
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
let config = {
|
|
72
|
-
method: 'get',
|
|
73
|
-
url: `${process.env.API_URL}/api/iam/me`,
|
|
74
|
-
headers: {
|
|
75
|
-
'accept': '*/*',
|
|
76
|
-
'Content-Type': 'application/json',
|
|
77
|
-
'Authorization': `Bearer ${accessToken}`
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const loginResponse = await axios.request(config);
|
|
83
|
-
|
|
84
|
-
if (loginResponse.status == 400) {
|
|
85
|
-
throw new Error(loginResponse.data.message);
|
|
86
|
-
}
|
|
87
|
-
if (loginResponse.status == 401) {
|
|
88
|
-
throw new Error(loginResponse.data.message);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
let base64decoded = jwtDecode(accessToken);
|
|
92
|
-
// let accessTokenExpires = base64decoded.exp;
|
|
93
|
-
let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
accessToken: accessToken,
|
|
97
|
-
refreshToken: loginResponse.data.data.refreshToken,
|
|
98
|
-
accessTokenExpires: accessTokenExpires,
|
|
99
|
-
...loginResponse.data.data,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
} else {
|
|
103
|
-
|
|
104
|
-
let data = JSON.stringify({
|
|
105
|
-
username: identifier,
|
|
106
|
-
email: identifier.includes('@')? identifier : null,
|
|
107
|
-
password: password
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
let config = {
|
|
111
|
-
method: 'post',
|
|
112
|
-
maxBodyLength: Infinity,
|
|
113
|
-
url: `${process.env.API_URL}/api/iam/authenticate`,
|
|
114
|
-
headers: {
|
|
115
|
-
'accept': '*/*',
|
|
116
|
-
'Content-Type': 'application/json',
|
|
117
|
-
'User-Agent': userAgent,
|
|
118
|
-
},
|
|
119
|
-
data: data
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const loginResponse = await axios.request(config);
|
|
124
|
-
|
|
125
|
-
// const authenticateResponse = await fetch(
|
|
126
|
-
// `${process.env.API_URL}/api/iam/authenticate`,
|
|
127
|
-
// {
|
|
128
|
-
// method: "Post",
|
|
129
|
-
// headers: {
|
|
130
|
-
// 'accept': '*/*',
|
|
131
|
-
// "Content-Type": "application/json"
|
|
132
|
-
// },
|
|
133
|
-
// body: JSON.stringify({
|
|
134
|
-
// username: email,
|
|
135
|
-
// email: email,
|
|
136
|
-
// password: password
|
|
137
|
-
// })
|
|
138
|
-
// }
|
|
139
|
-
// );
|
|
140
|
-
|
|
141
|
-
// const loginResponse = await authenticateResponse.json();
|
|
142
|
-
|
|
143
|
-
// const response = await fetch(
|
|
144
|
-
// `${process.env.API_URL}/api/iam/me`,
|
|
145
|
-
// {
|
|
146
|
-
// method: "Get",
|
|
147
|
-
// headers: {
|
|
148
|
-
// "Content-Type": "application/json",
|
|
149
|
-
// "Authorization": `Bearer ${loginResponse.data.accessToken}`,
|
|
150
|
-
// },
|
|
151
|
-
// }
|
|
152
|
-
// );
|
|
153
|
-
|
|
154
|
-
// const responseData = await response.json();
|
|
155
|
-
|
|
156
|
-
if (loginResponse.status == 400) {
|
|
157
|
-
throw new Error(loginResponse.data.message);
|
|
158
|
-
}
|
|
159
|
-
if (loginResponse.status == 401) {
|
|
160
|
-
throw new Error(loginResponse.data.data.message);
|
|
161
|
-
}
|
|
162
|
-
let base64decoded = jwtDecode(loginResponse.data.data.accessToken);
|
|
163
|
-
// let accessTokenExpires = base64decoded.exp;
|
|
164
|
-
let accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
|
|
165
|
-
const returnResponse = {
|
|
166
|
-
accessToken: loginResponse.data.data.accessToken,
|
|
167
|
-
refreshToken: loginResponse.data.data.refreshToken,
|
|
168
|
-
accessTokenExpires: accessTokenExpires,
|
|
169
|
-
...loginResponse.data.data,
|
|
170
|
-
}
|
|
171
|
-
return returnResponse;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
} catch (error: any) {
|
|
175
|
-
throw new Error(error?.response?.data?.message);
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
}),
|
|
179
|
-
],
|
|
180
|
-
callbacks: {
|
|
181
|
-
// @ts-ignore
|
|
182
|
-
jwt: async ({ token, user }) => {
|
|
183
|
-
// console.log("JWT callback called");
|
|
184
|
-
const bufferTime = 60000;
|
|
185
|
-
if (Date.now() >= (token.accessTokenExpires as number - bufferTime)) {
|
|
186
|
-
// Call the refresh token function
|
|
187
|
-
return await refreshAccessToken(token);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// If there is no user (first time login or session), we return the user data
|
|
191
|
-
if (user) {
|
|
192
|
-
// const base64decoded = jwtDecode(user.accessToken);
|
|
193
|
-
// Convert from seconds to milliseconds
|
|
194
|
-
// const accessTokenExpires = base64decoded.exp && base64decoded.exp * 1000;
|
|
195
|
-
// const accessTokenExpires = user.accessTokenExpires * 1000;
|
|
196
|
-
return {
|
|
197
|
-
...token,
|
|
198
|
-
accessToken: user.accessToken,
|
|
199
|
-
refreshToken: user.refreshToken,
|
|
200
|
-
accessTokenExpires: user.accessTokenExpires,
|
|
201
|
-
user: user, // Include the user data here
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return token; // If no update needed, just return the existing token
|
|
206
|
-
},
|
|
207
|
-
// @ts-ignore
|
|
208
|
-
session: async ({ session, token }) => {
|
|
209
|
-
// console.log("Session callback called");
|
|
210
|
-
|
|
211
|
-
const user = token.user || {}; // Default to an empty object if user is undefined or null
|
|
212
|
-
session.error = token.error ? token.error : null;
|
|
213
|
-
// if (token.error) {
|
|
214
|
-
// return null
|
|
215
|
-
// }
|
|
216
|
-
session.user = {
|
|
217
|
-
...user, // Include the user info from the token
|
|
218
|
-
accessToken: token?.accessToken, // Add the access token to session for client use
|
|
219
|
-
refreshToken: token?.refreshToken, // Add refresh token to session for future use
|
|
220
|
-
accessTokenExpires: token?.accessTokenExpires && token?.accessTokenExpires, // Store the expiry time
|
|
221
|
-
};
|
|
222
|
-
return session;
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
pages: {
|
|
227
|
-
signIn: "/auth/login",
|
|
228
|
-
},
|
|
229
|
-
secret: process.env.NEXTAUTH_SECRET,
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export default authProviders
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleLogout.d.ts","sourceRoot":"./","sources":["nextAuth/handleLogout.tsx"],"names":[],"mappings":"AAIA,wBAAsB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,iBAkChD"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ERROR_MESSAGES } from '../constants/error-messages';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import { getSession, signOut } from 'next-auth/react';
|
|
4
|
-
export async function handleLogout({ toast }) {
|
|
5
|
-
const session = await getSession();
|
|
6
|
-
// const token = session?.user?.accessToken;
|
|
7
|
-
const refreshToken = session?.user?.refreshToken;
|
|
8
|
-
try {
|
|
9
|
-
const response = await axios.post(`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/iam/logout`, {
|
|
10
|
-
refreshToken: refreshToken, // Pass refresh token in body
|
|
11
|
-
});
|
|
12
|
-
console.log("logout response", response);
|
|
13
|
-
if (response?.data?.statusCode === 200) {
|
|
14
|
-
await signOut({ callbackUrl: '/auth/login' });
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
toast?.current?.show({
|
|
18
|
-
severity: 'error',
|
|
19
|
-
summary: ERROR_MESSAGES.LOGOUT_FAILED,
|
|
20
|
-
detail: `${response?.data?.data?.status}`,
|
|
21
|
-
life: 3000,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
const err = error;
|
|
27
|
-
const message = err.response?.data?.data?.message || err.message || ERROR_MESSAGES.LOGOUT_FAILED;
|
|
28
|
-
toast?.current?.show({
|
|
29
|
-
severity: 'error',
|
|
30
|
-
summary: ERROR_MESSAGES.LOGOUT_FAILED,
|
|
31
|
-
detail: message,
|
|
32
|
-
life: 3000,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=handleLogout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleLogout.js","sourceRoot":"./","sources":["nextAuth/handleLogout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D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AAI;SACb,CAAC,CAAC;KACN;AACL,CAAC","sourcesContent":["import { ERROR_MESSAGES } from '../constants/error-messages';\nimport axios, { AxiosError } from 'axios';\nimport { getSession, signOut } from 'next-auth/react';\n\nexport async function handleLogout({ toast }: any) {\n const session = await getSession();\n // const token = session?.user?.accessToken;\n const refreshToken = session?.user?.refreshToken; \n try {\n const response = await axios.post(`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/iam/logout`, \n {\n refreshToken: refreshToken, // Pass refresh token in body\n }\n );\n console.log(\"logout response\", response);\n\n if (response?.data?.statusCode === 200) {\n await signOut({ callbackUrl: '/auth/login' });\n } else {\n toast?.current?.show({\n severity: 'error',\n summary: ERROR_MESSAGES.LOGOUT_FAILED,\n detail: `${response?.data?.data?.status}`,\n life: 3000,\n });\n }\n } catch (error) {\n const err = error as any;\n const message =\n err.response?.data?.data?.message || err.message || ERROR_MESSAGES.LOGOUT_FAILED;\n\n toast?.current?.show({\n severity: 'error',\n summary: ERROR_MESSAGES.LOGOUT_FAILED,\n detail: message,\n life: 3000,\n });\n }\n}"]}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ERROR_MESSAGES } from '../constants/error-messages';
|
|
2
|
-
import axios, { AxiosError } from 'axios';
|
|
3
|
-
import { getSession, signOut } from 'next-auth/react';
|
|
4
|
-
|
|
5
|
-
export async function handleLogout({ toast }: any) {
|
|
6
|
-
const session = await getSession();
|
|
7
|
-
// const token = session?.user?.accessToken;
|
|
8
|
-
const refreshToken = session?.user?.refreshToken;
|
|
9
|
-
try {
|
|
10
|
-
const response = await axios.post(`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/iam/logout`,
|
|
11
|
-
{
|
|
12
|
-
refreshToken: refreshToken, // Pass refresh token in body
|
|
13
|
-
}
|
|
14
|
-
);
|
|
15
|
-
console.log("logout response", response);
|
|
16
|
-
|
|
17
|
-
if (response?.data?.statusCode === 200) {
|
|
18
|
-
await signOut({ callbackUrl: '/auth/login' });
|
|
19
|
-
} else {
|
|
20
|
-
toast?.current?.show({
|
|
21
|
-
severity: 'error',
|
|
22
|
-
summary: ERROR_MESSAGES.LOGOUT_FAILED,
|
|
23
|
-
detail: `${response?.data?.data?.status}`,
|
|
24
|
-
life: 3000,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
} catch (error) {
|
|
28
|
-
const err = error as any;
|
|
29
|
-
const message =
|
|
30
|
-
err.response?.data?.data?.message || err.message || ERROR_MESSAGES.LOGOUT_FAILED;
|
|
31
|
-
|
|
32
|
-
toast?.current?.show({
|
|
33
|
-
severity: 'error',
|
|
34
|
-
summary: ERROR_MESSAGES.LOGOUT_FAILED,
|
|
35
|
-
detail: message,
|
|
36
|
-
life: 3000,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"refreshAccessToken.d.ts","sourceRoot":"./","sources":["nextAuth/refreshAccessToken.tsx"],"names":[],"mappings":"AAIA,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,GAAG,gBAuBhD"}
|