@databiosphere/findable-ui 50.8.0 → 51.0.1
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/lib/auth/constants/auth.d.ts +5 -0
- package/lib/{providers/authentication/auth/constants.js → auth/constants/auth.js} +4 -1
- package/lib/auth/constants/authentication.d.ts +5 -0
- package/lib/{providers/authentication/authentication/constants.js → auth/constants/authentication.js} +4 -1
- package/lib/auth/constants/credentials.d.ts +5 -0
- package/lib/{providers/authentication/credentials/constants.js → auth/constants/credentials.js} +3 -0
- package/lib/auth/constants/token.d.ts +5 -0
- package/lib/{providers/authentication/token/constants.js → auth/constants/token.js} +3 -0
- package/lib/{providers/authentication/auth/context.d.ts → auth/contexts/auth.d.ts} +4 -1
- package/lib/{providers/authentication/auth/context.js → auth/contexts/auth.js} +4 -1
- package/lib/auth/contexts/authentication.d.ts +5 -0
- package/lib/{providers/authentication/authentication/context.js → auth/contexts/authentication.js} +4 -1
- package/lib/auth/contexts/credentials.d.ts +5 -0
- package/lib/{providers/authentication/credentials/context.js → auth/contexts/credentials.js} +4 -1
- package/lib/{providers/authentication/auth/dispatch.d.ts → auth/dispatch/auth.d.ts} +2 -2
- package/lib/{providers/authentication/auth/dispatch.js → auth/dispatch/auth.js} +2 -2
- package/lib/{providers/authentication/authentication/dispatch.d.ts → auth/dispatch/authentication.d.ts} +2 -2
- package/lib/{providers/authentication/authentication/dispatch.js → auth/dispatch/authentication.js} +2 -2
- package/lib/auth/dispatch/credentials.d.ts +12 -0
- package/lib/{providers/authentication/credentials/dispatch.js → auth/dispatch/credentials.js} +3 -3
- package/lib/{providers/authentication/token/dispatch.d.ts → auth/dispatch/token.d.ts} +3 -3
- package/lib/{providers/authentication/token/dispatch.js → auth/dispatch/token.js} +3 -3
- package/lib/{providers/authentication/auth/hook.d.ts → auth/hooks/useAuth.d.ts} +1 -1
- package/lib/{providers/authentication/auth/hook.js → auth/hooks/useAuth.js} +1 -1
- package/lib/auth/hooks/useAuthReducer.d.ts +7 -0
- package/lib/auth/hooks/useAuthReducer.js +13 -0
- package/lib/{providers/authentication/authentication/hook.d.ts → auth/hooks/useAuthentication.d.ts} +1 -1
- package/lib/{providers/authentication/authentication/hook.js → auth/hooks/useAuthentication.js} +1 -1
- package/lib/auth/hooks/useAuthenticationReducer.d.ts +7 -0
- package/lib/auth/hooks/useAuthenticationReducer.js +13 -0
- package/lib/{providers/authentication/credentials/hook.d.ts → auth/hooks/useCredentials.d.ts} +1 -1
- package/lib/{providers/authentication/credentials/hook.js → auth/hooks/useCredentials.js} +1 -1
- package/lib/auth/hooks/useCredentialsReducer.d.ts +6 -0
- package/lib/{hooks/authentication/credentials → auth/hooks}/useCredentialsReducer.js +6 -2
- package/lib/{providers/authentication/auth/reducer.d.ts → auth/reducers/auth.d.ts} +1 -1
- package/lib/{providers/authentication/auth/reducer.js → auth/reducers/auth.js} +13 -2
- package/lib/{providers/authentication/authentication/reducer.d.ts → auth/reducers/authentication.d.ts} +1 -1
- package/lib/{providers/authentication/authentication/reducer.js → auth/reducers/authentication.js} +13 -2
- package/lib/{providers/authentication/credentials/reducer.d.ts → auth/reducers/credentials.d.ts} +1 -1
- package/lib/{providers/authentication/credentials/reducer.js → auth/reducers/credentials.js} +14 -3
- package/lib/{providers/authentication/token/reducer.d.ts → auth/reducers/token.d.ts} +1 -1
- package/lib/{providers/authentication/token/reducer.js → auth/reducers/token.js} +2 -2
- package/lib/{providers/authentication/auth/types.d.ts → auth/types/auth.d.ts} +41 -5
- package/lib/{providers/authentication/auth/types.js → auth/types/auth.js} +6 -0
- package/lib/{providers/authentication/authentication/types.d.ts → auth/types/authentication.d.ts} +46 -4
- package/lib/{providers/authentication/authentication/types.js → auth/types/authentication.js} +6 -0
- package/lib/auth/types/common.d.ts +4 -0
- package/lib/{providers/authentication/credentials/types.d.ts → auth/types/credentials.d.ts} +31 -4
- package/lib/{providers/authentication/credentials/types.js → auth/types/credentials.js} +3 -0
- package/lib/auth/types/loginProvider.d.ts +11 -0
- package/lib/{providers/authentication/token/types.d.ts → auth/types/token.d.ts} +29 -5
- package/lib/{providers/authentication/token/types.js → auth/types/token.js} +3 -0
- package/lib/common/chart/sort/utils.d.ts +1 -1
- package/lib/components/ComponentCreator/ComponentCreator.js +1 -1
- package/lib/components/ComponentCreator/components/RenderComponent/renderComponent.d.ts +1 -1
- package/lib/components/ErrorBoundary/errorBoundary.d.ts +1 -1
- package/lib/components/Export/components/DownloadCurlCommand/components/DownloadCurlCommandForm/downloadCurlCommandForm.d.ts +1 -1
- package/lib/components/Export/components/DownloadCurlCommand/components/DownloadCurlCommandNotStarted/downloadCurlCommandNotStarted.d.ts +1 -1
- package/lib/components/Export/components/DownloadCurlCommand/components/DownloadCurlCommandReady/downloadCurlCommandReady.d.ts +1 -1
- package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.d.ts +1 -1
- package/lib/components/Export/components/ExportForm/components/ExportButton/exportButton.d.ts +1 -1
- package/lib/components/Export/components/ExportForm/components/ExportExecutionEnvironmentForm/exportExecutionEnvironmentForm.d.ts +1 -1
- package/lib/components/Export/components/ExportForm/exportForm.d.ts +1 -1
- package/lib/components/Export/components/ExportToTerra/components/ExportToTerraForm/exportToTerraForm.d.ts +1 -1
- package/lib/components/Export/components/ExportToTerra/components/ExportToTerraNotStarted/exportToTerraNotStarted.d.ts +1 -1
- package/lib/components/Export/components/ExportToTerra/components/ExportToTerraReady/exportToTerraReady.d.ts +1 -1
- package/lib/components/Export/components/ExportToTerra/components/ExportToTerraReady/exportToTerraReady.js +2 -2
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/AcceptTerraTOS/acceptTerraTOS.js +1 -1
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/terraSetUpForm.js +2 -2
- package/lib/components/Export/components/ExportToTerra/exportToTerra.d.ts +1 -1
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestDownload/fileManifestDownload.js +1 -1
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadNotStarted/manifestDownloadNotStarted.d.ts +1 -1
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadReady/manifestDownloadReady.d.ts +1 -1
- package/lib/components/Export/components/ManifestDownload/manifestDownload.d.ts +1 -1
- package/lib/components/Filter/components/VariableSizeListItem/variableSizeListItem.d.ts +1 -1
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.js +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/search.d.ts +1 -1
- package/lib/components/Login/components/Buttons/buttons.d.ts +1 -1
- package/lib/components/Login/components/Buttons/buttons.js +1 -1
- package/lib/components/Login/components/Buttons/types.d.ts +5 -5
- package/lib/components/Login/hooks/useUserLogin/types.d.ts +1 -1
- package/lib/components/Login/hooks/useUserLogin/useUserLogin.js +1 -1
- package/lib/components/Login/login.d.ts +1 -1
- package/lib/components/Login/login.js +1 -1
- package/lib/components/Login/types.d.ts +3 -4
- package/lib/components/MarkdownRenderer/components/Anchor/anchor.d.ts +1 -1
- package/lib/components/MarkdownRenderer/components/Table/table.d.ts +1 -1
- package/lib/components/MarkdownRenderer/markdownRenderer.js +2 -2
- package/lib/components/MarkdownRenderer/types.d.ts +1 -1
- package/lib/components/Support/components/SupportRequest/components/Dialog/dialog.d.ts +1 -1
- package/lib/components/Support/components/SupportRequest/components/SupportRequestForm/supportRequestForm.d.ts +1 -1
- package/lib/components/common/Button/components/CallToActionButton/callToActionButton.d.ts +1 -1
- package/lib/components/common/Chip/components/Beta/beta.styles.js +1 -1
- package/lib/components/common/IconBadge/iconBadge.d.ts +1 -1
- package/lib/components/common/IconButton/iconButton.d.ts +1 -1
- package/lib/components/common/Input/input.d.ts +1 -1
- package/lib/components/common/KeyValuePairs/keyValuePairs.d.ts +1 -1
- package/lib/components/common/Progress/components/CircularProgress/circularProgress.d.ts +1 -1
- package/lib/components/common/Stack/components/Divider/divider.d.ts +1 -1
- package/lib/components/common/StatusIcon/statusIcon.d.ts +1 -1
- package/lib/config/entities.d.ts +4 -4
- package/lib/google/config.d.ts +7 -0
- package/lib/google/config.js +14 -0
- package/lib/google/constants.d.ts +16 -0
- package/lib/google/constants.js +24 -0
- package/lib/google/hooks/useGoogleSignInService.d.ts +8 -0
- package/lib/{providers/googleSignInAuthentication → google}/hooks/useGoogleSignInService.js +7 -2
- package/lib/{hooks/authentication/token → google/hooks}/useTokenReducer.d.ts +2 -1
- package/lib/{hooks/authentication/token → google/hooks}/useTokenReducer.js +3 -2
- package/lib/google/provider.d.ts +11 -0
- package/lib/{providers/googleSignInAuthentication → google}/provider.js +19 -11
- package/lib/google/service.d.ts +18 -0
- package/lib/{providers/googleSignInAuthentication/service → google}/service.js +20 -9
- package/lib/google/session-controller.d.ts +11 -0
- package/lib/{components/Authentication/components/SessionController/components/GoogleSessionController/SessionController.js → google/session-controller.js} +14 -6
- package/lib/google/types.d.ts +58 -0
- package/lib/{providers/authentication/authentication/utils.d.ts → google/utils/auth.d.ts} +6 -0
- package/lib/{providers/authentication/authentication/utils.js → google/utils/auth.js} +10 -0
- package/lib/{providers/googleSignInAuthentication/profile/utils.d.ts → google/utils/profile.d.ts} +2 -2
- package/lib/{providers/googleSignInAuthentication/profile/utils.js → google/utils/profile.js} +1 -1
- package/lib/hooks/authentication/profile/types.d.ts +1 -1
- package/lib/hooks/authentication/profile/useProfile.js +3 -3
- package/lib/hooks/authentication/providers/types.d.ts +1 -1
- package/lib/hooks/authentication/session/useSessionActive.d.ts +2 -2
- package/lib/hooks/authentication/session/useSessionActive.js +2 -2
- package/lib/hooks/authentication/terra/useAuthenticationForm.js +1 -1
- package/lib/hooks/authentication/terra/useAuthenticationNIHExpiry.js +2 -2
- package/lib/hooks/authentication/token/types.d.ts +1 -1
- package/lib/hooks/authentication/token/useToken.js +1 -1
- package/lib/hooks/useEntityList.js +10 -0
- package/lib/{components/Authentication/components/SessionController/components/NextSessionController → nextauth}/constants.d.ts +8 -2
- package/lib/{components/Authentication/components/SessionController/components/NextSessionController → nextauth}/constants.js +8 -2
- package/lib/nextauth/hooks/useNextAuthService.d.ts +6 -0
- package/lib/{providers/nextAuthAuthentication → nextauth}/hooks/useNextAuthService.js +7 -3
- package/lib/nextauth/provider.d.ts +12 -0
- package/lib/{providers/nextAuthAuthentication → nextauth}/provider.js +16 -7
- package/lib/nextauth/service.d.ts +20 -0
- package/lib/{providers/nextAuthAuthentication/service → nextauth}/service.js +14 -0
- package/lib/nextauth/session-controller.d.ts +10 -0
- package/lib/{components/Authentication/components/SessionController/components/NextSessionController/SessionController.js → nextauth/session-controller.js} +11 -4
- package/lib/{providers/nextAuthAuthentication → nextauth}/types.d.ts +9 -0
- package/lib/{components/Authentication/components/SessionController/components/NextSessionController → nextauth}/utils.d.ts +2 -2
- package/lib/{components/Authentication/components/SessionController/components/NextSessionController → nextauth}/utils.js +2 -2
- package/lib/providers/exploreState.js +1 -10
- package/lib/providers/loginGuard/provider.js +1 -1
- package/lib/terra/constants.d.ts +28 -0
- package/lib/{providers/authentication/terra/hooks/common → terra}/constants.js +16 -1
- package/lib/terra/context.d.ts +5 -0
- package/lib/{providers/authentication/terra → terra}/context.js +4 -1
- package/lib/{providers/authentication/terra → terra}/hooks/useFetchProfiles.d.ts +12 -4
- package/lib/{providers/authentication/terra → terra}/hooks/useFetchProfiles.js +9 -4
- package/lib/{providers/authentication/terra → terra}/hooks/useFetchTerraNIHProfile.d.ts +2 -6
- package/lib/{providers/authentication/terra → terra}/hooks/useFetchTerraNIHProfile.js +4 -5
- package/lib/terra/hooks/useFetchTerraProfile.d.ts +10 -0
- package/lib/{providers/authentication/terra → terra}/hooks/useFetchTerraProfile.js +4 -5
- package/lib/{providers/authentication/terra → terra}/hooks/useFetchTerraTermsOfService.d.ts +2 -7
- package/lib/{providers/authentication/terra → terra}/hooks/useFetchTerraTermsOfService.js +4 -5
- package/lib/{providers/authentication/terra/hook.d.ts → terra/hooks/useTerraProfile.d.ts} +1 -1
- package/lib/{providers/authentication/terra/hook.js → terra/hooks/useTerraProfile.js} +1 -1
- package/lib/terra/provider.d.ts +10 -0
- package/lib/{providers/authentication/terra → terra}/provider.js +13 -6
- package/lib/terra/types/common.d.ts +50 -0
- package/lib/terra/types/common.js +19 -0
- package/lib/terra/types/context.d.ts +12 -0
- package/lib/terra/types/terra-nih.d.ts +8 -0
- package/lib/{providers/authentication/terra/hooks/useFetchTerraProfile.d.ts → terra/types/terra-profile.d.ts} +9 -8
- package/lib/terra/types/terra-tos.d.ts +9 -0
- package/lib/terra/types/terra-tos.js +1 -0
- package/lib/terra/utils.d.ts +47 -0
- package/lib/{providers/authentication/terra → terra}/utils.js +45 -2
- package/lib/utils/mdx/plugins/rehypeSlug.d.ts +1 -1
- package/lib/views/ExploreView/entityList/filters/components/ToggleButtonGroup/toggleButtonGroup.js +2 -3
- package/lib/views/ExploreView/entityList/filters/components/ToggleButtonGroup/toggleButtonGroup.styles.js +1 -1
- package/lib/views/ExploreView/exploreView.js +2 -2
- package/lib/views/LoginView/loginView.d.ts +2 -2
- package/lib/views/ResearchView/assistant/components/Drawer/drawer.js +2 -2
- package/lib/views/ResearchView/assistant/components/Input/input.styles.js +1 -1
- package/lib/views/ResearchView/assistant/components/Input/stories/input.stories.js +1 -1
- package/lib/views/ResearchView/assistant/components/Messages/components/PromptMessage/components/Chips/chips.styles.js +1 -1
- package/lib/views/ResearchView/assistant/components/Messages/messages.js +1 -1
- package/lib/views/ResearchView/assistant/components/Messages/messages.styles.js +1 -1
- package/lib/views/ResearchView/assistant/components/Messages/stories/args.js +1 -1
- package/lib/views/ResearchView/assistant/components/Messages/stories/messages.stories.js +1 -1
- package/lib/views/ResearchView/assistant/components/ToggleButtonGroup/stories/toggleButtonGroup.stories.js +1 -1
- package/lib/views/ResearchView/assistant/components/ToggleButtonGroup/toggleButtonGroup.js +2 -2
- package/lib/views/ResearchView/assistant/stories/assistant.stories.js +1 -1
- package/lib/views/ResearchView/state/query/hooks/UseSubmit/hook.js +2 -2
- package/package.json +15 -1
- package/types/data-explorer-ui.d.ts +12 -12
- package/lib/components/Authentication/components/SessionController/components/GoogleSessionController/SessionController.d.ts +0 -3
- package/lib/components/Authentication/components/SessionController/components/GoogleSessionController/types.d.ts +0 -6
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/SessionController.d.ts +0 -3
- package/lib/components/Authentication/components/SessionController/components/NextSessionController/types.d.ts +0 -4
- package/lib/hooks/authentication/auth/useAuthReducer.d.ts +0 -2
- package/lib/hooks/authentication/auth/useAuthReducer.js +0 -8
- package/lib/hooks/authentication/authentication/useAuthenticationReducer.d.ts +0 -2
- package/lib/hooks/authentication/authentication/useAuthenticationReducer.js +0 -8
- package/lib/hooks/authentication/credentials/useCredentialsReducer.d.ts +0 -2
- package/lib/providers/authentication/auth/actions.d.ts +0 -8
- package/lib/providers/authentication/auth/actions.js +0 -12
- package/lib/providers/authentication/auth/constants.d.ts +0 -2
- package/lib/providers/authentication/authentication/actions.d.ts +0 -8
- package/lib/providers/authentication/authentication/actions.js +0 -12
- package/lib/providers/authentication/authentication/constants.d.ts +0 -2
- package/lib/providers/authentication/authentication/context.d.ts +0 -2
- package/lib/providers/authentication/common/types.d.ts +0 -1
- package/lib/providers/authentication/credentials/actions.d.ts +0 -8
- package/lib/providers/authentication/credentials/actions.js +0 -12
- package/lib/providers/authentication/credentials/constants.d.ts +0 -2
- package/lib/providers/authentication/credentials/context.d.ts +0 -2
- package/lib/providers/authentication/credentials/dispatch.d.ts +0 -12
- package/lib/providers/authentication/terra/context.d.ts +0 -2
- package/lib/providers/authentication/terra/hooks/common/constants.d.ts +0 -6
- package/lib/providers/authentication/terra/hooks/common/entities.d.ts +0 -21
- package/lib/providers/authentication/terra/hooks/common/entities.js +0 -7
- package/lib/providers/authentication/terra/hooks/common/utils.d.ts +0 -15
- package/lib/providers/authentication/terra/hooks/common/utils.js +0 -25
- package/lib/providers/authentication/terra/hooks/utils.d.ts +0 -16
- package/lib/providers/authentication/terra/hooks/utils.js +0 -19
- package/lib/providers/authentication/terra/provider.d.ts +0 -3
- package/lib/providers/authentication/terra/types.d.ts +0 -20
- package/lib/providers/authentication/terra/types.js +0 -6
- package/lib/providers/authentication/terra/utils.d.ts +0 -19
- package/lib/providers/authentication/token/constants.d.ts +0 -2
- package/lib/providers/googleSignInAuthentication/common/types.d.ts +0 -17
- package/lib/providers/googleSignInAuthentication/constants.d.ts +0 -4
- package/lib/providers/googleSignInAuthentication/constants.js +0 -12
- package/lib/providers/googleSignInAuthentication/hooks/useGoogleSignInService.d.ts +0 -3
- package/lib/providers/googleSignInAuthentication/profile/types.d.ts +0 -14
- package/lib/providers/googleSignInAuthentication/provider.d.ts +0 -3
- package/lib/providers/googleSignInAuthentication/service/constants.d.ts +0 -4
- package/lib/providers/googleSignInAuthentication/service/constants.js +0 -9
- package/lib/providers/googleSignInAuthentication/service/service.d.ts +0 -6
- package/lib/providers/googleSignInAuthentication/types.d.ts +0 -6
- package/lib/providers/nextAuthAuthentication/hooks/useNextAuthService.d.ts +0 -2
- package/lib/providers/nextAuthAuthentication/provider.d.ts +0 -3
- package/lib/providers/nextAuthAuthentication/service/service.d.ts +0 -6
- /package/lib/{hooks/authentication/session → auth/hooks}/useSessionIdleTimer.d.ts +0 -0
- /package/lib/{hooks/authentication/session → auth/hooks}/useSessionIdleTimer.js +0 -0
- /package/lib/{components/Authentication/components/SessionController/components/GoogleSessionController/types.js → auth/types/common.js} +0 -0
- /package/lib/{components/Authentication/components/SessionController/components/NextSessionController/types.js → auth/types/loginProvider.js} +0 -0
- /package/lib/{providers/authentication/common/utils.d.ts → auth/utils/initializer.d.ts} +0 -0
- /package/lib/{providers/authentication/common/utils.js → auth/utils/initializer.js} +0 -0
- /package/lib/{providers/authentication/common → google}/types.js +0 -0
- /package/lib/{providers/googleSignInAuthentication/common → nextauth}/types.js +0 -0
- /package/lib/{providers/googleSignInAuthentication/profile/types.js → terra/types/context.js} +0 -0
- /package/lib/{providers/googleSignInAuthentication/types.js → terra/types/terra-nih.js} +0 -0
- /package/lib/{providers/nextAuthAuthentication/types.js → terra/types/terra-profile.js} +0 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
|
-
import { transformRoute } from "
|
|
3
|
-
import { useRouteHistory } from "
|
|
4
|
-
import { service } from "../service
|
|
2
|
+
import { transformRoute } from "../../hooks/authentication/session/useSessionActive";
|
|
3
|
+
import { useRouteHistory } from "../../hooks/useRouteHistory";
|
|
4
|
+
import { service } from "../service";
|
|
5
|
+
/**
|
|
6
|
+
* NextAuth service hook.
|
|
7
|
+
* @returns auth service.
|
|
8
|
+
*/
|
|
5
9
|
export const useNextAuthService = () => {
|
|
6
10
|
const { callbackUrl } = useRouteHistory(2);
|
|
7
11
|
const onLogin = useCallback((providerId) => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from "react";
|
|
2
|
+
import { NextAuthAuthenticationProviderProps } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* NextAuth authentication provider.
|
|
5
|
+
* @param props - Provider props.
|
|
6
|
+
* @param props.children - Children components.
|
|
7
|
+
* @param props.refetchInterval - Session refetch interval in milliseconds.
|
|
8
|
+
* @param props.session - Initial session data.
|
|
9
|
+
* @param props.timeout - Session timeout in milliseconds.
|
|
10
|
+
* @returns authentication provider component.
|
|
11
|
+
*/
|
|
12
|
+
export declare function NextAuthAuthenticationProvider({ children, refetchInterval, session, timeout, }: NextAuthAuthenticationProviderProps): JSX.Element;
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { SessionProvider } from "next-auth/react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useAuthenticationReducer } from "
|
|
6
|
-
import {
|
|
7
|
-
import { useSessionIdleTimer } from "
|
|
8
|
-
import {
|
|
9
|
-
import { AuthenticationContext } from "../authentication/authentication/context";
|
|
3
|
+
import { AuthContext } from "../auth/contexts/auth";
|
|
4
|
+
import { AuthenticationContext } from "../auth/contexts/authentication";
|
|
5
|
+
import { useAuthenticationReducer } from "../auth/hooks/useAuthenticationReducer";
|
|
6
|
+
import { useAuthReducer } from "../auth/hooks/useAuthReducer";
|
|
7
|
+
import { useSessionIdleTimer } from "../auth/hooks/useSessionIdleTimer";
|
|
8
|
+
import { useSessionCallbackUrl } from "../hooks/authentication/session/useSessionCallbackUrl";
|
|
10
9
|
import { useNextAuthService } from "./hooks/useNextAuthService";
|
|
10
|
+
import { SessionController } from "./session-controller";
|
|
11
|
+
/**
|
|
12
|
+
* NextAuth authentication provider.
|
|
13
|
+
* @param props - Provider props.
|
|
14
|
+
* @param props.children - Children components.
|
|
15
|
+
* @param props.refetchInterval - Session refetch interval in milliseconds.
|
|
16
|
+
* @param props.session - Initial session data.
|
|
17
|
+
* @param props.timeout - Session timeout in milliseconds.
|
|
18
|
+
* @returns authentication provider component.
|
|
19
|
+
*/
|
|
11
20
|
export function NextAuthAuthenticationProvider({ children, refetchInterval = 0, session, timeout, }) {
|
|
12
21
|
const authReducer = useAuthReducer();
|
|
13
22
|
const authenticationReducer = useAuthenticationReducer();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SignInOptions, SignOutParams } from "next-auth/react";
|
|
2
|
+
import { ProviderId } from "../auth/types/common";
|
|
3
|
+
/**
|
|
4
|
+
* NextAuth service.
|
|
5
|
+
*/
|
|
6
|
+
export declare const service: {
|
|
7
|
+
/**
|
|
8
|
+
* Login with the specified provider.
|
|
9
|
+
* @param providerId - Provider identifier.
|
|
10
|
+
* @param options - Sign in options.
|
|
11
|
+
* @returns void.
|
|
12
|
+
*/
|
|
13
|
+
login: (providerId: ProviderId, options?: SignInOptions) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Logout the user.
|
|
16
|
+
* @param options - Sign out options.
|
|
17
|
+
* @returns void.
|
|
18
|
+
*/
|
|
19
|
+
logout: (options?: SignOutParams<boolean>) => void;
|
|
20
|
+
};
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { signIn, signOut } from "next-auth/react";
|
|
2
|
+
/**
|
|
3
|
+
* NextAuth service.
|
|
4
|
+
*/
|
|
2
5
|
export const service = {
|
|
6
|
+
/**
|
|
7
|
+
* Login with the specified provider.
|
|
8
|
+
* @param providerId - Provider identifier.
|
|
9
|
+
* @param options - Sign in options.
|
|
10
|
+
* @returns void.
|
|
11
|
+
*/
|
|
3
12
|
login: (providerId, options) => {
|
|
4
13
|
signIn(providerId, options).catch((e) => console.error(e));
|
|
5
14
|
},
|
|
15
|
+
/**
|
|
16
|
+
* Logout the user.
|
|
17
|
+
* @param options - Sign out options.
|
|
18
|
+
* @returns void.
|
|
19
|
+
*/
|
|
6
20
|
logout: (options) => {
|
|
7
21
|
signOut({
|
|
8
22
|
callbackUrl: options?.callbackUrl,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JSX } from "react";
|
|
2
|
+
import { SessionControllerProps } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* NextAuth session controller.
|
|
5
|
+
* Bridges NextAuth session state to auth contexts.
|
|
6
|
+
* @param props - Session controller props.
|
|
7
|
+
* @param props.children - Children components.
|
|
8
|
+
* @returns session controller component.
|
|
9
|
+
*/
|
|
10
|
+
export declare function SessionController({ children, }: SessionControllerProps): JSX.Element;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useSession } from "next-auth/react";
|
|
3
3
|
import { Fragment, useEffect } from "react";
|
|
4
|
-
import { updateAuthState } from "
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useAuthentication } from "
|
|
4
|
+
import { updateAuthState } from "../auth/dispatch/auth";
|
|
5
|
+
import { updateAuthentication } from "../auth/dispatch/authentication";
|
|
6
|
+
import { useAuth } from "../auth/hooks/useAuth";
|
|
7
|
+
import { useAuthentication } from "../auth/hooks/useAuthentication";
|
|
8
8
|
import { mapAuth, mapAuthentication } from "./utils";
|
|
9
|
+
/**
|
|
10
|
+
* NextAuth session controller.
|
|
11
|
+
* Bridges NextAuth session state to auth contexts.
|
|
12
|
+
* @param props - Session controller props.
|
|
13
|
+
* @param props.children - Children components.
|
|
14
|
+
* @returns session controller component.
|
|
15
|
+
*/
|
|
9
16
|
export function SessionController({ children, }) {
|
|
10
17
|
const { authDispatch } = useAuth();
|
|
11
18
|
const { authenticationDispatch } = useAuthentication();
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { Session } from "next-auth";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* NextAuth authentication provider props.
|
|
5
|
+
*/
|
|
3
6
|
export interface NextAuthAuthenticationProviderProps {
|
|
4
7
|
children: ReactNode | ReactNode[];
|
|
5
8
|
refetchInterval?: number;
|
|
6
9
|
session?: Session | null;
|
|
7
10
|
timeout?: number;
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Session controller props.
|
|
14
|
+
*/
|
|
15
|
+
export interface SessionControllerProps {
|
|
16
|
+
children: ReactNode | ReactNode[];
|
|
17
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SessionContextValue } from "next-auth/react";
|
|
2
|
-
import { UpdateAuthStatePayload } from "
|
|
3
|
-
import { UpdateAuthenticationPayload } from "
|
|
2
|
+
import { UpdateAuthStatePayload } from "../auth/types/auth";
|
|
3
|
+
import { UpdateAuthenticationPayload } from "../auth/types/authentication";
|
|
4
4
|
/**
|
|
5
5
|
* Returns the auth state from the session context.
|
|
6
6
|
* @param session - Session context value.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AUTH_STATUS
|
|
2
|
-
import { AUTHENTICATION_STATUS, } from "
|
|
1
|
+
import { AUTH_STATUS } from "../auth/types/auth";
|
|
2
|
+
import { AUTHENTICATION_STATUS, } from "../auth/types/authentication";
|
|
3
3
|
import { AUTH_STATUS_MAP, AUTHENTICATION_STATUS_MAP } from "./constants";
|
|
4
4
|
/**
|
|
5
5
|
* Returns the auth state from the session context.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext,
|
|
3
|
-
import { useToken } from "../hooks/authentication/token/useToken";
|
|
2
|
+
import { createContext, useMemo, useReducer, useState, } from "react";
|
|
4
3
|
import { META_COMMAND } from "../hooks/stateSyncManager/hooks/UseMetaCommands/types";
|
|
5
4
|
import { buildCategoryViews, buildNextFilterState, } from "../hooks/useCategoryFilter";
|
|
6
5
|
import { useConfig } from "../hooks/useConfig";
|
|
@@ -40,7 +39,6 @@ export const ExploreStateContext = createContext({
|
|
|
40
39
|
export function ExploreStateProvider({ children, entityListType, }) {
|
|
41
40
|
const { config, defaultEntityListType } = useConfig();
|
|
42
41
|
const { decodedCatalogParam, decodedFeatureFlagParam, decodedFilterParam } = useURLFilterParams();
|
|
43
|
-
const { token } = useToken();
|
|
44
42
|
const entityList = entityListType || defaultEntityListType;
|
|
45
43
|
const [initializerArg] = useState(() => initReducerArguments(config, entityList, decodedFilterParam, decodedCatalogParam, decodedFeatureFlagParam));
|
|
46
44
|
const [exploreState, exploreDispatch] = useReducer((s, a) => exploreReducer(s, a, {
|
|
@@ -51,13 +49,6 @@ export function ExploreStateProvider({ children, entityListType, }) {
|
|
|
51
49
|
const exploreContextValue = useMemo(() => {
|
|
52
50
|
return { exploreDispatch, exploreState };
|
|
53
51
|
}, [exploreDispatch, exploreState]);
|
|
54
|
-
// Reset explore response when token changes.
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
exploreDispatch({
|
|
57
|
-
payload: undefined,
|
|
58
|
-
type: ExploreActionKind.ResetExploreResponse,
|
|
59
|
-
});
|
|
60
|
-
}, [exploreDispatch, token]);
|
|
61
52
|
return (_jsx(ExploreStateContext.Provider, { value: exploreContextValue, children: children }));
|
|
62
53
|
}
|
|
63
54
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { useAuth } from "../../auth/hooks/useAuth";
|
|
3
4
|
import { LoginDialog } from "../../components/common/LoginDialog/loginDialog";
|
|
4
5
|
import { useAuthenticationConfig } from "../../hooks/authentication/config/useAuthenticationConfig";
|
|
5
6
|
import { useConfig } from "../../hooks/useConfig";
|
|
6
|
-
import { useAuth } from "../authentication/auth/hook";
|
|
7
7
|
import { LoginGuardContext } from "./context";
|
|
8
8
|
/**
|
|
9
9
|
* LoginGuardProvider is responsible for intercepting actions that require user authentication.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LoginStatus } from "./types/common";
|
|
2
|
+
import { TerraNIHResponse } from "./types/terra-nih";
|
|
3
|
+
import { TerraResponse } from "./types/terra-profile";
|
|
4
|
+
import { TerraTermsOfServiceResponse } from "./types/terra-tos";
|
|
5
|
+
/**
|
|
6
|
+
* Login response type - union of all Terra response types.
|
|
7
|
+
*/
|
|
8
|
+
export type LoginResponse = TerraResponse | TerraNIHResponse | TerraTermsOfServiceResponse;
|
|
9
|
+
/**
|
|
10
|
+
* Login status: failed.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LOGIN_STATUS_FAILED: LoginStatus<never>;
|
|
13
|
+
/**
|
|
14
|
+
* Login status: not started.
|
|
15
|
+
*/
|
|
16
|
+
export declare const LOGIN_STATUS_NOT_STARTED: LoginStatus<never>;
|
|
17
|
+
/**
|
|
18
|
+
* Login status: not supported.
|
|
19
|
+
*/
|
|
20
|
+
export declare const LOGIN_STATUS_NOT_SUPPORTED: LoginStatus<never>;
|
|
21
|
+
/**
|
|
22
|
+
* Login status: pending.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LOGIN_STATUS_PENDING: LoginStatus<never>;
|
|
25
|
+
/**
|
|
26
|
+
* Terra service ID.
|
|
27
|
+
*/
|
|
28
|
+
export declare const TERRA_SERVICE_ID = "terra";
|
|
@@ -1,26 +1,41 @@
|
|
|
1
|
-
import { REQUEST_STATUS } from "./
|
|
1
|
+
import { REQUEST_STATUS } from "./types/common";
|
|
2
|
+
/**
|
|
3
|
+
* Login status: failed.
|
|
4
|
+
*/
|
|
2
5
|
export const LOGIN_STATUS_FAILED = {
|
|
3
6
|
isSuccess: false,
|
|
4
7
|
isSupported: true,
|
|
5
8
|
requestStatus: REQUEST_STATUS.FAILED,
|
|
6
9
|
response: undefined,
|
|
7
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Login status: not started.
|
|
13
|
+
*/
|
|
8
14
|
export const LOGIN_STATUS_NOT_STARTED = {
|
|
9
15
|
isSuccess: false,
|
|
10
16
|
isSupported: true,
|
|
11
17
|
requestStatus: REQUEST_STATUS.NOT_STARTED,
|
|
12
18
|
response: undefined,
|
|
13
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Login status: not supported.
|
|
22
|
+
*/
|
|
14
23
|
export const LOGIN_STATUS_NOT_SUPPORTED = {
|
|
15
24
|
isSuccess: false,
|
|
16
25
|
isSupported: false,
|
|
17
26
|
requestStatus: REQUEST_STATUS.NOT_STARTED,
|
|
18
27
|
response: undefined,
|
|
19
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Login status: pending.
|
|
31
|
+
*/
|
|
20
32
|
export const LOGIN_STATUS_PENDING = {
|
|
21
33
|
isSuccess: false,
|
|
22
34
|
isSupported: true,
|
|
23
35
|
requestStatus: REQUEST_STATUS.PENDING,
|
|
24
36
|
response: undefined,
|
|
25
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Terra service ID.
|
|
40
|
+
*/
|
|
26
41
|
export const TERRA_SERVICE_ID = "terra";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
|
-
import { LOGIN_STATUS_NOT_STARTED } from "./
|
|
2
|
+
import { LOGIN_STATUS_NOT_STARTED } from "./constants";
|
|
3
|
+
/**
|
|
4
|
+
* Terra profile context.
|
|
5
|
+
*/
|
|
3
6
|
export const TerraProfileContext = createContext({
|
|
4
7
|
terraNIHProfileLoginStatus: LOGIN_STATUS_NOT_STARTED,
|
|
5
8
|
terraProfileLoginStatus: LOGIN_STATUS_NOT_STARTED,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { LoginStatus } from "
|
|
2
|
-
import { TerraNIHResponse } from "
|
|
3
|
-
import { TerraResponse } from "
|
|
4
|
-
import { TerraTermsOfServiceResponse } from "
|
|
1
|
+
import { LoginStatus } from "../types/common";
|
|
2
|
+
import { TerraNIHResponse } from "../types/terra-nih";
|
|
3
|
+
import { TerraResponse } from "../types/terra-profile";
|
|
4
|
+
import { TerraTermsOfServiceResponse } from "../types/terra-tos";
|
|
5
|
+
/**
|
|
6
|
+
* Fetch profiles return type.
|
|
7
|
+
*/
|
|
5
8
|
export interface UseFetchProfiles {
|
|
6
9
|
isAuthenticated: boolean;
|
|
7
10
|
isComplete: boolean;
|
|
@@ -10,4 +13,9 @@ export interface UseFetchProfiles {
|
|
|
10
13
|
terraProfileLoginStatus: LoginStatus<TerraResponse>;
|
|
11
14
|
terraTOSLoginStatus: LoginStatus<TerraTermsOfServiceResponse>;
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Fetches all Terra profiles.
|
|
18
|
+
* @param token - Token.
|
|
19
|
+
* @returns fetch profiles state.
|
|
20
|
+
*/
|
|
13
21
|
export declare const useFetchProfiles: (token?: string) => UseFetchProfiles;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
import { useAuthentication } from "../../
|
|
3
|
-
import { TERRA_PROFILE_STATUS } from "../types";
|
|
2
|
+
import { useAuthentication } from "../../auth/hooks/useAuthentication";
|
|
3
|
+
import { TERRA_PROFILE_STATUS } from "../types/common";
|
|
4
4
|
import { getProfileStatus } from "../utils";
|
|
5
|
-
import { useFetchTerraNIHProfile
|
|
5
|
+
import { useFetchTerraNIHProfile } from "./useFetchTerraNIHProfile";
|
|
6
6
|
import { useFetchTerraProfile } from "./useFetchTerraProfile";
|
|
7
|
-
import { useFetchTerraTermsOfService
|
|
7
|
+
import { useFetchTerraTermsOfService } from "./useFetchTerraTermsOfService";
|
|
8
|
+
/**
|
|
9
|
+
* Fetches all Terra profiles.
|
|
10
|
+
* @param token - Token.
|
|
11
|
+
* @returns fetch profiles state.
|
|
12
|
+
*/
|
|
8
13
|
export const useFetchProfiles = (token) => {
|
|
9
14
|
const [status, setStatus] = useState(TERRA_PROFILE_STATUS.PENDING);
|
|
10
15
|
const { authenticationState: { profile }, } = useAuthentication();
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { LoginStatus } from "
|
|
1
|
+
import { LoginStatus } from "../types/common";
|
|
2
|
+
import { TerraNIHResponse } from "../types/terra-nih";
|
|
2
3
|
type Status = LoginStatus<TerraNIHResponse>;
|
|
3
|
-
export interface TerraNIHResponse {
|
|
4
|
-
authenticated?: boolean;
|
|
5
|
-
expirationTimestamp: string;
|
|
6
|
-
externalUserId: string;
|
|
7
|
-
}
|
|
8
4
|
/**
|
|
9
5
|
* Returns Terra NIH login status from configured endpoint.
|
|
10
6
|
* @param token - Token.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import { useAuthenticationConfig } from "
|
|
3
|
-
import { LOGIN_STATUS_FAILED, LOGIN_STATUS_NOT_STARTED, LOGIN_STATUS_PENDING, TERRA_SERVICE_ID, } from "
|
|
4
|
-
import { REQUEST_STATUS } from "
|
|
5
|
-
import { getAuthenticationRequestOptions, initLoginStatus, } from "
|
|
6
|
-
import { getServiceEndpoint } from "./utils";
|
|
2
|
+
import { useAuthenticationConfig } from "../../hooks/authentication/config/useAuthenticationConfig";
|
|
3
|
+
import { LOGIN_STATUS_FAILED, LOGIN_STATUS_NOT_STARTED, LOGIN_STATUS_PENDING, TERRA_SERVICE_ID, } from "../constants";
|
|
4
|
+
import { REQUEST_STATUS } from "../types/common";
|
|
5
|
+
import { getAuthenticationRequestOptions, getServiceEndpoint, initLoginStatus, } from "../utils";
|
|
7
6
|
const ENDPOINT_ID = "nihStatus";
|
|
8
7
|
/**
|
|
9
8
|
* Returns Terra NIH login status from configured endpoint.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LoginStatus } from "../types/common";
|
|
2
|
+
import { TerraResponse } from "../types/terra-profile";
|
|
3
|
+
type Status = LoginStatus<TerraResponse>;
|
|
4
|
+
/**
|
|
5
|
+
* Returns Terra profile login status from configured endpoint.
|
|
6
|
+
* @param token - Token.
|
|
7
|
+
* @returns Terra profile login status.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useFetchTerraProfile: (token?: string) => Status;
|
|
10
|
+
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import { useAuthenticationConfig } from "
|
|
3
|
-
import { LOGIN_STATUS_FAILED, LOGIN_STATUS_NOT_STARTED, LOGIN_STATUS_PENDING, TERRA_SERVICE_ID, } from "
|
|
4
|
-
import { REQUEST_STATUS, } from "
|
|
5
|
-
import { getAuthenticationRequestOptions, initLoginStatus, } from "
|
|
6
|
-
import { getServiceEndpoint } from "./utils";
|
|
2
|
+
import { useAuthenticationConfig } from "../../hooks/authentication/config/useAuthenticationConfig";
|
|
3
|
+
import { LOGIN_STATUS_FAILED, LOGIN_STATUS_NOT_STARTED, LOGIN_STATUS_PENDING, TERRA_SERVICE_ID, } from "../constants";
|
|
4
|
+
import { REQUEST_STATUS, } from "../types/common";
|
|
5
|
+
import { getAuthenticationRequestOptions, getServiceEndpoint, initLoginStatus, } from "../utils";
|
|
7
6
|
const ENDPOINT_ID = "profile";
|
|
8
7
|
/**
|
|
9
8
|
* Returns Terra profile login status from configured endpoint.
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { LoginStatus } from "
|
|
1
|
+
import { LoginStatus } from "../types/common";
|
|
2
|
+
import { TerraTermsOfServiceResponse } from "../types/terra-tos";
|
|
2
3
|
type Status = LoginStatus<TerraTermsOfServiceResponse>;
|
|
3
|
-
export interface TerraTermsOfServiceResponse {
|
|
4
|
-
currentVersion: string;
|
|
5
|
-
isEnabled: boolean;
|
|
6
|
-
isGracePeriodEnabled: boolean;
|
|
7
|
-
userAcceptedVersion?: string;
|
|
8
|
-
}
|
|
9
4
|
/**
|
|
10
5
|
* Returns Terra terms of service login status from configured endpoint.
|
|
11
6
|
* @param token - Token.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import { useAuthenticationConfig } from "
|
|
3
|
-
import { LOGIN_STATUS_FAILED, LOGIN_STATUS_NOT_STARTED, LOGIN_STATUS_PENDING, TERRA_SERVICE_ID, } from "
|
|
4
|
-
import { REQUEST_STATUS, } from "
|
|
5
|
-
import { getAuthenticationRequestOptions, initLoginStatus, } from "
|
|
6
|
-
import { getServiceEndpoint } from "./utils";
|
|
2
|
+
import { useAuthenticationConfig } from "../../hooks/authentication/config/useAuthenticationConfig";
|
|
3
|
+
import { LOGIN_STATUS_FAILED, LOGIN_STATUS_NOT_STARTED, LOGIN_STATUS_PENDING, TERRA_SERVICE_ID, } from "../constants";
|
|
4
|
+
import { REQUEST_STATUS, } from "../types/common";
|
|
5
|
+
import { getAuthenticationRequestOptions, getServiceEndpoint, initLoginStatus, } from "../utils";
|
|
7
6
|
const ENDPOINT_ID = "tos";
|
|
8
7
|
/**
|
|
9
8
|
* Returns Terra terms of service login status from configured endpoint.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JSX } from "react";
|
|
2
|
+
import { TerraProfileProviderProps } from "./types/common";
|
|
3
|
+
/**
|
|
4
|
+
* Terra profile provider.
|
|
5
|
+
* @param props - Provider props.
|
|
6
|
+
* @param props.children - Children components.
|
|
7
|
+
* @param props.token - OAuth access token.
|
|
8
|
+
* @returns terra profile provider component.
|
|
9
|
+
*/
|
|
10
|
+
export declare function TerraProfileProvider({ children, token, }: TerraProfileProviderProps): JSX.Element;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import { authComplete } from "../auth/dispatch";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useCredentials } from "../
|
|
3
|
+
import { authComplete } from "../auth/dispatch/auth";
|
|
4
|
+
import { authenticationComplete } from "../auth/dispatch/authentication";
|
|
5
|
+
import { updateCredentials } from "../auth/dispatch/credentials";
|
|
6
|
+
import { useAuth } from "../auth/hooks/useAuth";
|
|
7
|
+
import { useAuthentication } from "../auth/hooks/useAuthentication";
|
|
8
|
+
import { useCredentials } from "../auth/hooks/useCredentials";
|
|
9
9
|
import { TerraProfileContext } from "./context";
|
|
10
10
|
import { useFetchProfiles } from "./hooks/useFetchProfiles";
|
|
11
|
+
/**
|
|
12
|
+
* Terra profile provider.
|
|
13
|
+
* @param props - Provider props.
|
|
14
|
+
* @param props.children - Children components.
|
|
15
|
+
* @param props.token - OAuth access token.
|
|
16
|
+
* @returns terra profile provider component.
|
|
17
|
+
*/
|
|
11
18
|
export function TerraProfileProvider({ children, token, }) {
|
|
12
19
|
const { authDispatch } = useAuth();
|
|
13
20
|
const { authenticationDispatch } = useAuthentication();
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { TokenState } from "../../auth/types/token";
|
|
3
|
+
/**
|
|
4
|
+
* Terra profile status enum.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum TERRA_PROFILE_STATUS {
|
|
7
|
+
AUTHENTICATED = "AUTHENTICATED",
|
|
8
|
+
PENDING = "PENDING",
|
|
9
|
+
UNAUTHENTICATED = "UNAUTHENTICATED"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Request status enum.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum REQUEST_STATUS {
|
|
15
|
+
COMPLETED = "COMPLETED",
|
|
16
|
+
FAILED = "FAILED",
|
|
17
|
+
NOT_STARTED = "NOT_STARTED",
|
|
18
|
+
PENDING = "PENDING"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Terra profile provider props.
|
|
22
|
+
*/
|
|
23
|
+
export interface TerraProfileProviderProps {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
token: TokenState["token"];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Login response error.
|
|
29
|
+
*/
|
|
30
|
+
export interface LoginResponseError {
|
|
31
|
+
message: string;
|
|
32
|
+
source: string;
|
|
33
|
+
statusCode: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Login status.
|
|
37
|
+
*/
|
|
38
|
+
export interface LoginStatus<T> {
|
|
39
|
+
isSuccess: boolean;
|
|
40
|
+
isSupported: boolean;
|
|
41
|
+
requestStatus: REQUEST_STATUS;
|
|
42
|
+
response: T | undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Auth service configuration.
|
|
46
|
+
*/
|
|
47
|
+
export interface AuthService {
|
|
48
|
+
endpoint: Record<string, string>;
|
|
49
|
+
id: string;
|
|
50
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terra profile status enum.
|
|
3
|
+
*/
|
|
4
|
+
export var TERRA_PROFILE_STATUS;
|
|
5
|
+
(function (TERRA_PROFILE_STATUS) {
|
|
6
|
+
TERRA_PROFILE_STATUS["AUTHENTICATED"] = "AUTHENTICATED";
|
|
7
|
+
TERRA_PROFILE_STATUS["PENDING"] = "PENDING";
|
|
8
|
+
TERRA_PROFILE_STATUS["UNAUTHENTICATED"] = "UNAUTHENTICATED";
|
|
9
|
+
})(TERRA_PROFILE_STATUS || (TERRA_PROFILE_STATUS = {}));
|
|
10
|
+
/**
|
|
11
|
+
* Request status enum.
|
|
12
|
+
*/
|
|
13
|
+
export var REQUEST_STATUS;
|
|
14
|
+
(function (REQUEST_STATUS) {
|
|
15
|
+
REQUEST_STATUS["COMPLETED"] = "COMPLETED";
|
|
16
|
+
REQUEST_STATUS["FAILED"] = "FAILED";
|
|
17
|
+
REQUEST_STATUS["NOT_STARTED"] = "NOT_STARTED";
|
|
18
|
+
REQUEST_STATUS["PENDING"] = "PENDING";
|
|
19
|
+
})(REQUEST_STATUS || (REQUEST_STATUS = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LoginStatus } from "./common";
|
|
2
|
+
import { TerraNIHResponse } from "./terra-nih";
|
|
3
|
+
import { TerraResponse } from "./terra-profile";
|
|
4
|
+
import { TerraTermsOfServiceResponse } from "./terra-tos";
|
|
5
|
+
/**
|
|
6
|
+
* Terra profile context props.
|
|
7
|
+
*/
|
|
8
|
+
export interface TerraProfileContextProps {
|
|
9
|
+
terraNIHProfileLoginStatus: LoginStatus<TerraNIHResponse>;
|
|
10
|
+
terraProfileLoginStatus: LoginStatus<TerraResponse>;
|
|
11
|
+
terraTOSLoginStatus: LoginStatus<TerraTermsOfServiceResponse>;
|
|
12
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Terra profile response.
|
|
3
|
+
*/
|
|
3
4
|
export interface TerraResponse {
|
|
4
5
|
enabled: TerraResponseEnabled;
|
|
5
6
|
userInfo: TerraResponseUserInfo;
|
|
6
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Terra enabled flags.
|
|
10
|
+
*/
|
|
7
11
|
interface TerraResponseEnabled {
|
|
8
12
|
adminEnabled: boolean;
|
|
9
13
|
allUsersGroup: boolean;
|
|
@@ -11,14 +15,11 @@ interface TerraResponseEnabled {
|
|
|
11
15
|
ldap: boolean;
|
|
12
16
|
tosAccepted: boolean;
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Terra user info.
|
|
20
|
+
*/
|
|
14
21
|
interface TerraResponseUserInfo {
|
|
15
22
|
userEmail: string;
|
|
16
23
|
userSubjectId: string;
|
|
17
24
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Returns Terra profile login status from configured endpoint.
|
|
20
|
-
* @param token - Token.
|
|
21
|
-
* @returns Terra profile login status.
|
|
22
|
-
*/
|
|
23
|
-
export declare const useFetchTerraProfile: (token?: string) => Status;
|
|
24
25
|
export {};
|