@solidxai/core-ui 0.1.8-beta.0 → 0.1.8-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Svg/FileSvg.js +1 -1
- package/dist/components/Svg/FileSvg.js.map +1 -1
- package/dist/components/Svg/FileSvg.tsx +1 -1
- package/dist/components/auth/AuthLayout.d.ts.map +1 -1
- package/dist/components/auth/AuthLayout.js +94 -38
- package/dist/components/auth/AuthLayout.js.map +1 -1
- package/dist/components/auth/AuthLayout.tsx +49 -39
- 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/AuthTabs.d.ts.map +1 -1
- package/dist/components/auth/AuthTabs.js +9 -9
- package/dist/components/auth/AuthTabs.js.map +1 -1
- package/dist/components/auth/AuthTabs.tsx +14 -15
- 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/SolidForgotPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidForgotPassword.js +3 -7
- package/dist/components/auth/SolidForgotPassword.js.map +1 -1
- package/dist/components/auth/SolidForgotPassword.tsx +3 -7
- package/dist/components/auth/SolidInitialLoginOtp.d.ts.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.js +4 -7
- package/dist/components/auth/SolidInitialLoginOtp.js.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.tsx +2 -5
- package/dist/components/auth/SolidInitiateRegisterOtp.d.ts.map +1 -1
- package/dist/components/auth/SolidInitiateRegisterOtp.js +4 -7
- package/dist/components/auth/SolidInitiateRegisterOtp.js.map +1 -1
- package/dist/components/auth/SolidInitiateRegisterOtp.tsx +2 -5
- package/dist/components/auth/SolidLogin.d.ts.map +1 -1
- package/dist/components/auth/SolidLogin.js +5 -8
- package/dist/components/auth/SolidLogin.js.map +1 -1
- package/dist/components/auth/SolidLogin.tsx +5 -6
- package/dist/components/auth/SolidRegister.d.ts.map +1 -1
- package/dist/components/auth/SolidRegister.js +9 -12
- package/dist/components/auth/SolidRegister.js.map +1 -1
- package/dist/components/auth/SolidRegister.tsx +21 -11
- 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 +48 -51
- package/dist/components/common/GeneralSettings.js.map +1 -1
- package/dist/components/common/GeneralSettings.tsx +8 -25
- package/dist/components/common/SolidAdmin.js +1 -1
- package/dist/components/common/SolidAdmin.js.map +1 -1
- package/dist/components/common/SolidAdmin.tsx +1 -1
- package/dist/components/common/SolidFormStepper.js +1 -1
- package/dist/components/common/SolidFormStepper.js.map +1 -1
- package/dist/components/common/SolidFormStepper.tsx +1 -1
- package/dist/components/common/SolidThemeProvider.d.ts.map +1 -1
- package/dist/components/common/SolidThemeProvider.js +5 -21
- package/dist/components/common/SolidThemeProvider.js.map +1 -1
- package/dist/components/common/SolidThemeProvider.tsx +6 -24
- package/dist/components/common/solidModuleHome.module.css +1 -2
- package/dist/components/core/card/SolidCardView.js +1 -1
- package/dist/components/core/card/SolidCardView.js.map +1 -1
- package/dist/components/core/card/SolidCardView.tsx +1 -1
- package/dist/components/core/chatter/chatter.module.css +7 -7
- package/dist/components/core/common/PDFViewer.js +1 -1
- package/dist/components/core/common/PDFViewer.js.map +1 -1
- package/dist/components/core/common/PDFViewer.tsx +2 -2
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.module.css +1 -1
- package/dist/components/core/common/SolidGenericImport/SolidImport.module.css +3 -4
- package/dist/components/core/common/SolidGlobalSearchElement.js +3 -3
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.tsx +3 -3
- package/dist/components/core/common/dndCompat.d.ts +8 -0
- package/dist/components/core/common/dndCompat.d.ts.map +1 -0
- package/dist/components/core/common/dndCompat.js +5 -0
- package/dist/components/core/common/dndCompat.js.map +1 -0
- package/dist/components/core/common/dndCompat.ts +9 -0
- package/dist/components/core/dashboard/SolidDashboardFilterRequired.js +2 -2
- package/dist/components/core/dashboard/SolidDashboardFilterRequired.js.map +1 -1
- package/dist/components/core/dashboard/SolidDashboardFilterRequired.tsx +2 -2
- package/dist/components/core/dashboard/SolidDashboardNotAvailable.js +2 -2
- package/dist/components/core/dashboard/SolidDashboardNotAvailable.js.map +1 -1
- package/dist/components/core/dashboard/SolidDashboardNotAvailable.tsx +2 -2
- package/dist/components/core/extension/solid-core/chatterMessage/form/SolidChatterMessageCoModelEntityIdFormViewWidget.js +1 -1
- package/dist/components/core/extension/solid-core/chatterMessage/form/SolidChatterMessageCoModelEntityIdFormViewWidget.js.map +1 -1
- package/dist/components/core/extension/solid-core/chatterMessage/form/SolidChatterMessageCoModelEntityIdFormViewWidget.tsx +1 -1
- package/dist/components/core/extension/solid-core/chatterMessage/list/SolidChatterMessageCoModelEntityIdListViewWidget.js +1 -1
- package/dist/components/core/extension/solid-core/chatterMessage/list/SolidChatterMessageCoModelEntityIdListViewWidget.js.map +1 -1
- package/dist/components/core/extension/solid-core/chatterMessage/list/SolidChatterMessageCoModelEntityIdListViewWidget.tsx +1 -1
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessagesSummarizeListHeaderAction.js +1 -1
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessagesSummarizeListHeaderAction.js.map +1 -1
- package/dist/components/core/extension/solid-core/mqMessage/list/SolidMqMessagesSummarizeListHeaderAction.tsx +1 -1
- package/dist/components/core/extension/solid-core/mqMessage/ui/MqMessageStageBadge.js +1 -1
- package/dist/components/core/extension/solid-core/mqMessage/ui/MqMessageStageBadge.js.map +1 -1
- package/dist/components/core/extension/solid-core/mqMessage/ui/MqMessageStageBadge.tsx +1 -1
- package/dist/components/core/form/SolidFormActionHeader.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormActionHeader.js +4 -0
- package/dist/components/core/form/SolidFormActionHeader.js.map +1 -1
- package/dist/components/core/form/SolidFormActionHeader.tsx +12 -0
- package/dist/components/core/form/SolidFormView.js +42 -41
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/SolidFormView.tsx +16 -16
- package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.js +8 -2
- package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.tsx +8 -2
- package/dist/components/core/form/fields/SolidEmailField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidEmailField.js +5 -4
- package/dist/components/core/form/fields/SolidEmailField.js.map +1 -1
- package/dist/components/core/form/fields/SolidEmailField.tsx +17 -15
- package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.js +5 -4
- package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.tsx +3 -1
- package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidShortTextField.js +8 -6
- package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidShortTextField.tsx +7 -1
- 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/form/fields/solidFields.module.css +0 -3
- package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.d.ts +1 -1
- package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.js +1 -1
- package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.js.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.tsx +1 -1
- package/dist/components/core/kanban/KanbanCard.d.ts.map +1 -1
- package/dist/components/core/kanban/KanbanCard.js +2 -2
- package/dist/components/core/kanban/KanbanCard.js.map +1 -1
- package/dist/components/core/kanban/KanbanCard.tsx +4 -3
- package/dist/components/core/kanban/KanbanColumn.d.ts.map +1 -1
- package/dist/components/core/kanban/KanbanColumn.js +3 -3
- package/dist/components/core/kanban/KanbanColumn.js.map +1 -1
- package/dist/components/core/kanban/KanbanColumn.tsx +5 -4
- package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +42 -45
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.tsx +17 -26
- 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/SolidColumnSelector/SolidListColumnSelector.d.ts.map +1 -1
- package/dist/components/core/list/SolidColumnSelector/SolidListColumnSelector.js +4 -3
- package/dist/components/core/list/SolidColumnSelector/SolidListColumnSelector.js.map +1 -1
- package/dist/components/core/list/SolidColumnSelector/SolidListColumnSelector.tsx +13 -12
- 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 +1 -1
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.js.map +1 -1
- package/dist/components/core/list/SolidEmptyListViewPlaceholder.tsx +6 -4
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +5 -12
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +29 -49
- 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/module/CreateModule.js +1 -1
- package/dist/components/core/module/CreateModule.js.map +1 -1
- package/dist/components/core/module/CreateModule.tsx +1 -1
- package/dist/components/core/solid-ai/SolidAiChat.module.css +3 -3
- package/dist/components/core/tree/SolidTreeView.js +1 -1
- package/dist/components/core/tree/SolidTreeView.js.map +1 -1
- package/dist/components/core/tree/SolidTreeView.tsx +1 -1
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.css +283 -9
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.d.ts.map +1 -1
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.js +35 -28
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.js.map +1 -1
- package/dist/components/core/users/ApiKeysTab/ApiKeysTab.tsx +64 -62
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.d.ts +2 -1
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.d.ts.map +1 -1
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.js +4 -4
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.js.map +1 -1
- package/dist/components/core/users/ApiKeysTab/GenerateApiKeyModal.tsx +17 -10
- package/dist/components/core/users/ApiKeysTab/RevealApiKeyModal.d.ts.map +1 -1
- package/dist/components/core/users/ApiKeysTab/RevealApiKeyModal.js +2 -19
- package/dist/components/core/users/ApiKeysTab/RevealApiKeyModal.js.map +1 -1
- package/dist/components/core/users/ApiKeysTab/RevealApiKeyModal.tsx +24 -43
- package/dist/components/core/users/CreateUser.css +114 -0
- package/dist/components/core/users/CreateUser.d.ts +1 -0
- package/dist/components/core/users/CreateUser.d.ts.map +1 -1
- package/dist/components/core/users/CreateUser.js +4 -3
- package/dist/components/core/users/CreateUser.js.map +1 -1
- package/dist/components/core/users/CreateUser.tsx +32 -26
- package/dist/components/layout/AdminTopHeader.d.ts.map +1 -1
- package/dist/components/layout/AdminTopHeader.js +25 -1
- package/dist/components/layout/AdminTopHeader.js.map +1 -1
- package/dist/components/layout/AdminTopHeader.tsx +38 -1
- package/dist/components/layout/context/layoutcontext.js +2 -2
- package/dist/components/layout/context/layoutcontext.js.map +1 -1
- package/dist/components/layout/context/layoutcontext.tsx +2 -2
- 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/SolidConfirmDialog.d.ts +6 -1
- package/dist/components/shad-cn-ui/SolidConfirmDialog.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidConfirmDialog.js +3 -3
- package/dist/components/shad-cn-ui/SolidConfirmDialog.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidConfirmDialog.tsx +15 -3
- package/dist/components/shad-cn-ui/SolidDatePicker.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.js +12 -2
- package/dist/components/shad-cn-ui/SolidDatePicker.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidDatePicker.tsx +13 -2
- package/dist/components/shad-cn-ui/SolidTabs.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidTabs.js +5 -2
- package/dist/components/shad-cn-ui/SolidTabs.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidTabs.tsx +51 -25
- 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/downloadMediaFile.d.ts +1 -1
- package/dist/helpers/downloadMediaFile.d.ts.map +1 -1
- package/dist/helpers/downloadMediaFile.js +8 -66
- package/dist/helpers/downloadMediaFile.js.map +1 -1
- package/dist/helpers/downloadMediaFile.tsx +8 -18
- package/dist/resources/globals.css +104 -84
- package/dist/resources/images/Background.svg +5 -1
- package/dist/resources/images/Navigation/SolidSettinsIcon.svg +7 -1
- package/dist/resources/images/errors/error.svg +14 -10
- package/dist/resources/shadcn-base.css +120 -354
- package/dist/resources/themes/solid-dark-purple/theme.css +26 -36
- package/dist/resources/themes/solid-light-purple/theme.css +129 -129
- package/dist/routes/SolidLayoutRegistry.d.ts.map +1 -1
- package/dist/routes/SolidLayoutRegistry.js +3 -1
- package/dist/routes/SolidLayoutRegistry.js.map +1 -1
- package/dist/routes/SolidLayoutRegistry.tsx +3 -1
- package/dist/routes/guards/AuthGuard.d.ts.map +1 -1
- package/dist/routes/guards/AuthGuard.js +4 -1
- package/dist/routes/guards/AuthGuard.js.map +1 -1
- package/dist/routes/guards/AuthGuard.tsx +6 -1
- package/package.json +1 -1
- 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,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,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;gBAEvF,OAAO,CAAC,GAAG,CAAC,WAAW,EAAG,2BAA2B,CAAC,CAAC;gBAEvD,IAAI;oBACA,IAAI,UAAU,EAAE;wBACZ,IAAI,MAAM,GAAG;4BACT,MAAM,EAAE,KAAK;4BACb,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,2CAA2C,UAAU,EAAE;4BAClF,OAAO,EAAE;gCACL,YAAY,EAAE,SAAS;6BAC1B;yBACJ,CAAC;wBACF,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,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C,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,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAE,KAAK,EAAO;IAC7C,MAAM,OAAO,GAAG,MAAM,UAAU,EAAE,CAAC;IACnC,4CAA4C;IAC5C,MAAM,YAAY,GAAG,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC;IACjD,IAAI;QACA,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,iBAAiB,EAC7F;YACI,YAAY,EAAE,YAAY,EAAE,6BAA6B;SAC5D,CACA,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAEzC,IAAI,QAAQ,EAAE,IAAI,EAAE,UAAU,KAAK,GAAG,EAAE;YACpC,MAAM,OAAO,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC;SACjD;aAAM;YACH,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC;gBACjB,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE,cAAc,CAAC,aAAa;gBACrC,MAAM,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE;gBACzC,IAAI,EAAE,IAAI;aACb,CAAC,CAAC;SACN;KACJ;IAAC,OAAO,KAAK,EAAE;QACZ,MAAM,GAAG,GAAG,KAAY,CAAC;QACzB,MAAM,OAAO,GACT,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,cAAc,CAAC,aAAa,CAAC;QAErF,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC;YACjB,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,cAAc,CAAC,aAAa;YACrC,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,IAAI;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"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ERROR_MESSAGES } from "../constants/error-messages";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import { jwtDecode } from "jwt-decode";
|
|
4
|
-
export async function refreshAccessToken(token) {
|
|
5
|
-
try {
|
|
6
|
-
const response = await axios.post(`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/iam/refresh-tokens`, { refreshToken: token.refreshToken });
|
|
7
|
-
const { accessToken, refreshToken } = response.data.data;
|
|
8
|
-
const { exp: accessTokenExpires } = jwtDecode(accessToken);
|
|
9
|
-
return {
|
|
10
|
-
...token,
|
|
11
|
-
accessToken,
|
|
12
|
-
refreshToken,
|
|
13
|
-
accessTokenExpires: accessTokenExpires * 1000, // Convert seconds to milliseconds
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
console.error(ERROR_MESSAGES.FAILED_REFRESH_TOKEN, error.message || error.response?.data);
|
|
18
|
-
return {
|
|
19
|
-
// ...token,
|
|
20
|
-
error: "RefreshAccessTokenError",
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=refreshAccessToken.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"refreshAccessToken.js","sourceRoot":"./","sources":["nextAuth/refreshAccessToken.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAU;IAC/C,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAC/B,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,yBAAyB,EACnE,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CACrC,CAAC;QAEF,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QACzD,MAAM,EAAE,GAAG,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAkB,WAAW,CAAC,CAAC;QAE5E,OAAO;YACL,GAAG,KAAK;YACR,WAAW;YACX,YAAY;YACZ,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,EAAE,kCAAkC;SAClF,CAAC;KACH;IAAC,OAAO,KAAU,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,oBAAoB,EAAE,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1F,OAAO;YACL,YAAY;YACZ,KAAK,EAAE,yBAAyB;SACjC,CAAC;KACH;AACH,CAAC","sourcesContent":["import { ERROR_MESSAGES } from \"../constants/error-messages\";\nimport axios from \"axios\";\nimport { jwtDecode } from \"jwt-decode\";\n\nexport async function refreshAccessToken(token: any) {\n try {\n const response = await axios.post(\n `${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/iam/refresh-tokens`,\n { refreshToken: token.refreshToken }\n );\n \n const { accessToken, refreshToken } = response.data.data;\n const { exp: accessTokenExpires } = jwtDecode<{ exp: number }>(accessToken);\n \n return {\n ...token,\n accessToken,\n refreshToken,\n accessTokenExpires: accessTokenExpires * 1000, // Convert seconds to milliseconds\n };\n } catch (error: any) {\n console.error(ERROR_MESSAGES.FAILED_REFRESH_TOKEN, error.message || error.response?.data);\n return {\n // ...token,\n error: \"RefreshAccessTokenError\",\n };\n }\n }"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ERROR_MESSAGES } from "../constants/error-messages";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import { jwtDecode } from "jwt-decode";
|
|
4
|
-
|
|
5
|
-
export async function refreshAccessToken(token: any) {
|
|
6
|
-
try {
|
|
7
|
-
const response = await axios.post(
|
|
8
|
-
`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/iam/refresh-tokens`,
|
|
9
|
-
{ refreshToken: token.refreshToken }
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
const { accessToken, refreshToken } = response.data.data;
|
|
13
|
-
const { exp: accessTokenExpires } = jwtDecode<{ exp: number }>(accessToken);
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
...token,
|
|
17
|
-
accessToken,
|
|
18
|
-
refreshToken,
|
|
19
|
-
accessTokenExpires: accessTokenExpires * 1000, // Convert seconds to milliseconds
|
|
20
|
-
};
|
|
21
|
-
} catch (error: any) {
|
|
22
|
-
console.error(ERROR_MESSAGES.FAILED_REFRESH_TOKEN, error.message || error.response?.data);
|
|
23
|
-
return {
|
|
24
|
-
// ...token,
|
|
25
|
-
error: "RefreshAccessTokenError",
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
-
export interface ISettingsState {
|
|
3
|
-
authSettings: Record<string, any>;
|
|
4
|
-
solidSettings: Record<string, any>;
|
|
5
|
-
}
|
|
6
|
-
export declare const settingsSlice: import("@reduxjs/toolkit").Slice<ISettingsState, {
|
|
7
|
-
setSolidSettings: (state: import("immer/dist/internal.js").WritableDraft<ISettingsState>, action: PayloadAction<Record<string, any>>) => void;
|
|
8
|
-
updateSolidSetting: (state: import("immer/dist/internal.js").WritableDraft<ISettingsState>, action: PayloadAction<{
|
|
9
|
-
key: string;
|
|
10
|
-
value: any;
|
|
11
|
-
}>) => void;
|
|
12
|
-
resetSettings: () => ISettingsState;
|
|
13
|
-
}, "settingsSlice">;
|
|
14
|
-
declare const _default: import("@reduxjs/toolkit").Reducer<ISettingsState>;
|
|
15
|
-
export default _default;
|
|
16
|
-
export declare const setSolidSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<Record<string, any>, "settingsSlice/setSolidSettings">, updateSolidSetting: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
17
|
-
key: string;
|
|
18
|
-
value: any;
|
|
19
|
-
}, "settingsSlice/updateSolidSetting">, resetSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"settingsSlice/resetSettings">;
|
|
20
|
-
//# sourceMappingURL=settingsSlice.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settingsSlice.d.ts","sourceRoot":"./","sources":["redux/features/settingsSlice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpC;AAOD,eAAO,MAAM,aAAa;sGAsBZ,cAAc,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;wGAOlC,cAAc;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;;mBAQtD,CAAC;;AAEH,wBAAqC;AAErC,eAAO,MAGL,gBAAgB,8GAChB,kBAAkB;SAhBe,MAAM;WAAS,GAAG;wCAiBnD,aAAa,uFACU,CAAC"}
|