@databiosphere/findable-ui 34.1.0 → 35.0.2

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 (272) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +26 -0
  3. package/lib/components/DataDictionary/components/Table/columns/columnDef.d.ts +6 -0
  4. package/lib/components/DataDictionary/components/Table/columns/columnDef.js +33 -0
  5. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.d.ts +5 -0
  6. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.js +5 -0
  7. package/lib/components/DataDictionary/components/Table/columns/types.d.ts +2 -0
  8. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +4 -0
  9. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.js +1 -0
  10. package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +8 -0
  11. package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +36 -0
  12. package/lib/components/Filter/components/Filter/filter.stories.d.ts +25 -0
  13. package/lib/components/Filter/components/Filter/filter.stories.js +42 -0
  14. package/lib/components/Filter/components/FilterTag/filterTag.stories.d.ts +16 -0
  15. package/lib/components/Filter/components/FilterTag/filterTag.stories.js +17 -0
  16. package/lib/components/Filter/components/Filters/filters.stories.d.ts +6 -0
  17. package/lib/components/Filter/components/Filters/filters.stories.js +91 -0
  18. package/lib/components/Index/components/Cell/cell.d.ts +7 -0
  19. package/lib/components/Index/components/Cell/cell.js +10 -0
  20. package/lib/components/Index/components/EntitiesView/constants.d.ts +1 -0
  21. package/lib/components/Index/components/EntitiesView/constants.js +1 -0
  22. package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.d.ts +13 -0
  23. package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.js +18 -0
  24. package/lib/components/Index/components/Hero/hero.stories.d.ts +23 -0
  25. package/lib/components/Index/components/Hero/hero.stories.js +22 -0
  26. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.d.ts +8 -0
  27. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.js +57 -0
  28. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.d.ts +4 -0
  29. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.js +10 -0
  30. package/lib/components/Index/components/NTag/nTag.d.ts +10 -0
  31. package/lib/components/Index/components/NTag/nTag.js +8 -0
  32. package/lib/components/Index/components/NTagCell/nTagCell.d.ts +11 -0
  33. package/lib/components/Index/components/NTagCell/nTagCell.js +29 -0
  34. package/lib/components/Index/components/NTagCell/nTagCell.stories.d.ts +5 -0
  35. package/lib/components/Index/components/NTagCell/nTagCell.stories.js +16 -0
  36. package/lib/components/Index/components/TitleCell/titleCell.d.ts +6 -0
  37. package/lib/components/Index/components/TitleCell/titleCell.js +10 -0
  38. package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +3 -0
  39. package/lib/components/Index/components/TitleCell/titleCell.styles.js +6 -0
  40. package/lib/components/Index/index.stories.d.ts +6 -0
  41. package/lib/components/Index/index.stories.js +26 -0
  42. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.d.ts +6 -0
  43. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.js +10 -0
  44. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.d.ts +5 -0
  45. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.js +29 -0
  46. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +6 -0
  47. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +13 -0
  48. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +36 -0
  49. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +9 -0
  50. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +5 -0
  51. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +10 -0
  52. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +36 -0
  53. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +9 -0
  54. package/lib/components/Layout/components/Header/hooks/useMeasureHeader.d.ts +5 -0
  55. package/lib/components/Layout/components/Header/hooks/useMeasureHeader.js +19 -0
  56. package/lib/components/Layout/components/Outline/common/constants.d.ts +2 -0
  57. package/lib/components/Layout/components/Outline/common/constants.js +1 -0
  58. package/lib/components/Login/login.stories.d.ts +6 -0
  59. package/lib/components/Login/login.stories.js +31 -0
  60. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.d.ts +16 -0
  61. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +28 -0
  62. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.d.ts +5 -0
  63. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.js +46 -0
  64. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +3 -0
  65. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +21 -0
  66. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +2 -0
  67. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +37 -0
  68. package/lib/components/TableCreator/common/constants.d.ts +6 -0
  69. package/lib/components/TableCreator/common/constants.js +19 -0
  70. package/lib/components/TableCreator/common/entities.d.ts +5 -0
  71. package/lib/components/TableCreator/common/entities.js +1 -0
  72. package/lib/components/TableCreator/tableCreator.styles.d.ts +4 -0
  73. package/lib/components/TableCreator/tableCreator.styles.js +4 -0
  74. package/lib/components/common/Alert/alert.stories.d.ts +6 -0
  75. package/lib/components/common/Alert/alert.stories.js +36 -0
  76. package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +4 -0
  77. package/lib/components/common/Alert/components/AlertText/alertText.styles.js +19 -0
  78. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +7 -0
  79. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +5 -0
  80. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +3 -0
  81. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +19 -0
  82. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +10 -0
  83. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +16 -0
  84. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +3 -0
  85. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +21 -0
  86. package/lib/components/common/Button/components/LoginButton/loginButton.d.ts +3 -0
  87. package/lib/components/common/Button/components/LoginButton/loginButton.js +6 -0
  88. package/lib/components/common/Button/components/LoginButton/loginButton.styles.d.ts +7 -0
  89. package/lib/components/common/Button/components/LoginButton/loginButton.styles.js +11 -0
  90. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +5 -0
  91. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +10 -0
  92. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +3 -0
  93. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +9 -0
  94. package/lib/hooks/stateSyncManager/hook.d.ts +19 -0
  95. package/lib/hooks/stateSyncManager/hook.js +35 -0
  96. package/lib/hooks/stateSyncManager/hooks/UseBeforePopState/hook.d.ts +1 -0
  97. package/lib/hooks/stateSyncManager/hooks/UseBeforePopState/hook.js +21 -0
  98. package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/hook.d.ts +2 -0
  99. package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/hook.js +23 -0
  100. package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/types.d.ts +4 -0
  101. package/lib/hooks/stateSyncManager/hooks/UseStateSync/hook.d.ts +2 -0
  102. package/lib/hooks/stateSyncManager/hooks/UseStateSync/hook.js +40 -0
  103. package/lib/hooks/stateSyncManager/hooks/UseStateSync/utils.d.ts +30 -0
  104. package/lib/hooks/stateSyncManager/hooks/UseStateSync/utils.js +41 -0
  105. package/lib/hooks/stateSyncManager/types.d.ts +26 -0
  106. package/lib/hooks/stateSyncManager/types.js +1 -0
  107. package/lib/hooks/useAuthentication/common/constants.d.ts +4 -0
  108. package/lib/hooks/useAuthentication/common/constants.js +19 -0
  109. package/lib/hooks/useAuthentication/common/entities.d.ts +25 -0
  110. package/lib/hooks/useAuthentication/common/entities.js +11 -0
  111. package/lib/hooks/useAuthentication/common/utils.d.ts +15 -0
  112. package/lib/hooks/useAuthentication/common/utils.js +25 -0
  113. package/lib/hooks/useAuthentication/useAuthentication.d.ts +6 -0
  114. package/lib/hooks/useAuthentication/useAuthentication.js +9 -0
  115. package/lib/hooks/useAuthentication/useAuthenticationComplete.d.ts +6 -0
  116. package/lib/hooks/useAuthentication/useAuthenticationComplete.js +55 -0
  117. package/lib/hooks/useAuthentication/useAuthenticationForm.d.ts +20 -0
  118. package/lib/hooks/useAuthentication/useAuthenticationForm.js +88 -0
  119. package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.d.ts +18 -0
  120. package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.js +50 -0
  121. package/lib/hooks/useAuthentication/useAuthenticationStatus.d.ts +20 -0
  122. package/lib/hooks/useAuthentication/useAuthenticationStatus.js +32 -0
  123. package/lib/hooks/useAuthentication/useFetchGoogleProfile.d.ts +21 -0
  124. package/lib/hooks/useAuthentication/useFetchGoogleProfile.js +41 -0
  125. package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.d.ts +18 -0
  126. package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.js +62 -0
  127. package/lib/hooks/useAuthentication/useFetchTerraProfile.d.ts +24 -0
  128. package/lib/hooks/useAuthentication/useFetchTerraProfile.js +62 -0
  129. package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.d.ts +15 -0
  130. package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.js +62 -0
  131. package/lib/hooks/useAuthentication/useTokenClient.d.ts +11 -0
  132. package/lib/hooks/useAuthentication/useTokenClient.js +29 -0
  133. package/lib/hooks/useAuthenticationConfig.d.ts +6 -0
  134. package/lib/hooks/useAuthenticationConfig.js +14 -0
  135. package/lib/hooks/useCategoryConfigs.d.ts +6 -0
  136. package/lib/hooks/useCategoryConfigs.js +17 -0
  137. package/lib/hooks/useEntityListRelatedView.d.ts +15 -0
  138. package/lib/hooks/useEntityListRelatedView.js +62 -0
  139. package/lib/hooks/useExploreMode.d.ts +14 -0
  140. package/lib/hooks/useExploreMode.js +20 -0
  141. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +15 -0
  142. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +27 -0
  143. package/lib/hooks/useFileManifest/useFileManifestURL.d.ts +5 -0
  144. package/lib/hooks/useFileManifest/useFileManifestURL.js +11 -0
  145. package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +9 -0
  146. package/lib/hooks/useFileManifest/useRequestFileManifest.js +37 -0
  147. package/lib/hooks/useLayoutState.d.ts +6 -0
  148. package/lib/hooks/useLayoutState.js +9 -0
  149. package/lib/hooks/useMenu.d.ts +10 -0
  150. package/lib/hooks/useMenu.js +17 -0
  151. package/lib/hooks/useMenuWithPosition.d.ts +14 -0
  152. package/lib/hooks/useMenuWithPosition.js +33 -0
  153. package/lib/hooks/useSessionTimeout.d.ts +11 -0
  154. package/lib/hooks/useSessionTimeout.js +28 -0
  155. package/lib/providers/authentication.d.ts +51 -0
  156. package/lib/providers/authentication.js +110 -0
  157. package/lib/providers/exploreState/actions/stateToUrl/action.d.ts +9 -0
  158. package/lib/providers/exploreState/actions/stateToUrl/action.js +14 -0
  159. package/lib/providers/exploreState/actions/stateToUrl/dispatch.d.ts +7 -0
  160. package/lib/providers/exploreState/actions/{syncStateFromUrl → stateToUrl}/dispatch.js +3 -3
  161. package/lib/providers/exploreState/actions/stateToUrl/types.d.ts +12 -0
  162. package/lib/providers/exploreState/actions/stateToUrl/types.js +5 -0
  163. package/lib/providers/exploreState/actions/urlToState/action.d.ts +9 -0
  164. package/lib/providers/exploreState/actions/urlToState/action.js +38 -0
  165. package/lib/providers/exploreState/actions/urlToState/dispatch.d.ts +7 -0
  166. package/lib/providers/exploreState/actions/urlToState/dispatch.js +12 -0
  167. package/lib/providers/exploreState/actions/urlToState/types.d.ts +9 -0
  168. package/lib/providers/exploreState/actions/urlToState/types.js +1 -0
  169. package/lib/providers/exploreState/actions/urlToState/utils.d.ts +7 -0
  170. package/lib/providers/exploreState/actions/urlToState/utils.js +13 -0
  171. package/lib/providers/{exploreStateSync/hooks/UseMetaCommands/utils.d.ts → exploreState/entities/query/buildQuery.d.ts} +10 -14
  172. package/lib/providers/{exploreStateSync/hooks/UseMetaCommands/utils.js → exploreState/entities/query/buildQuery.js} +13 -21
  173. package/lib/providers/exploreState/entities/state.d.ts +10 -0
  174. package/lib/providers/exploreState/entities/state.js +36 -0
  175. package/lib/providers/exploreState/entities/types.d.ts +16 -0
  176. package/lib/providers/exploreState/entities/types.js +1 -0
  177. package/lib/providers/exploreState/entities.d.ts +1 -1
  178. package/lib/providers/exploreState/initializer/constants.js +1 -0
  179. package/lib/providers/exploreState/initializer/utils.js +26 -1
  180. package/lib/providers/exploreState.d.ts +8 -4
  181. package/lib/providers/exploreState.js +20 -15
  182. package/lib/providers/layoutState.d.ts +40 -0
  183. package/lib/providers/layoutState.js +47 -0
  184. package/lib/providers/services/provider.d.ts +14 -0
  185. package/lib/providers/services/provider.js +18 -0
  186. package/lib/providers/services/wasPop/context.d.ts +2 -0
  187. package/lib/providers/services/wasPop/context.js +5 -0
  188. package/lib/providers/services/wasPop/hook.d.ts +2 -0
  189. package/lib/providers/services/wasPop/hook.js +5 -0
  190. package/lib/providers/services/wasPop/provider.d.ts +16 -0
  191. package/lib/providers/services/wasPop/provider.js +30 -0
  192. package/lib/providers/services/wasPop/types.d.ts +6 -0
  193. package/lib/providers/services/wasPop/types.js +1 -0
  194. package/lib/services/beforePopState/popStateBus.d.ts +20 -0
  195. package/lib/services/beforePopState/popStateBus.js +58 -0
  196. package/lib/services/beforePopState/types.d.ts +11 -0
  197. package/lib/services/beforePopState/types.js +1 -0
  198. package/lib/services/beforePopState/useOnPopState.d.ts +2 -0
  199. package/lib/services/beforePopState/useOnPopState.js +10 -0
  200. package/lib/services/beforePopState/usePopStateBus.d.ts +6 -0
  201. package/lib/services/beforePopState/usePopStateBus.js +12 -0
  202. package/lib/styles/common/mixins/shadows.d.ts +3 -0
  203. package/lib/styles/common/mixins/shadows.js +4 -0
  204. package/lib/styles/common/mui/palette.d.ts +47 -0
  205. package/lib/styles/common/mui/palette.js +47 -0
  206. package/lib/theme/common/entities.d.ts +6 -0
  207. package/lib/theme/common/entities.js +1 -0
  208. package/lib/views/ExploreView/exploreView.js +15 -2
  209. package/lib/views/ExploreView/utils.d.ts +14 -0
  210. package/lib/views/ExploreView/utils.js +17 -0
  211. package/package.json +1 -1
  212. package/src/hooks/stateSyncManager/hook.ts +47 -0
  213. package/src/hooks/stateSyncManager/hooks/UseBeforePopState/hook.ts +30 -0
  214. package/src/hooks/stateSyncManager/hooks/UseMetaCommands/hook.ts +30 -0
  215. package/src/hooks/stateSyncManager/hooks/UseMetaCommands/types.ts +4 -0
  216. package/src/hooks/stateSyncManager/hooks/UseStateSync/hook.ts +52 -0
  217. package/src/hooks/stateSyncManager/hooks/UseStateSync/utils.ts +58 -0
  218. package/src/hooks/stateSyncManager/types.ts +34 -0
  219. package/src/providers/exploreState/actions/stateToUrl/action.ts +20 -0
  220. package/src/providers/exploreState/actions/stateToUrl/dispatch.ts +14 -0
  221. package/src/providers/exploreState/actions/stateToUrl/types.ts +15 -0
  222. package/src/providers/exploreState/actions/urlToState/action.ts +74 -0
  223. package/src/providers/exploreState/actions/urlToState/dispatch.ts +14 -0
  224. package/src/providers/exploreState/actions/urlToState/types.ts +11 -0
  225. package/src/providers/exploreState/actions/urlToState/utils.ts +18 -0
  226. package/src/providers/{exploreStateSync/hooks/UseMetaCommands/utils.ts → exploreState/entities/query/buildQuery.ts} +23 -26
  227. package/src/providers/exploreState/entities/state.ts +50 -0
  228. package/src/providers/exploreState/entities/types.ts +19 -0
  229. package/src/providers/exploreState/entities.ts +1 -1
  230. package/src/providers/exploreState/initializer/constants.ts +1 -0
  231. package/src/providers/exploreState/initializer/utils.ts +30 -1
  232. package/src/providers/exploreState.tsx +27 -20
  233. package/src/providers/services/provider.tsx +25 -0
  234. package/src/providers/services/wasPop/context.ts +7 -0
  235. package/src/providers/services/wasPop/hook.ts +7 -0
  236. package/src/providers/services/wasPop/provider.tsx +45 -0
  237. package/src/providers/services/wasPop/types.ts +7 -0
  238. package/src/services/beforePopState/popStateBus.ts +64 -0
  239. package/src/services/beforePopState/types.ts +15 -0
  240. package/src/services/beforePopState/useOnPopState.ts +15 -0
  241. package/src/services/beforePopState/usePopStateBus.ts +14 -0
  242. package/src/views/ExploreView/exploreView.tsx +17 -3
  243. package/src/views/ExploreView/utils.ts +25 -0
  244. package/lib/providers/exploreState/actions/syncStateFromUrl/action.d.ts +0 -10
  245. package/lib/providers/exploreState/actions/syncStateFromUrl/action.js +0 -25
  246. package/lib/providers/exploreState/actions/syncStateFromUrl/dispatch.d.ts +0 -7
  247. package/lib/providers/exploreState/actions/syncStateFromUrl/types.d.ts +0 -8
  248. package/lib/providers/exploreState/actions/syncStateFromUrl/utils.d.ts +0 -9
  249. package/lib/providers/exploreState/actions/syncStateFromUrl/utils.js +0 -23
  250. package/lib/providers/exploreState/hooks/UseBeforePopState/useBeforePopState.d.ts +0 -18
  251. package/lib/providers/exploreState/hooks/UseBeforePopState/useBeforePopState.js +0 -41
  252. package/lib/providers/exploreState/hooks/UseBeforePopState/utils.d.ts +0 -23
  253. package/lib/providers/exploreState/hooks/UseBeforePopState/utils.js +0 -68
  254. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.d.ts +0 -10
  255. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.js +0 -18
  256. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.d.ts +0 -1
  257. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.js +0 -33
  258. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/types.d.ts +0 -11
  259. package/lib/providers/exploreStateSync/provider.d.ts +0 -19
  260. package/lib/providers/exploreStateSync/provider.js +0 -22
  261. package/src/providers/exploreState/actions/syncStateFromUrl/action.ts +0 -44
  262. package/src/providers/exploreState/actions/syncStateFromUrl/dispatch.ts +0 -16
  263. package/src/providers/exploreState/actions/syncStateFromUrl/types.ts +0 -13
  264. package/src/providers/exploreState/actions/syncStateFromUrl/utils.ts +0 -31
  265. package/src/providers/exploreState/hooks/UseBeforePopState/useBeforePopState.ts +0 -46
  266. package/src/providers/exploreState/hooks/UseBeforePopState/utils.ts +0 -93
  267. package/src/providers/exploreStateSync/hooks/UseMetaCommands/handlers.ts +0 -25
  268. package/src/providers/exploreStateSync/hooks/UseMetaCommands/hook.ts +0 -38
  269. package/src/providers/exploreStateSync/hooks/UseMetaCommands/types.ts +0 -13
  270. package/src/providers/exploreStateSync/provider.tsx +0 -29
  271. /package/lib/{providers/exploreState/actions/syncStateFromUrl → components/DataDictionary/components/Table/columns}/types.js +0 -0
  272. /package/lib/{providers/exploreStateSync → hooks/stateSyncManager}/hooks/UseMetaCommands/types.js +0 -0
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { Alert } from "./bannerPrimary.styles";
3
+ export const BannerPrimary = ({ children, className, ...props /* Spread props to allow for Mui AlertProps specific prop overrides. */ }) => {
4
+ return (React.createElement(Alert, { className: className, color: "primary", elevation: 0, icon: false, variant: "standard", ...props }, children));
5
+ };
@@ -0,0 +1,3 @@
1
+ export declare const Alert: import("@emotion/styled").StyledComponent<import("@mui/material").AlertProps & {
2
+ theme?: import("@emotion/react").Theme;
3
+ }, {}, {}>;
@@ -0,0 +1,19 @@
1
+ import styled from "@emotion/styled";
2
+ import { Alert as MAlert } from "@mui/material";
3
+ import { primaryMain, white } from "../../../../../styles/common/mixins/colors";
4
+ import { textBodySmall400 } from "../../../../../styles/common/mixins/fonts";
5
+ export const Alert = styled(MAlert) `
6
+ border-radius: 0;
7
+ justify-content: center;
8
+ padding: 8px;
9
+
10
+ &.MuiAlert-standardPrimary {
11
+ background-color: ${primaryMain};
12
+ color: ${white};
13
+ }
14
+
15
+ .MuiAlert-message {
16
+ ${textBodySmall400};
17
+ text-align: center;
18
+ }
19
+ `;
@@ -0,0 +1,10 @@
1
+ import { AlertProps as MAlertProps } from "@mui/material";
2
+ import { ElementType, ReactNode } from "react";
3
+ export interface CookieBannerProps extends MAlertProps {
4
+ Alert?: ElementType;
5
+ children: ReactNode;
6
+ className?: string;
7
+ onDismiss?: () => void;
8
+ open: boolean;
9
+ }
10
+ export declare const DismissibleBanner: ({ Alert, className, children, onDismiss, open, ...props }: CookieBannerProps) => JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { Fade, Alert as MAlert, } from "@mui/material";
2
+ import React, { useEffect, useState } from "react";
3
+ export const DismissibleBanner = ({ Alert = MAlert /* Requires forwardRef to be used as a child of Fade. */, className, children, onDismiss, open, ...props /* Spread props to allow for Mui AlertProps specific prop overrides. */ }) => {
4
+ const [isIn, setIsIn] = useState(false);
5
+ // Callback fired when the component requests to be closed.
6
+ const onClose = () => {
7
+ onDismiss?.();
8
+ setIsIn(false);
9
+ };
10
+ // Sets the open state.
11
+ useEffect(() => {
12
+ setIsIn(open);
13
+ }, [open]);
14
+ return (React.createElement(Fade, { in: isIn, unmountOnExit: true },
15
+ React.createElement(Alert, { className: className, onClose: onClose, ...props }, children)));
16
+ };
@@ -0,0 +1,3 @@
1
+ export declare const Banner: import("@emotion/styled").StyledComponent<import("../BannerPrimary/bannerPrimary").BannerPrimaryProps & {
2
+ theme?: import("@emotion/react").Theme;
3
+ }, {}, {}>;
@@ -0,0 +1,21 @@
1
+ import styled from "@emotion/styled";
2
+ import { mediaDesktopUp } from "../../../../../styles/common/mixins/breakpoints";
3
+ import { BannerPrimary } from "../BannerPrimary/bannerPrimary";
4
+ export const Banner = styled(BannerPrimary) `
5
+ gap: 12px;
6
+ padding: 8px 12px;
7
+
8
+ ${mediaDesktopUp} {
9
+ padding: 8px 16px;
10
+ }
11
+
12
+ .MuiAlert-message {
13
+ align-self: center;
14
+ flex: 1;
15
+ }
16
+
17
+ .MuiAlert-action {
18
+ margin: -8px;
19
+ padding: 0;
20
+ }
21
+ `;
@@ -0,0 +1,3 @@
1
+ import { ButtonProps } from "../../button";
2
+ export type LoginButtonProps = Exclude<ButtonProps, "StartIcon">;
3
+ export declare const LoginButton: ({ children, ...props }: LoginButtonProps) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { LoginButton as Button, LoginButtonText } from "./loginButton.styles";
3
+ export const LoginButton = ({ children, ...props }) => {
4
+ return (React.createElement(Button, { fullWidth: true, ...props },
5
+ React.createElement(LoginButtonText, null, children)));
6
+ };
@@ -0,0 +1,7 @@
1
+ export declare const LoginButton: import("@emotion/styled").StyledComponent<Omit<import("../../button").ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement> & {
2
+ theme?: import("@emotion/react").Theme;
3
+ }, {}, {}>;
4
+ export declare const LoginButtonText: import("@emotion/styled").StyledComponent<{
5
+ theme?: import("@emotion/react").Theme;
6
+ as?: React.ElementType;
7
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -0,0 +1,11 @@
1
+ import styled from "@emotion/styled";
2
+ import { ButtonSecondary } from "../ButtonSecondary/buttonSecondary";
3
+ export const LoginButton = styled(ButtonSecondary) `
4
+ .MuiButton-endIcon {
5
+ margin-right: -6px;
6
+ }
7
+ `;
8
+ export const LoginButtonText = styled.span `
9
+ flex: 1;
10
+ text-align: left;
11
+ `;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Mock "loading" icon button - a placeholder element styled like a primary icon button without the use of a button element.
4
+ */
5
+ export declare const LoadingIconButton: () => JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { LoadingIcon } from "../../../CustomIcon/components/LoadingIcon/loadingIcon";
3
+ import { MockIconButtonPrimary } from "../../iconButton.styles";
4
+ /**
5
+ * Mock "loading" icon button - a placeholder element styled like a primary icon button without the use of a button element.
6
+ */
7
+ export const LoadingIconButton = () => {
8
+ return (React.createElement(MockIconButtonPrimary, null,
9
+ React.createElement(LoadingIcon, { fontSize: "small" })));
10
+ };
@@ -0,0 +1,3 @@
1
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, unknown>;
2
+ export default _default;
3
+ export declare const LoadingIconButtonStory: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, unknown>;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { LoadingIconButton } from "./loadingIconButton";
3
+ export default {
4
+ component: LoadingIconButton,
5
+ title: "Components/Common/IconButton/Download",
6
+ };
7
+ const LoadingIconButtonTemplate = () => React.createElement(LoadingIconButton, null);
8
+ export const LoadingIconButtonStory = LoadingIconButtonTemplate.bind({});
9
+ LoadingIconButtonStory.args = {};
@@ -0,0 +1,19 @@
1
+ import { UseStateSyncManagerProps } from "./types";
2
+ /**
3
+ * Synchronizes state (e.g. explore state, data dictionary state) with browser URL query parameters.
4
+ *
5
+ * Keeps state and URL in sync by:
6
+ * - Updating URL when state changes (push/replace).
7
+ * - Updating state when URL changes (navigation).
8
+ * - Handling browser history events (back/forward buttons).
9
+ *
10
+ * Internal components:
11
+ * 1. Pop-State Manager - Manages browser navigation events.
12
+ * 2. Meta-Command Handler - Processes URL update commands from state.
13
+ * 3. State-URL Sync - Coordinates bidirectional synchronization.
14
+ *
15
+ * Required setup:
16
+ * - Action creators for state/URL operations.
17
+ * - State containing command flags, URL parameters, and sync configuration.
18
+ */
19
+ export declare const useStateSyncManager: <Action>({ actions: actionCreators, dispatch, state, }: UseStateSyncManagerProps<Action>) => void;
@@ -0,0 +1,35 @@
1
+ import { useState } from "react";
2
+ import { useBeforePopState } from "./hooks/UseBeforePopState/hook";
3
+ import { useMetaCommands } from "./hooks/UseMetaCommands/hook";
4
+ import { useStateSync } from "./hooks/UseStateSync/hook";
5
+ /**
6
+ * Synchronizes state (e.g. explore state, data dictionary state) with browser URL query parameters.
7
+ *
8
+ * Keeps state and URL in sync by:
9
+ * - Updating URL when state changes (push/replace).
10
+ * - Updating state when URL changes (navigation).
11
+ * - Handling browser history events (back/forward buttons).
12
+ *
13
+ * Internal components:
14
+ * 1. Pop-State Manager - Manages browser navigation events.
15
+ * 2. Meta-Command Handler - Processes URL update commands from state.
16
+ * 3. State-URL Sync - Coordinates bidirectional synchronization.
17
+ *
18
+ * Required setup:
19
+ * - Action creators for state/URL operations.
20
+ * - State containing command flags, URL parameters, and sync configuration.
21
+ */
22
+ export const useStateSyncManager = ({ actions: actionCreators, dispatch, state, }) => {
23
+ /**
24
+ * Store action creators in state to maintain referential stability across renders.
25
+ * This prevents unnecessary re-renders in hooks that depend on these actions
26
+ * and ensures effect dependencies remain stable.
27
+ */
28
+ const [actions] = useState(() => actionCreators);
29
+ // Register pop state related side effects.
30
+ useBeforePopState();
31
+ // Set up Meta-commands related side effects.
32
+ useMetaCommands({ actions, dispatch, state });
33
+ // Dispatch state <-> URL sync side effects.
34
+ useStateSync({ actions, dispatch, state });
35
+ };
@@ -0,0 +1 @@
1
+ export declare const useBeforePopState: () => void;
@@ -0,0 +1,21 @@
1
+ import Router from "next/router";
2
+ import { useCallback } from "react";
3
+ import { useOnPopState } from "../../../../services/beforePopState/useOnPopState";
4
+ export const useBeforePopState = () => {
5
+ // Callback to handle beforePopState.
6
+ const onBeforePopState = useCallback((state) => {
7
+ const basePath = Router.basePath ?? "";
8
+ // Use regex to remove the base path from the beginning of the URL.
9
+ const as = basePath
10
+ ? state.as.replace(new RegExp(`^${basePath}`), "") || "/"
11
+ : state.as;
12
+ // Force a full route transition to ensure page props are refreshed.
13
+ Router.replace(as, undefined, {
14
+ ...state.options,
15
+ shallow: false,
16
+ });
17
+ return false;
18
+ }, []);
19
+ // Pop state related side effects.
20
+ useOnPopState(onBeforePopState);
21
+ };
@@ -0,0 +1,2 @@
1
+ import { UseStateSyncManagerProps } from "../../types";
2
+ export declare const useMetaCommands: <Action>({ actions, dispatch, state, }: UseStateSyncManagerProps<Action>) => void;
@@ -0,0 +1,23 @@
1
+ import Router, { useRouter } from "next/router";
2
+ import { useEffect } from "react";
3
+ import { META_COMMAND } from "./types";
4
+ export const useMetaCommands = ({ actions, dispatch, state, }) => {
5
+ const { isReady } = useRouter();
6
+ useEffect(() => {
7
+ if (!isReady)
8
+ return;
9
+ const { command, query } = state;
10
+ switch (command) {
11
+ case META_COMMAND.STATE_TO_URL_PUSH:
12
+ Router.push({ query }, undefined, { shallow: true });
13
+ dispatch(actions.clearMeta());
14
+ break;
15
+ case META_COMMAND.STATE_TO_URL_REPLACE:
16
+ Router.replace({ query }, undefined, { shallow: true });
17
+ dispatch(actions.clearMeta());
18
+ break;
19
+ default:
20
+ break;
21
+ }
22
+ }, [actions, dispatch, isReady, state]);
23
+ };
@@ -0,0 +1,4 @@
1
+ export declare enum META_COMMAND {
2
+ STATE_TO_URL_PUSH = "STATE_TO_URL_PUSH",
3
+ STATE_TO_URL_REPLACE = "STATE_TO_URL_REPLACE"
4
+ }
@@ -0,0 +1,2 @@
1
+ import { UseStateSyncManagerProps } from "../../types";
2
+ export declare const useStateSync: <Action>({ actions, dispatch, state, }: UseStateSyncManagerProps<Action>) => void;
@@ -0,0 +1,40 @@
1
+ import { useRouter } from "next/router";
2
+ import { useEffect } from "react";
3
+ import { ROUTER_METHOD } from "../../../../providers/exploreState/actions/stateToUrl/types";
4
+ import { useWasPop } from "../../../../providers/services/wasPop/hook";
5
+ import { hasParams, isSynced, wasPop } from "./utils";
6
+ export const useStateSync = ({ actions, dispatch, state, }) => {
7
+ const { basePath, isReady, pathname, query } = useRouter();
8
+ const { onClearPopRef, popRef } = useWasPop();
9
+ // Extract the query from the state.
10
+ const stateQuery = state.query;
11
+ // Extract the param keys from the state.
12
+ const paramKeys = state.paramKeys;
13
+ // Dispatch action to sync state <-> URL.
14
+ useEffect(() => {
15
+ // Do nothing if the router is not ready.
16
+ if (!isReady)
17
+ return;
18
+ // Do nothing; URL and state are in sync.
19
+ if (isSynced(stateQuery, query)) {
20
+ onClearPopRef();
21
+ return;
22
+ }
23
+ // Dispatch action sync URL >> state.
24
+ if (wasPop(basePath, pathname, popRef.current)) {
25
+ // When the user navigates with the back/forward buttons.
26
+ dispatch(actions.urlToState({ query }));
27
+ onClearPopRef();
28
+ return;
29
+ }
30
+ // Dispatch action sync URL >> state.
31
+ if (hasParams(query, paramKeys)) {
32
+ // When the URL has parameters.
33
+ dispatch(actions.urlToState({ query }));
34
+ return;
35
+ }
36
+ // Otherwise, dispatch action sync URL << state.
37
+ dispatch(actions.stateToUrl({ method: ROUTER_METHOD.REPLACE }));
38
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- deliberate omission of `state.query`, `state.paramKeys`, `actions` and `dispatch` from dependencies, hook is only expected to run when the Next.js router changes.
39
+ }, [basePath, isReady, pathname, query]);
40
+ };
@@ -0,0 +1,30 @@
1
+ import { NextRouter } from "next/router";
2
+ import { NextHistoryState } from "../../../../services/beforePopState/types";
3
+ /**
4
+ * Returns true if the query object has any of the specified keys.
5
+ * @param query - Query object.
6
+ * @param paramKeys - Array of parameter keys to check.
7
+ * @returns True if the query object has any of the specified keys.
8
+ */
9
+ export declare function hasParams(query: NextRouter["query"], paramKeys: string[]): boolean;
10
+ /**
11
+ * Returns true if the two query objects are equal.
12
+ * @param queryA - Query object.
13
+ * @param queryB - Query object.
14
+ * @returns True if the two query objects are equal.
15
+ */
16
+ export declare function isSynced(queryA: NextRouter["query"], queryB: NextRouter["query"]): boolean;
17
+ /**
18
+ * Returns a sorted string representation of a query object.
19
+ * @param query - Query object.
20
+ * @returns Sorted string representation of the query object.
21
+ */
22
+ export declare function stringifyQuery(query: NextRouter["query"]): string;
23
+ /**
24
+ * Returns true if the URL was navigated to using the back/forward buttons.
25
+ * @param basePath - Base path.
26
+ * @param pathname - Pathname.
27
+ * @param nextHistoryState - Next history state.
28
+ * @returns True if the URL was navigated to using the back/forward buttons.
29
+ */
30
+ export declare function wasPop(basePath: string | undefined, pathname: string, nextHistoryState: NextHistoryState | undefined): boolean;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Returns true if the query object has any of the specified keys.
3
+ * @param query - Query object.
4
+ * @param paramKeys - Array of parameter keys to check.
5
+ * @returns True if the query object has any of the specified keys.
6
+ */
7
+ export function hasParams(query, paramKeys) {
8
+ return paramKeys.some((key) => query[key] !== undefined);
9
+ }
10
+ /**
11
+ * Returns true if the two query objects are equal.
12
+ * @param queryA - Query object.
13
+ * @param queryB - Query object.
14
+ * @returns True if the two query objects are equal.
15
+ */
16
+ export function isSynced(queryA, queryB) {
17
+ return stringifyQuery(queryA) === stringifyQuery(queryB);
18
+ }
19
+ /**
20
+ * Returns a sorted string representation of a query object.
21
+ * @param query - Query object.
22
+ * @returns Sorted string representation of the query object.
23
+ */
24
+ export function stringifyQuery(query) {
25
+ return JSON.stringify(Object.keys(query)
26
+ .sort()
27
+ .reduce((acc, key) => ({ ...acc, [key]: query[key] }), {}));
28
+ }
29
+ /**
30
+ * Returns true if the URL was navigated to using the back/forward buttons.
31
+ * @param basePath - Base path.
32
+ * @param pathname - Pathname.
33
+ * @param nextHistoryState - Next history state.
34
+ * @returns True if the URL was navigated to using the back/forward buttons.
35
+ */
36
+ export function wasPop(basePath = "", pathname, nextHistoryState) {
37
+ if (!nextHistoryState)
38
+ return false;
39
+ const [path] = nextHistoryState.url.split("?");
40
+ return path === `${basePath}${pathname}`;
41
+ }
@@ -0,0 +1,26 @@
1
+ import { NextRouter } from "next/router";
2
+ import { Dispatch } from "react";
3
+ import { ROUTER_METHOD } from "../../providers/exploreState/actions/stateToUrl/types";
4
+ import { META_COMMAND } from "./hooks/UseMetaCommands/types";
5
+ export type ActionCreator<P, DispatchType> = [P] extends [void] ? () => DispatchType : (payload: P) => DispatchType;
6
+ export interface StateToUrlPayload {
7
+ method: ROUTER_METHOD;
8
+ }
9
+ export interface UrlToStatePayload {
10
+ query: NextRouter["query"];
11
+ }
12
+ export interface StateSyncManagerActions<Action> {
13
+ clearMeta: ActionCreator<void, Action>;
14
+ stateToUrl: ActionCreator<StateToUrlPayload, Action>;
15
+ urlToState: ActionCreator<UrlToStatePayload, Action>;
16
+ }
17
+ export interface StateSyncManagerContext {
18
+ command: META_COMMAND | undefined;
19
+ paramKeys: string[];
20
+ query: NextRouter["query"];
21
+ }
22
+ export interface UseStateSyncManagerProps<Action> {
23
+ actions: StateSyncManagerActions<Action>;
24
+ dispatch: Dispatch<Action>;
25
+ state: StateSyncManagerContext;
26
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { LoginResponse, LoginStatus } from "./entities";
2
+ export declare const LOGIN_STATUS_FAILED: LoginStatus<LoginResponse>;
3
+ export declare const LOGIN_STATUS_NOT_STARTED: LoginStatus<LoginResponse>;
4
+ export declare const LOGIN_STATUS_NOT_SUPPORTED: LoginStatus<LoginResponse>;
@@ -0,0 +1,19 @@
1
+ import { REQUEST_STATUS } from "./entities";
2
+ export const LOGIN_STATUS_FAILED = {
3
+ isSuccess: false,
4
+ isSupported: true,
5
+ requestStatus: REQUEST_STATUS.FAILED,
6
+ response: undefined,
7
+ };
8
+ export const LOGIN_STATUS_NOT_STARTED = {
9
+ isSuccess: false,
10
+ isSupported: true,
11
+ requestStatus: REQUEST_STATUS.NOT_STARTED,
12
+ response: undefined,
13
+ };
14
+ export const LOGIN_STATUS_NOT_SUPPORTED = {
15
+ isSuccess: false,
16
+ isSupported: false,
17
+ requestStatus: REQUEST_STATUS.NOT_STARTED,
18
+ response: undefined,
19
+ };
@@ -0,0 +1,25 @@
1
+ import { GoogleResponse } from "../useFetchGoogleProfile";
2
+ import { TerraNIHResponse } from "../useFetchTerraNIHProfile";
3
+ import { TerraResponse } from "../useFetchTerraProfile";
4
+ import { TerraTermsOfServiceResponse } from "../useFetchTerraTermsOfService";
5
+ export declare enum AUTHENTICATION_STATUS {
6
+ COMPLETED = "COMPLETED",
7
+ INCOMPLETE = "INCOMPLETE"
8
+ }
9
+ export type LoginResponse = GoogleResponse | TerraResponse | TerraNIHResponse | TerraTermsOfServiceResponse;
10
+ export interface LoginResponseError {
11
+ message: string;
12
+ source: string;
13
+ statusCode: number;
14
+ }
15
+ export interface LoginStatus<T> {
16
+ isSuccess: boolean;
17
+ isSupported: boolean;
18
+ requestStatus: REQUEST_STATUS;
19
+ response: T | undefined;
20
+ }
21
+ export declare enum REQUEST_STATUS {
22
+ COMPLETED = "COMPLETED",
23
+ FAILED = "FAILED",
24
+ NOT_STARTED = "NOT_STARTED"
25
+ }
@@ -0,0 +1,11 @@
1
+ export var AUTHENTICATION_STATUS;
2
+ (function (AUTHENTICATION_STATUS) {
3
+ AUTHENTICATION_STATUS["COMPLETED"] = "COMPLETED";
4
+ AUTHENTICATION_STATUS["INCOMPLETE"] = "INCOMPLETE";
5
+ })(AUTHENTICATION_STATUS || (AUTHENTICATION_STATUS = {}));
6
+ export var REQUEST_STATUS;
7
+ (function (REQUEST_STATUS) {
8
+ REQUEST_STATUS["COMPLETED"] = "COMPLETED";
9
+ REQUEST_STATUS["FAILED"] = "FAILED";
10
+ REQUEST_STATUS["NOT_STARTED"] = "NOT_STARTED";
11
+ })(REQUEST_STATUS || (REQUEST_STATUS = {}));
@@ -0,0 +1,15 @@
1
+ import { LoginResponse, LoginStatus } from "./entities";
2
+ /**
3
+ * Returns the options for an authentication request.
4
+ * @param token - Token.
5
+ * @returns request options.
6
+ */
7
+ export declare function getAuthenticationRequestOptions(token: string): RequestInit;
8
+ /**
9
+ * Returns login status.
10
+ * An undefined endpoint will return a not supported login status,
11
+ * otherwise a not started login status is returned.
12
+ * @param endpoint - Endpoint.
13
+ * @returns initial login status.
14
+ */
15
+ export declare function initLoginStatus(endpoint?: string): LoginStatus<LoginResponse>;
@@ -0,0 +1,25 @@
1
+ import { LOGIN_STATUS_NOT_STARTED, LOGIN_STATUS_NOT_SUPPORTED, } from "./constants";
2
+ /**
3
+ * Returns the options for an authentication request.
4
+ * @param token - Token.
5
+ * @returns request options.
6
+ */
7
+ export function getAuthenticationRequestOptions(token) {
8
+ const headers = new Headers();
9
+ headers.append("authorization", "Bearer " + token);
10
+ return { headers };
11
+ }
12
+ /**
13
+ * Returns login status.
14
+ * An undefined endpoint will return a not supported login status,
15
+ * otherwise a not started login status is returned.
16
+ * @param endpoint - Endpoint.
17
+ * @returns initial login status.
18
+ */
19
+ export function initLoginStatus(endpoint) {
20
+ if (!endpoint) {
21
+ // Endpoint not supported.
22
+ return LOGIN_STATUS_NOT_SUPPORTED;
23
+ }
24
+ return LOGIN_STATUS_NOT_STARTED;
25
+ }
@@ -0,0 +1,6 @@
1
+ import { AuthContextProps } from "../../providers/authentication";
2
+ /**
3
+ * Returns authentication context.
4
+ * @returns authentication context.
5
+ */
6
+ export declare const useAuthentication: () => AuthContextProps;
@@ -0,0 +1,9 @@
1
+ import { useContext } from "react";
2
+ import { AuthContext } from "../../providers/authentication";
3
+ /**
4
+ * Returns authentication context.
5
+ * @returns authentication context.
6
+ */
7
+ export const useAuthentication = () => {
8
+ return useContext(AuthContext);
9
+ };
@@ -0,0 +1,6 @@
1
+ import { AUTHENTICATION_STATUS } from "./common/entities";
2
+ /**
3
+ * Handles the completion of the authentication process.
4
+ * @param authenticationStatus - Authentication status.
5
+ */
6
+ export declare const useAuthenticationComplete: (authenticationStatus: AUTHENTICATION_STATUS) => void;
@@ -0,0 +1,55 @@
1
+ import Router, { useRouter } from "next/router";
2
+ import { useEffect, useMemo, useRef } from "react";
3
+ import { escapeRegExp } from "../../common/utils";
4
+ import { ROUTE_LOGIN } from "../../providers/authentication";
5
+ import { INACTIVITY_PARAM } from "../useSessionTimeout";
6
+ import { AUTHENTICATION_STATUS } from "./common/entities";
7
+ /**
8
+ * Handles the completion of the authentication process.
9
+ * @param authenticationStatus - Authentication status.
10
+ */
11
+ export const useAuthenticationComplete = (authenticationStatus) => {
12
+ const { asPath } = useRouter();
13
+ const routeHistoryRef = useRef(initRouteHistory(asPath));
14
+ // Maintain a history of routes that have been visited prior to authentication.
15
+ routeHistoryRef.current = useMemo(() => updateRouteHistory(routeHistoryRef.current, asPath), [asPath]);
16
+ // Redirect to the previous route after authentication is completed.
17
+ useEffect(() => {
18
+ if (authenticationStatus === AUTHENTICATION_STATUS.COMPLETED) {
19
+ Router.push(routeHistoryRef.current);
20
+ }
21
+ }, [authenticationStatus]);
22
+ };
23
+ /**
24
+ * Initializes route history with the current path.
25
+ * Returns base path if current path is the login route.
26
+ * @param path - current browser path.
27
+ * @returns path to be used as the initial route history.
28
+ */
29
+ function initRouteHistory(path) {
30
+ return path === ROUTE_LOGIN ? "/" : removeInactivityTimeoutQueryParam(path);
31
+ }
32
+ /**
33
+ * Removes the inactivity timeout query parameter from the path.
34
+ * the inactivity timeout parameter is used to indicate that the session has timed out; remove the parameter to
35
+ * clear the session timeout banner after the user logs in again.
36
+ * @param path - Path.
37
+ * @returns path without the inactivity timeout query parameter.
38
+ */
39
+ function removeInactivityTimeoutQueryParam(path) {
40
+ const regex = new RegExp(`\\?${escapeRegExp(INACTIVITY_PARAM)}(?:$|[=&].*)`);
41
+ return path.replace(regex, "");
42
+ }
43
+ /**
44
+ * Updates route history with the current path, unless the current path is the LoginView page.
45
+ * @param prevPath - route history path.
46
+ * @param path - current browser path.
47
+ * @returns updated path to be used as the route history.
48
+ */
49
+ function updateRouteHistory(prevPath, path) {
50
+ let currentPath = prevPath;
51
+ if (path !== ROUTE_LOGIN) {
52
+ currentPath = path;
53
+ }
54
+ return removeInactivityTimeoutQueryParam(currentPath);
55
+ }
@@ -0,0 +1,20 @@
1
+ export interface OnboardingStatus {
2
+ active: boolean;
3
+ completed: boolean;
4
+ }
5
+ export declare enum ONBOARDING_STEP {
6
+ NIH_ACCOUNT = 3,
7
+ TERRA_ACCOUNT = 1,
8
+ TERRA_TOS = 2
9
+ }
10
+ interface UseAuthenticationForm {
11
+ isComplete: boolean;
12
+ isReady: boolean;
13
+ onboardingStatusByStep: Map<ONBOARDING_STEP, OnboardingStatus>;
14
+ }
15
+ /**
16
+ * Handles authentication form onboarding.
17
+ * @returns onboarding steps and corresponding status.
18
+ */
19
+ export declare const useAuthenticationForm: () => UseAuthenticationForm;
20
+ export {};