@databiosphere/findable-ui 35.0.3 → 35.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +19 -0
  3. package/lib/common/entities.d.ts +1 -0
  4. package/lib/components/DataDictionary/components/Table/hook.js +1 -0
  5. package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.js +15 -2
  6. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestDownload/fileManifestDownload.js +21 -29
  7. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestSpreadsheet/fileManifestSpreadsheet.js +21 -36
  8. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.d.ts +2 -0
  9. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.js +22 -0
  10. package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.d.ts +3 -0
  11. package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.js +9 -0
  12. package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.styles.d.ts +5 -0
  13. package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.styles.js +15 -0
  14. package/lib/hooks/useFileManifest/useFileManifestDownload.d.ts +2 -2
  15. package/lib/hooks/useFileManifest/useFileManifestDownload.js +3 -10
  16. package/lib/hooks/useFileManifest/useFileManifestSpreadsheet.d.ts +5 -4
  17. package/lib/hooks/useFileManifest/useFileManifestSpreadsheet.js +24 -20
  18. package/package.json +1 -1
  19. package/src/common/entities.ts +1 -0
  20. package/src/components/DataDictionary/components/Table/hook.ts +1 -0
  21. package/src/components/DataDictionary/hooks/UseDataDictionary/hook.ts +17 -4
  22. package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestDownload/fileManifestDownload.tsx +43 -71
  23. package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestSpreadsheet/fileManifestSpreadsheet.tsx +52 -74
  24. package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.ts +24 -0
  25. package/src/components/Table/components/TableCell/components/CodeCell/codeCell.styles.ts +16 -0
  26. package/src/components/Table/components/TableCell/components/CodeCell/codeCell.tsx +21 -0
  27. package/src/hooks/useFileManifest/useFileManifestDownload.ts +9 -16
  28. package/src/hooks/useFileManifest/useFileManifestSpreadsheet.ts +41 -26
  29. package/lib/components/DataDictionary/components/Table/columns/columnDef.d.ts +0 -6
  30. package/lib/components/DataDictionary/components/Table/columns/columnDef.js +0 -33
  31. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.d.ts +0 -5
  32. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.js +0 -5
  33. package/lib/components/DataDictionary/components/Table/columns/types.d.ts +0 -2
  34. package/lib/components/DataDictionary/components/Table/columns/types.js +0 -1
  35. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +0 -4
  36. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.js +0 -1
  37. package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +0 -8
  38. package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +0 -36
  39. package/lib/components/Filter/components/Filter/filter.stories.d.ts +0 -25
  40. package/lib/components/Filter/components/Filter/filter.stories.js +0 -42
  41. package/lib/components/Filter/components/FilterTag/filterTag.stories.d.ts +0 -16
  42. package/lib/components/Filter/components/FilterTag/filterTag.stories.js +0 -17
  43. package/lib/components/Filter/components/Filters/filters.stories.d.ts +0 -6
  44. package/lib/components/Filter/components/Filters/filters.stories.js +0 -91
  45. package/lib/components/Index/components/Cell/cell.d.ts +0 -7
  46. package/lib/components/Index/components/Cell/cell.js +0 -10
  47. package/lib/components/Index/components/EntitiesView/constants.d.ts +0 -1
  48. package/lib/components/Index/components/EntitiesView/constants.js +0 -1
  49. package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.d.ts +0 -13
  50. package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.js +0 -18
  51. package/lib/components/Index/components/Hero/hero.stories.d.ts +0 -23
  52. package/lib/components/Index/components/Hero/hero.stories.js +0 -22
  53. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.d.ts +0 -8
  54. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.js +0 -57
  55. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.d.ts +0 -4
  56. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.js +0 -10
  57. package/lib/components/Index/components/NTag/nTag.d.ts +0 -10
  58. package/lib/components/Index/components/NTag/nTag.js +0 -8
  59. package/lib/components/Index/components/NTagCell/nTagCell.d.ts +0 -11
  60. package/lib/components/Index/components/NTagCell/nTagCell.js +0 -29
  61. package/lib/components/Index/components/NTagCell/nTagCell.stories.d.ts +0 -5
  62. package/lib/components/Index/components/NTagCell/nTagCell.stories.js +0 -16
  63. package/lib/components/Index/components/TitleCell/titleCell.d.ts +0 -6
  64. package/lib/components/Index/components/TitleCell/titleCell.js +0 -10
  65. package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +0 -3
  66. package/lib/components/Index/components/TitleCell/titleCell.styles.js +0 -6
  67. package/lib/components/Index/index.stories.d.ts +0 -6
  68. package/lib/components/Index/index.stories.js +0 -26
  69. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.d.ts +0 -6
  70. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.js +0 -10
  71. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.d.ts +0 -5
  72. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.js +0 -29
  73. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +0 -6
  74. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +0 -13
  75. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +0 -36
  76. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +0 -9
  77. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +0 -5
  78. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +0 -10
  79. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +0 -36
  80. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +0 -9
  81. package/lib/components/Layout/components/Header/hooks/useMeasureHeader.d.ts +0 -5
  82. package/lib/components/Layout/components/Header/hooks/useMeasureHeader.js +0 -19
  83. package/lib/components/Layout/components/Outline/common/constants.d.ts +0 -2
  84. package/lib/components/Layout/components/Outline/common/constants.js +0 -1
  85. package/lib/components/Login/login.stories.d.ts +0 -6
  86. package/lib/components/Login/login.stories.js +0 -31
  87. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.d.ts +0 -16
  88. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +0 -28
  89. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.d.ts +0 -5
  90. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.js +0 -46
  91. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +0 -3
  92. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +0 -21
  93. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +0 -2
  94. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +0 -37
  95. package/lib/components/TableCreator/common/constants.d.ts +0 -6
  96. package/lib/components/TableCreator/common/constants.js +0 -19
  97. package/lib/components/TableCreator/common/entities.d.ts +0 -5
  98. package/lib/components/TableCreator/common/entities.js +0 -1
  99. package/lib/components/TableCreator/tableCreator.styles.d.ts +0 -4
  100. package/lib/components/TableCreator/tableCreator.styles.js +0 -4
  101. package/lib/components/common/Alert/alert.stories.d.ts +0 -6
  102. package/lib/components/common/Alert/alert.stories.js +0 -36
  103. package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +0 -4
  104. package/lib/components/common/Alert/components/AlertText/alertText.styles.js +0 -19
  105. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +0 -7
  106. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +0 -5
  107. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +0 -3
  108. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +0 -19
  109. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +0 -10
  110. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +0 -16
  111. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +0 -3
  112. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +0 -21
  113. package/lib/components/common/Button/components/LoginButton/loginButton.d.ts +0 -3
  114. package/lib/components/common/Button/components/LoginButton/loginButton.js +0 -6
  115. package/lib/components/common/Button/components/LoginButton/loginButton.styles.d.ts +0 -7
  116. package/lib/components/common/Button/components/LoginButton/loginButton.styles.js +0 -11
  117. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +0 -5
  118. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +0 -10
  119. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +0 -3
  120. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +0 -9
  121. package/lib/hooks/useAuthentication/common/constants.d.ts +0 -4
  122. package/lib/hooks/useAuthentication/common/constants.js +0 -19
  123. package/lib/hooks/useAuthentication/common/entities.d.ts +0 -25
  124. package/lib/hooks/useAuthentication/common/entities.js +0 -11
  125. package/lib/hooks/useAuthentication/common/utils.d.ts +0 -15
  126. package/lib/hooks/useAuthentication/common/utils.js +0 -25
  127. package/lib/hooks/useAuthentication/useAuthentication.d.ts +0 -6
  128. package/lib/hooks/useAuthentication/useAuthentication.js +0 -9
  129. package/lib/hooks/useAuthentication/useAuthenticationComplete.d.ts +0 -6
  130. package/lib/hooks/useAuthentication/useAuthenticationComplete.js +0 -55
  131. package/lib/hooks/useAuthentication/useAuthenticationForm.d.ts +0 -20
  132. package/lib/hooks/useAuthentication/useAuthenticationForm.js +0 -88
  133. package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.d.ts +0 -18
  134. package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.js +0 -50
  135. package/lib/hooks/useAuthentication/useAuthenticationStatus.d.ts +0 -20
  136. package/lib/hooks/useAuthentication/useAuthenticationStatus.js +0 -32
  137. package/lib/hooks/useAuthentication/useFetchGoogleProfile.d.ts +0 -21
  138. package/lib/hooks/useAuthentication/useFetchGoogleProfile.js +0 -41
  139. package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.d.ts +0 -18
  140. package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.js +0 -62
  141. package/lib/hooks/useAuthentication/useFetchTerraProfile.d.ts +0 -24
  142. package/lib/hooks/useAuthentication/useFetchTerraProfile.js +0 -62
  143. package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.d.ts +0 -15
  144. package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.js +0 -62
  145. package/lib/hooks/useAuthentication/useTokenClient.d.ts +0 -11
  146. package/lib/hooks/useAuthentication/useTokenClient.js +0 -29
  147. package/lib/hooks/useAuthenticationConfig.d.ts +0 -6
  148. package/lib/hooks/useAuthenticationConfig.js +0 -14
  149. package/lib/hooks/useCategoryConfigs.d.ts +0 -6
  150. package/lib/hooks/useCategoryConfigs.js +0 -17
  151. package/lib/hooks/useEntityListRelatedView.d.ts +0 -15
  152. package/lib/hooks/useEntityListRelatedView.js +0 -62
  153. package/lib/hooks/useExploreMode.d.ts +0 -14
  154. package/lib/hooks/useExploreMode.js +0 -20
  155. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +0 -15
  156. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +0 -27
  157. package/lib/hooks/useFileManifest/useFileManifestURL.d.ts +0 -5
  158. package/lib/hooks/useFileManifest/useFileManifestURL.js +0 -11
  159. package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +0 -9
  160. package/lib/hooks/useFileManifest/useRequestFileManifest.js +0 -37
  161. package/lib/hooks/useLayoutState.d.ts +0 -6
  162. package/lib/hooks/useLayoutState.js +0 -9
  163. package/lib/hooks/useMenu.d.ts +0 -10
  164. package/lib/hooks/useMenu.js +0 -17
  165. package/lib/hooks/useMenuWithPosition.d.ts +0 -14
  166. package/lib/hooks/useMenuWithPosition.js +0 -33
  167. package/lib/hooks/useSessionTimeout.d.ts +0 -11
  168. package/lib/hooks/useSessionTimeout.js +0 -28
  169. package/lib/providers/authentication.d.ts +0 -51
  170. package/lib/providers/authentication.js +0 -110
  171. package/lib/providers/layoutState.d.ts +0 -40
  172. package/lib/providers/layoutState.js +0 -47
  173. package/lib/styles/common/mixins/shadows.d.ts +0 -3
  174. package/lib/styles/common/mixins/shadows.js +0 -4
  175. package/lib/styles/common/mui/palette.d.ts +0 -47
  176. package/lib/styles/common/mui/palette.js +0 -47
  177. package/lib/theme/common/entities.d.ts +0 -6
  178. package/lib/theme/common/entities.js +0 -1
@@ -1,62 +0,0 @@
1
- import { useCallback, useEffect, useState } from "react";
2
- import { useAuthenticationConfig } from "../useAuthenticationConfig";
3
- import { LOGIN_STATUS_FAILED } from "./common/constants";
4
- import { REQUEST_STATUS, } from "./common/entities";
5
- import { getAuthenticationRequestOptions, initLoginStatus, } from "./common/utils";
6
- /**
7
- * Returns Terra profile login status from configured endpoint.
8
- * @param token - Token.
9
- * @returns Terra profile login status.
10
- */
11
- export const useFetchTerraProfile = (token) => {
12
- const authenticationConfig = useAuthenticationConfig();
13
- const { terraAuthConfig: { terraProfileEndpoint: endpoint } = {} } = authenticationConfig;
14
- const [loginStatus, setLoginStatus] = useState(initLoginStatus(endpoint));
15
- // Fetch Terra profile.
16
- const fetchEndpointData = useCallback((endpoint, accessToken) => {
17
- fetch(endpoint, getAuthenticationRequestOptions(accessToken))
18
- .then((response) => response.json())
19
- .then((response) => {
20
- if (isResponseError(response)) {
21
- setLoginStatus(LOGIN_STATUS_FAILED);
22
- }
23
- else {
24
- setLoginStatus((prevStatus) => ({
25
- ...prevStatus,
26
- isSuccess: isResponseSuccess(response),
27
- requestStatus: REQUEST_STATUS.COMPLETED,
28
- response: response,
29
- }));
30
- }
31
- })
32
- .catch((err) => {
33
- console.log(err); // TODO handle error.
34
- setLoginStatus(LOGIN_STATUS_FAILED);
35
- });
36
- }, []);
37
- // Fetches Terra profile.
38
- useEffect(() => {
39
- if (!token)
40
- return;
41
- if (!endpoint)
42
- return;
43
- fetchEndpointData(endpoint, token);
44
- }, [endpoint, fetchEndpointData, token]);
45
- return loginStatus;
46
- };
47
- /**
48
- * Returns true if response is an error response.
49
- * @param response - Response.
50
- * @returns true if response is an error response.
51
- */
52
- function isResponseError(response) {
53
- return Boolean(response.statusCode);
54
- }
55
- /**
56
- * Returns true if response is enabled.
57
- * @param response - Response.
58
- * @returns true if response is successful.
59
- */
60
- function isResponseSuccess(response) {
61
- return Boolean(response.enabled?.google);
62
- }
@@ -1,15 +0,0 @@
1
- import { LoginStatus } from "./common/entities";
2
- type Status = LoginStatus<TerraTermsOfServiceResponse>;
3
- export interface TerraTermsOfServiceResponse {
4
- currentVersion: string;
5
- isEnabled: boolean;
6
- isGracePeriodEnabled: boolean;
7
- userAcceptedVersion?: string;
8
- }
9
- /**
10
- * Returns Terra terms of service login status from configured endpoint.
11
- * @param token - Token.
12
- * @returns Terra terms of service login status.
13
- */
14
- export declare const useFetchTerraTermsOfService: (token?: string) => Status;
15
- export {};
@@ -1,62 +0,0 @@
1
- import { useCallback, useEffect, useState } from "react";
2
- import { useAuthenticationConfig } from "../useAuthenticationConfig";
3
- import { LOGIN_STATUS_FAILED } from "./common/constants";
4
- import { REQUEST_STATUS, } from "./common/entities";
5
- import { getAuthenticationRequestOptions, initLoginStatus, } from "./common/utils";
6
- /**
7
- * Returns Terra terms of service login status from configured endpoint.
8
- * @param token - Token.
9
- * @returns Terra terms of service login status.
10
- */
11
- export const useFetchTerraTermsOfService = (token) => {
12
- const authenticationConfig = useAuthenticationConfig();
13
- const { terraAuthConfig: { termsOfServiceEndpoint: endpoint } = {} } = authenticationConfig;
14
- const [loginStatus, setLoginStatus] = useState(initLoginStatus(endpoint));
15
- // Fetch Terra terms of service.
16
- const fetchEndpointData = useCallback((endpoint, accessToken) => {
17
- fetch(endpoint, getAuthenticationRequestOptions(accessToken))
18
- .then((response) => response.json())
19
- .then((response) => {
20
- if (isResponseError(response)) {
21
- setLoginStatus(LOGIN_STATUS_FAILED);
22
- }
23
- else {
24
- setLoginStatus((prevStatus) => ({
25
- ...prevStatus,
26
- isSuccess: isResponseSuccess(response),
27
- requestStatus: REQUEST_STATUS.COMPLETED,
28
- response,
29
- }));
30
- }
31
- })
32
- .catch((err) => {
33
- console.log(err); // TODO handle error.
34
- setLoginStatus(LOGIN_STATUS_FAILED);
35
- });
36
- }, []);
37
- // Fetches Terra terms of service.
38
- useEffect(() => {
39
- if (!token)
40
- return;
41
- if (!endpoint)
42
- return;
43
- fetchEndpointData(endpoint, token);
44
- }, [endpoint, fetchEndpointData, token]);
45
- return loginStatus;
46
- };
47
- /**
48
- * Returns true if response is an error response.
49
- * @param response - Response.
50
- * @returns true if response is an error response.
51
- */
52
- function isResponseError(response) {
53
- return Boolean(response.statusCode);
54
- }
55
- /**
56
- * Returns true if the user accepted terms of service version is current.
57
- * @param response - Response.
58
- * @returns true if response is successful.
59
- */
60
- function isResponseSuccess(response) {
61
- return Boolean(response.currentVersion === response.userAcceptedVersion);
62
- }
@@ -1,11 +0,0 @@
1
- type TokenClient = any;
2
- export interface UseTokenClient {
3
- token: string | undefined;
4
- tokenClient: TokenClient | undefined;
5
- }
6
- /**
7
- * Initializes the token client, sets token from token client callback.
8
- * @returns initialized token client.
9
- */
10
- export declare const useTokenClient: () => UseTokenClient;
11
- export {};
@@ -1,29 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { useAuthenticationConfig } from "../useAuthenticationConfig";
3
- /**
4
- * Initializes the token client, sets token from token client callback.
5
- * @returns initialized token client.
6
- */
7
- export const useTokenClient = () => {
8
- const [token, setToken] = useState();
9
- const [tokenClient, setTokenClient] = useState();
10
- const authenticationConfig = useAuthenticationConfig();
11
- const { googleGISAuthConfig: { clientId, scope } = {} } = authenticationConfig;
12
- // Initializes token client - (authorization client id must be configured).
13
- useEffect(() => {
14
- if (clientId) {
15
- setTokenClient(google.accounts.oauth2.initTokenClient({
16
- callback: (tokenResponse) => {
17
- const access_token = tokenResponse.access_token;
18
- setToken(access_token);
19
- },
20
- client_id: clientId,
21
- scope,
22
- }));
23
- }
24
- }, [clientId, scope]);
25
- return {
26
- token,
27
- tokenClient,
28
- };
29
- };
@@ -1,6 +0,0 @@
1
- import { AuthenticationConfig } from "../config/entities";
2
- /**
3
- * Hook to get the authentication config
4
- * @returns @see AuthenticationConfig used in the current config.
5
- */
6
- export declare const useAuthenticationConfig: () => AuthenticationConfig;
@@ -1,14 +0,0 @@
1
- import { useConfig } from "./useConfig";
2
- /**
3
- * Hook to get the authentication config
4
- * @returns @see AuthenticationConfig used in the current config.
5
- */
6
- export const useAuthenticationConfig = () => {
7
- const { config } = useConfig();
8
- if (!config.authentication) {
9
- return {
10
- title: "",
11
- };
12
- }
13
- return config.authentication;
14
- };
@@ -1,6 +0,0 @@
1
- import { CategoryConfig } from "../config/entities";
2
- /**
3
- * Returns configured grouped configured categories as a list of configured categories.
4
- * @returns a list of configured categories.
5
- */
6
- export declare const useCategoryConfigs: () => CategoryConfig[] | undefined;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCategoryConfigs = void 0;
4
- const react_1 = require("react");
5
- const useConfig_1 = require("./useConfig");
6
- /**
7
- * Returns configured grouped configured categories as a list of configured categories.
8
- * @returns a list of configured categories.
9
- */
10
- const useCategoryConfigs = () => {
11
- const { config } = (0, useConfig_1.useConfig)();
12
- const { categoryGroupConfigs } = config;
13
- return (0, react_1.useMemo)(() => {
14
- return categoryGroupConfigs === null || categoryGroupConfigs === void 0 ? void 0 : categoryGroupConfigs.flatMap(({ categoryConfigs }) => categoryConfigs);
15
- }, [categoryGroupConfigs]);
16
- };
17
- exports.useCategoryConfigs = useCategoryConfigs;
@@ -1,15 +0,0 @@
1
- import { SelectedFilterValue } from "../common/entities";
2
- import { RelatedSearchResult } from "../config/entities";
3
- import { ListItems, RelatedListItems } from "../providers/exploreState";
4
- /**
5
- * Returns related entity lists filtered by related search results.
6
- * @param listItems - Entity list items.
7
- * @param relatedSearchResult - Related search result.
8
- * @param excludedValues - Selected category values to be excluded from related entity lists.
9
- * @returns related entities.
10
- */
11
- export declare function buildRelatedEntityList(listItems: ListItems, relatedSearchResult: RelatedSearchResult | undefined, excludedValues: SelectedFilterValue | undefined): RelatedListItems;
12
- /**
13
- * Updates related entity list.
14
- */
15
- export declare const useEntityListRelatedView: () => void;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useEntityListRelatedView = exports.buildRelatedEntityList = void 0;
4
- const react_1 = require("react");
5
- const exploreState_1 = require("../providers/exploreState");
6
- const useAsync_1 = require("./useAsync");
7
- const useConfig_1 = require("./useConfig");
8
- const useExploreState_1 = require("./useExploreState");
9
- /**
10
- * Returns related entity lists filtered by related search results.
11
- * @param listItems - Entity list items.
12
- * @param relatedSearchResult - Related search result.
13
- * @param excludedValues - Selected category values to be excluded from related entity lists.
14
- * @returns related entities.
15
- */
16
- function buildRelatedEntityList(listItems, relatedSearchResult, excludedValues) {
17
- if (relatedSearchResult) {
18
- const { resultKey, searchKey, values } = relatedSearchResult;
19
- return listItems === null || listItems === void 0 ? void 0 : listItems.filter((listItem) => {
20
- if (values.includes(listItem[resultKey].toLowerCase())) {
21
- return !(excludedValues === null || excludedValues === void 0 ? void 0 : excludedValues.includes(listItem[searchKey])); // Exclude any row where any of the selected category values matches the corresponding row value.
22
- }
23
- });
24
- }
25
- }
26
- exports.buildRelatedEntityList = buildRelatedEntityList;
27
- /**
28
- * Updates related entity list.
29
- */
30
- const useEntityListRelatedView = () => {
31
- var _a;
32
- const { entityConfig } = (0, useConfig_1.useConfig)();
33
- const { exploreDispatch, exploreState } = (0, useExploreState_1.useExploreState)();
34
- const { filterState, listItems } = exploreState;
35
- const { listView } = entityConfig;
36
- const relatedView = listView === null || listView === void 0 ? void 0 : listView.relatedView;
37
- const { relatedSearchFn, resultKey, searchKey } = relatedView || {};
38
- const { data: relatedSearchResult, run } = (0, useAsync_1.useAsync)();
39
- const selectedCategoryValues = (_a = filterState.find(({ categoryKey }) => categoryKey === searchKey)) === null || _a === void 0 ? void 0 : _a.value;
40
- (0, react_1.useEffect)(() => {
41
- if (relatedSearchFn) {
42
- run(relatedSearchFn(searchKey, resultKey, selectedCategoryValues));
43
- }
44
- }, [relatedSearchFn, resultKey, run, searchKey, selectedCategoryValues]);
45
- (0, react_1.useEffect)(() => {
46
- if (relatedSearchFn) {
47
- exploreDispatch({
48
- payload: {
49
- relatedListItems: buildRelatedEntityList(listItems, relatedSearchResult, selectedCategoryValues),
50
- },
51
- type: exploreState_1.ExploreActionKind.ProcessRelatedResponse,
52
- });
53
- }
54
- }, [
55
- exploreDispatch,
56
- listItems,
57
- relatedSearchFn,
58
- relatedSearchResult,
59
- selectedCategoryValues,
60
- ]);
61
- };
62
- exports.useEntityListRelatedView = useEntityListRelatedView;
@@ -1,14 +0,0 @@
1
- export type ExploreMode = EXPLORE_MODE;
2
- export declare enum EXPLORE_MODE {
3
- CS_FETCH_CS_FILTERING = "CS_FETCH_CS_FILTERING",
4
- SS_FETCH_CS_FILTERING = "SS_FETCH_CS_FILTERING",
5
- SS_FETCH_SS_FILTERING = "SS_FETCH_SS_FILTERING"
6
- }
7
- /**
8
- * Returns configured explore mode:
9
- * - Client-side fetch, client-side filtering.
10
- * - Server-side fetch, client-side filtering.
11
- * - Server-side fetch, server-side filtering.
12
- * @returns explore mode.
13
- */
14
- export declare const useExploreMode: () => ExploreMode;
@@ -1,20 +0,0 @@
1
- import { useMemo } from "react";
2
- import { useConfig } from "./useConfig";
3
- export var EXPLORE_MODE;
4
- (function (EXPLORE_MODE) {
5
- EXPLORE_MODE["CS_FETCH_CS_FILTERING"] = "CS_FETCH_CS_FILTERING";
6
- EXPLORE_MODE["SS_FETCH_CS_FILTERING"] = "SS_FETCH_CS_FILTERING";
7
- EXPLORE_MODE["SS_FETCH_SS_FILTERING"] = "SS_FETCH_SS_FILTERING";
8
- })(EXPLORE_MODE || (EXPLORE_MODE = {}));
9
- /**
10
- * Returns configured explore mode:
11
- * - Client-side fetch, client-side filtering.
12
- * - Server-side fetch, client-side filtering.
13
- * - Server-side fetch, server-side filtering.
14
- * @returns explore mode.
15
- */
16
- export const useExploreMode = () => {
17
- const { entityConfig } = useConfig();
18
- const { exploreMode } = entityConfig;
19
- return useMemo(() => exploreMode, [exploreMode]);
20
- };
@@ -1,15 +0,0 @@
1
- import { ManifestDownloadFormat } from "../../../apis/azul/common/entities";
2
- import { Filters } from "../../../common/entities";
3
- export interface FileManifestRequestURL {
4
- requestParams: URLSearchParams;
5
- requestURL: string;
6
- }
7
- /**
8
- * Build up file manifest request params and URL query string for the given search results, catalog and format.
9
- * @param url - Data URL.
10
- * @param filters - Selected filters.
11
- * @param catalog - Configured catalog.
12
- * @param manifestFormat - Manifest format.
13
- * @returns file manifest request params and URL query string.
14
- */
15
- export declare const buildFileManifestRequestURL: (url: string, filters: Filters, catalog: string, manifestFormat: ManifestDownloadFormat | undefined) => FileManifestRequestURL | undefined;
@@ -1,27 +0,0 @@
1
- import { AZUL_PARAM, } from "../../../apis/azul/common/entities";
2
- import { transformFilters } from "../../../apis/azul/common/filterTransformer";
3
- /**
4
- * Build up file manifest request params and URL query string for the given search results, catalog and format.
5
- * @param url - Data URL.
6
- * @param filters - Selected filters.
7
- * @param catalog - Configured catalog.
8
- * @param manifestFormat - Manifest format.
9
- * @returns file manifest request params and URL query string.
10
- */
11
- export const buildFileManifestRequestURL = (url, filters, catalog, manifestFormat) => {
12
- if (!manifestFormat) {
13
- return;
14
- }
15
- // Build request params.
16
- const requestParams = new URLSearchParams({
17
- [AZUL_PARAM.CATALOG]: catalog,
18
- [AZUL_PARAM.FILTERS]: transformFilters(filters),
19
- format: manifestFormat,
20
- });
21
- // Build file manifest URL
22
- const requestURL = `${url}fetch/manifest/files?${requestParams.toString()}`;
23
- return {
24
- requestParams,
25
- requestURL,
26
- };
27
- };
@@ -1,5 +0,0 @@
1
- /**
2
- * Returns data URL for the integrations end point.
3
- * @returns data URL for the integrations end point.
4
- */
5
- export declare const useFileManifestURL: () => string;
@@ -1,11 +0,0 @@
1
- import { useConfig } from "../useConfig";
2
- /**
3
- * Returns data URL for the integrations end point.
4
- * @returns data URL for the integrations end point.
5
- */
6
- export const useFileManifestURL = () => {
7
- const { config } = useConfig();
8
- const { dataSource } = config;
9
- const { url } = dataSource;
10
- return url;
11
- };
@@ -1,9 +0,0 @@
1
- import { ManifestDownloadFormat } from "../../apis/azul/common/entities";
2
- import { Filters } from "../../common/entities";
3
- /**
4
- * Initializes and fetches file manifest comprising file facets and summary for the given file manifest format.
5
- * @param fileManifestFormat - File manifest format.
6
- * @param initialFilters - Filters to initialize file manifest request.
7
- * @param fileSummaryFacetName - File summary facet name.
8
- */
9
- export declare const useRequestFileManifest: (fileManifestFormat: ManifestDownloadFormat | undefined, initialFilters?: Filters | undefined, fileSummaryFacetName?: string) => void;
@@ -1,37 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { FileManifestActionKind } from "../../providers/fileManifestState";
3
- import { useFileManifestState } from "../useFileManifestState";
4
- /**
5
- * Initializes and fetches file manifest comprising file facets and summary for the given file manifest format.
6
- * @param fileManifestFormat - File manifest format.
7
- * @param initialFilters - Filters to initialize file manifest request.
8
- * @param fileSummaryFacetName - File summary facet name.
9
- */
10
- export const useRequestFileManifest = (fileManifestFormat, initialFilters = [], fileSummaryFacetName) => {
11
- // Initial file manifest filter.
12
- const [initFilters] = useState(() => initialFilters);
13
- // File manifest state.
14
- const { fileManifestDispatch } = useFileManifestState();
15
- // Fetches file manifest with the given file manifest filters, format.
16
- useEffect(() => {
17
- fileManifestDispatch({
18
- payload: {
19
- fileManifestFormat,
20
- fileSummaryFacetName,
21
- filters: initFilters,
22
- },
23
- type: FileManifestActionKind.FetchFileManifest,
24
- });
25
- return () => {
26
- fileManifestDispatch({
27
- payload: undefined,
28
- type: FileManifestActionKind.ClearFileManifest,
29
- });
30
- };
31
- }, [
32
- fileManifestDispatch,
33
- fileManifestFormat,
34
- fileSummaryFacetName,
35
- initFilters,
36
- ]);
37
- };
@@ -1,6 +0,0 @@
1
- import { LayoutStateContextProps } from "../providers/layoutState";
2
- /**
3
- * Returns layout state context.
4
- * @returns layout state context.
5
- */
6
- export declare const useLayoutState: () => LayoutStateContextProps;
@@ -1,9 +0,0 @@
1
- import { useContext } from "react";
2
- import { LayoutStateContext, } from "../providers/layoutState";
3
- /**
4
- * Returns layout state context.
5
- * @returns layout state context.
6
- */
7
- export const useLayoutState = () => {
8
- return useContext(LayoutStateContext);
9
- };
@@ -1,10 +0,0 @@
1
- export interface UseMenu {
2
- onClose: () => void;
3
- onOpen: () => void;
4
- open: boolean;
5
- }
6
- /**
7
- * Menu functionality for menu dropdown.
8
- * @returns menu functionality.
9
- */
10
- export declare const useMenu: () => UseMenu;
@@ -1,17 +0,0 @@
1
- import { useCallback, useState } from "react";
2
- /**
3
- * Menu functionality for menu dropdown.
4
- * @returns menu functionality.
5
- */
6
- export const useMenu = () => {
7
- const [open, setOpen] = useState(false);
8
- // Closes header menu.
9
- const onClose = useCallback(() => {
10
- setOpen(false);
11
- }, []);
12
- // Opens header menu.
13
- const onOpen = useCallback(() => {
14
- setOpen(true);
15
- }, []);
16
- return { onClose, onOpen, open };
17
- };
@@ -1,14 +0,0 @@
1
- import { MenuProps as MMenuProps } from "@mui/material";
2
- import { MouseEvent } from "react";
3
- export interface UseMenuWithPosition {
4
- anchorEl: MMenuProps["anchorEl"];
5
- onClose: () => void;
6
- onOpen: (event: MouseEvent<HTMLElement>) => void;
7
- onToggleOpen: (event: MouseEvent<HTMLElement>) => void;
8
- open: boolean;
9
- }
10
- /**
11
- * Menu functionality for menu dropdown, with menu position.
12
- * @returns menu functionality.
13
- */
14
- export declare const useMenuWithPosition: () => UseMenuWithPosition;
@@ -1,33 +0,0 @@
1
- import { useCallback, useMemo, useState } from "react";
2
- /**
3
- * Menu functionality for menu dropdown, with menu position.
4
- * @returns menu functionality.
5
- */
6
- export const useMenuWithPosition = () => {
7
- const [anchorEl, setAnchorEl] = useState(null);
8
- const open = useMemo(() => Boolean(anchorEl), [anchorEl]);
9
- // Closes header menu.
10
- const onClose = useCallback(() => {
11
- setAnchorEl(null);
12
- }, []);
13
- // Opens header menu.
14
- const onOpen = useCallback((event) => {
15
- setAnchorEl(event.currentTarget);
16
- }, []);
17
- // Toggles menu open/close.
18
- const onToggleOpen = useCallback((event) => {
19
- if (open) {
20
- setAnchorEl(null);
21
- }
22
- else {
23
- setAnchorEl(event.currentTarget);
24
- }
25
- }, [open]);
26
- return {
27
- anchorEl,
28
- onClose,
29
- onOpen,
30
- onToggleOpen,
31
- open,
32
- };
33
- };
@@ -1,11 +0,0 @@
1
- export declare const INACTIVITY_PARAM = "inactivityTimeout";
2
- interface UseSessionTimeout {
3
- clearSessionTimeout: () => void;
4
- isSessionTimeout: boolean;
5
- }
6
- /**
7
- * Session timeout hook.
8
- * @returns flag indicating if the session has timed out.
9
- */
10
- export declare const useSessionTimeout: () => UseSessionTimeout;
11
- export {};
@@ -1,28 +0,0 @@
1
- import Router from "next/router";
2
- import { useCallback, useEffect, useState } from "react";
3
- import { useConfig } from "./useConfig";
4
- import { useLocation } from "./useLocation";
5
- export const INACTIVITY_PARAM = "inactivityTimeout";
6
- /**
7
- * Session timeout hook.
8
- * @returns flag indicating if the session has timed out.
9
- */
10
- export const useSessionTimeout = () => {
11
- const { config: { redirectRootToPath }, } = useConfig();
12
- const [isSessionTimeout, setIsSessionTimeout] = useState(false);
13
- // Get the session timeout from URL parameters.
14
- const { search } = useLocation() || {};
15
- const sessionTimeout = search?.get(INACTIVITY_PARAM);
16
- // Clears session timeout state.
17
- const clearSessionTimeout = useCallback(() => {
18
- setIsSessionTimeout(false);
19
- Router.replace(redirectRootToPath);
20
- }, [redirectRootToPath]);
21
- useEffect(() => {
22
- setIsSessionTimeout(sessionTimeout === "true");
23
- }, [sessionTimeout]);
24
- return {
25
- clearSessionTimeout,
26
- isSessionTimeout,
27
- };
28
- };
@@ -1,51 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import { AUTHENTICATION_STATUS, LoginStatus } from "../hooks/useAuthentication/common/entities";
3
- import { UserProfile } from "../hooks/useAuthentication/useFetchGoogleProfile";
4
- import { TerraNIHResponse } from "../hooks/useAuthentication/useFetchTerraNIHProfile";
5
- import { TerraResponse } from "../hooks/useAuthentication/useFetchTerraProfile";
6
- import { TerraTermsOfServiceResponse } from "../hooks/useAuthentication/useFetchTerraTermsOfService";
7
- export declare const ROUTE_LOGIN = "/login";
8
- type AuthenticateUserFn = () => void;
9
- type RequestAuthenticationFn = () => void;
10
- /**
11
- * Model of authentication context.
12
- */
13
- export interface AuthContextProps {
14
- authenticateUser: AuthenticateUserFn;
15
- authenticationStatus: AUTHENTICATION_STATUS;
16
- isAuthenticated: boolean;
17
- isEnabled: boolean;
18
- requestAuthentication: RequestAuthenticationFn;
19
- terraNIHProfileLoginStatus: LoginStatus<TerraNIHResponse>;
20
- terraProfileLoginStatus: LoginStatus<TerraResponse>;
21
- terraTOSLoginStatus: LoginStatus<TerraTermsOfServiceResponse>;
22
- token?: string;
23
- userProfile?: UserProfile;
24
- }
25
- /**
26
- * Auth context for storing and using auth-related state.
27
- */
28
- export declare const AuthContext: React.Context<AuthContextProps>;
29
- interface Props {
30
- children: ReactNode | ReactNode[];
31
- sessionTimeout?: number;
32
- }
33
- /**
34
- * Auth provider for consuming components to subscribe to changes in auth-related state.
35
- * @param props - Component inputs.
36
- * @param props.children - Set of children components that can possibly consume the query provider.
37
- * @param props.sessionTimeout - If provided, will set the value for a session timeout (in milliseconds).
38
- * @returns Provider element to be used by consumers to both update authentication state and subscribe to changes in authentication state.
39
- */
40
- export declare function AuthProvider({ children, sessionTimeout }: Props): JSX.Element;
41
- /**
42
- * Token is released for the following conditions:
43
- * - Terra endpoint is configured and the terms of service response is successful, or
44
- * - Terra endpoint is not configured and the user profile response is successful.
45
- * @param userProfileLoginStatus - User profile login status.
46
- * @param terraProfileLoginStatus - Terra profile login status.
47
- * @param terraTOSLoginStatus - Terra terms of service login status.
48
- * @returns true if the token should be released.
49
- */
50
- export declare function shouldReleaseToken(userProfileLoginStatus: LoginStatus<UserProfile>, terraProfileLoginStatus: LoginStatus<TerraResponse>, terraTOSLoginStatus: LoginStatus<TerraTermsOfServiceResponse>): boolean;
51
- export {};