@databiosphere/findable-ui 23.0.0 → 25.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/.storybook/preview.js +4 -37
- package/CHANGELOG.md +64 -0
- package/jest.config.js +1 -0
- package/lib/common/entities.d.ts +1 -0
- package/lib/components/DataDictionary/components/Entities/constants.d.ts +2 -2
- package/lib/components/DataDictionary/components/Entities/constants.js +1 -1
- package/lib/components/DataDictionary/components/Entities/entities.js +3 -3
- package/lib/components/DataDictionary/components/Entity/constants.d.ts +2 -2
- package/lib/components/DataDictionary/components/Entity/constants.js +1 -1
- package/lib/components/DataDictionary/components/Entity/entity.js +4 -4
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +8 -0
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +36 -0
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.js +1 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.js +2 -2
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
- package/lib/components/Filter/components/SearchAllFiltersSearch/components/SearchCloseButton/searchCloseButton.js +2 -2
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.js +17 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.styles.d.ts +13 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.styles.js +12 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.d.ts +9 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.js +9 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.js +86 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.d.ts +105 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.js +196 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.js +7 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.styles.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.styles.js +29 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/constants.d.ts +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/constants.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/args.d.ts +4 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/args.js +70 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories.d.ts +7 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories.js +19 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/types.d.ts +6 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/types.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/constants.d.ts +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/constants.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/types.d.ts +7 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/types.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/useChartView.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/useChartView.js +11 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/stories/args.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/stories/args.js +96 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/stories/chartView.stories.d.ts +6 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/stories/chartView.stories.js +16 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/types.d.ts +6 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/types.js +1 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/utils.d.ts +14 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/utils.js +21 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/entityList.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/entityList.js +16 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/types.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/types.js +1 -0
- package/lib/components/Index/components/EntitiesView/constants.d.ts +1 -0
- package/lib/components/Index/components/EntitiesView/constants.js +1 -0
- package/lib/components/Index/components/EntitiesView/entitiesView.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/entitiesView.js +14 -0
- package/lib/components/Index/components/EntitiesView/entitiesView.styles.d.ts +3 -0
- package/lib/components/Index/components/EntitiesView/entitiesView.styles.js +20 -0
- package/lib/components/Index/components/EntitiesView/hooks/UseEntitiesView/hook.d.ts +2 -0
- package/lib/components/Index/components/EntitiesView/hooks/UseEntitiesView/hook.js +14 -0
- package/lib/components/Index/components/EntitiesView/hooks/UseEntitiesView/types.d.ts +13 -0
- package/lib/components/Index/components/EntitiesView/hooks/UseEntitiesView/types.js +5 -0
- package/lib/components/Index/components/EntitiesView/stories/entitiesView.stories.d.ts +8 -0
- package/lib/components/Index/components/EntitiesView/stories/entitiesView.stories.js +50 -0
- package/lib/components/Index/components/EntitiesView/types.d.ts +8 -0
- package/lib/components/Index/components/EntitiesView/types.js +1 -0
- package/lib/components/Index/components/NTagCell/nTagCell.stories.d.ts +5 -16
- package/lib/components/Index/components/NTagCell/nTagCell.stories.js +8 -8
- package/lib/components/Index/components/TitleCell/titleCell.d.ts +6 -0
- package/lib/components/Index/components/TitleCell/titleCell.js +10 -0
- package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +3 -0
- package/lib/components/Index/components/TitleCell/titleCell.styles.js +6 -0
- package/lib/components/Index/index.d.ts +2 -13
- package/lib/components/Index/index.js +6 -2
- package/lib/components/Index/index.stories.js +3 -2
- package/lib/components/Index/types.d.ts +12 -0
- package/lib/components/Index/types.js +1 -0
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.d.ts +1 -1
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.js +5 -4
- package/lib/components/Layout/components/BackPage/components/BackPageHero/stories/backPageHero.stories.d.ts +6 -0
- package/lib/components/Layout/components/BackPage/components/BackPageHero/stories/backPageHero.stories.js +18 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.js +3 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.d.ts +5 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.js +29 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.styles.d.ts +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +6 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +13 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +36 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +9 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Toolbar/toolbar.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.js +5 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.d.ts +5 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.js +4 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +5 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +10 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +36 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +9 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.js +2 -2
- package/lib/components/Layout/components/Header/hooks/useMeasureHeader.d.ts +5 -0
- package/lib/components/Layout/components/Header/hooks/useMeasureHeader.js +19 -0
- package/lib/components/Layout/components/Outline/common/constants.d.ts +2 -0
- package/lib/components/Layout/components/Outline/common/constants.js +1 -0
- package/lib/components/Layout/components/Outline/outline.styles.d.ts +1 -1
- package/lib/components/Layout/components/Sidebar/components/SidebarButton/sidebarButton.js +2 -2
- package/lib/components/Loading/loading.d.ts +2 -1
- package/lib/components/Loading/loading.js +2 -2
- package/lib/components/Loading/loading.stories.d.ts +3 -31
- package/lib/components/Login/components/Button/button.styles.d.ts +1 -1
- package/lib/components/Login/components/Section/components/Consent/consent.js +3 -3
- package/lib/components/Login/components/Section/components/Consent/consent.styles.d.ts +1 -1
- package/lib/components/Login/components/Section/components/Consent/consent.styles.js +2 -2
- package/lib/components/Login/components/Section/components/Consent/types.d.ts +2 -2
- package/lib/components/Login/login.stories.d.ts +6 -0
- package/lib/components/Login/login.stories.js +31 -0
- package/lib/components/NoResults/noResults.d.ts +1 -8
- package/lib/components/NoResults/noResults.js +9 -8
- package/lib/components/NoResults/noResults.styles.d.ts +2 -2
- package/lib/components/NoResults/noResults.styles.js +4 -2
- package/lib/components/NoResults/types.d.ts +8 -0
- package/lib/components/NoResults/types.js +1 -0
- package/lib/components/Plot/components/BarX/barX.d.ts +2 -0
- package/lib/components/Plot/components/BarX/barX.js +13 -0
- package/lib/components/Plot/components/BarX/types.d.ts +5 -0
- package/lib/components/Plot/components/BarX/types.js +1 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.js +7 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.styles.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.styles.js +17 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.js +8 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.styles.d.ts +5 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.styles.js +15 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/contants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/contants.js +4 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/constants.d.ts +1 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/constants.js +1 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.styles.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.styles.js +27 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories.d.ts +9 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories.js +38 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/constants.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/constants.js +11 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/icon.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/icon.js +9 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/contants.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/contants.js +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/icon.stories.d.ts +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/icon.stories.js +20 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/types.d.ts +7 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/types.js +1 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/constants.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.styles.d.ts +5 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.styles.js +7 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/stories/label.stories.d.ts +7 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/stories/label.stories.js +21 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/constants.js +5 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/optional.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/optional.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/constants.js +8 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.styles.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.styles.js +12 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/contants.d.ts +4 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/contants.js +15 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/stepLabel.stories.d.ts +8 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/stepLabel.stories.js +37 -0
- package/lib/components/Stepper/components/Step/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/constants.js +4 -0
- package/lib/components/Stepper/components/Step/step.d.ts +3 -0
- package/lib/components/Stepper/components/Step/step.js +6 -0
- package/lib/components/Stepper/components/Step/step.styles.d.ts +5 -0
- package/lib/components/Stepper/components/Step/step.styles.js +31 -0
- package/lib/components/Stepper/components/Step/stories/contants.d.ts +4 -0
- package/lib/components/Stepper/components/Step/stories/contants.js +14 -0
- package/lib/components/Stepper/components/Step/stories/step.stories.d.ts +8 -0
- package/lib/components/Stepper/components/Step/stories/step.stories.js +62 -0
- package/lib/components/Support/components/SupportRequest/components/Dialog/dialog.js +2 -2
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.d.ts +16 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +28 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.d.ts +5 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.js +46 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +3 -0
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +21 -0
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +2 -0
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +37 -0
- package/lib/components/Table/components/Pagination/pagination.js +3 -4
- package/lib/components/Table/components/TableHead/tableHead.js +2 -2
- package/lib/components/Table/table.js +11 -11
- package/lib/components/TableCreator/common/constants.d.ts +6 -0
- package/lib/components/TableCreator/common/constants.js +19 -0
- package/lib/components/TableCreator/common/entities.d.ts +5 -0
- package/lib/components/TableCreator/common/entities.js +1 -0
- package/lib/components/TableCreator/tableCreator.js +1 -6
- package/lib/components/common/Alert/alert.stories.d.ts +6 -0
- package/lib/components/common/Alert/alert.stories.js +36 -0
- package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +4 -0
- package/lib/components/common/Alert/components/AlertText/alertText.styles.js +19 -0
- package/lib/components/common/AnchorLink/anchorLink.js +2 -2
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +7 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +5 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +3 -0
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +19 -0
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +10 -0
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +16 -0
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +3 -0
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +21 -0
- package/lib/components/common/Breadcrumbs/breadcrumbs.js +2 -2
- package/lib/components/common/Breadcrumbs/typeGuard.d.ts +13 -0
- package/lib/components/common/Breadcrumbs/typeGuard.js +23 -0
- package/lib/components/common/Button/components/DropdownButton/dropdownButton.js +2 -2
- package/lib/components/common/Button/components/LoginButton/loginButton.d.ts +3 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.js +6 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.d.ts +7 -0
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.js +11 -0
- package/lib/components/common/Button/components/NavigationButton/navigationButton.js +2 -2
- package/lib/components/common/CopyToClipboard/copyToClipboard.js +2 -2
- package/lib/components/common/Dialog/components/DialogTitle/dialogTitle.js +2 -2
- package/lib/components/common/Drawer/components/DrawerTitle/drawerTitle.js +2 -2
- package/lib/components/common/Form/components/Select/components/DropDownIcon/dropDownIcon.d.ts +2 -3
- package/lib/components/common/Form/components/Select/components/DropDownIcon/dropDownIcon.js +3 -3
- package/lib/components/common/Form/components/UploadFile/uploadFile.js +2 -2
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +5 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +10 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +3 -0
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +9 -0
- package/lib/components/common/IconButton/iconButton.styles.d.ts +1 -1
- package/lib/components/common/KeyValuePairs/components/KeyElType/keyElType.d.ts +2 -5
- package/lib/components/common/KeyValuePairs/components/KeyElType/keyElType.js +6 -2
- package/lib/components/common/KeyValuePairs/components/ValueElType/valueElType.d.ts +2 -5
- package/lib/components/common/KeyValuePairs/components/ValueElType/valueElType.js +6 -2
- package/lib/components/common/LoginDialog/loginDialog.styles.js +1 -1
- package/lib/components/common/Paper/paper.d.ts +2 -1
- package/lib/components/common/Paper/paper.js +2 -2
- package/lib/components/common/Section/components/CollapsableSection/collapsableSection.js +2 -3
- package/lib/components/common/ToggleButtonGroup/hooks/UseToggleButtonGroup/hook.d.ts +2 -0
- package/lib/components/common/ToggleButtonGroup/hooks/UseToggleButtonGroup/hook.js +10 -0
- package/lib/components/types.d.ts +3 -0
- package/lib/config/entities.d.ts +2 -0
- package/lib/hooks/useAuthentication/common/constants.d.ts +4 -0
- package/lib/hooks/useAuthentication/common/constants.js +19 -0
- package/lib/hooks/useAuthentication/common/entities.d.ts +25 -0
- package/lib/hooks/useAuthentication/common/entities.js +11 -0
- package/lib/hooks/useAuthentication/common/utils.d.ts +15 -0
- package/lib/hooks/useAuthentication/common/utils.js +25 -0
- package/lib/hooks/useAuthentication/useAuthentication.d.ts +6 -0
- package/lib/hooks/useAuthentication/useAuthentication.js +9 -0
- package/lib/hooks/useAuthentication/useAuthenticationComplete.d.ts +6 -0
- package/lib/hooks/useAuthentication/useAuthenticationComplete.js +55 -0
- package/lib/hooks/useAuthentication/useAuthenticationForm.d.ts +20 -0
- package/lib/hooks/useAuthentication/useAuthenticationForm.js +88 -0
- package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.d.ts +18 -0
- package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.js +50 -0
- package/lib/hooks/useAuthentication/useAuthenticationStatus.d.ts +20 -0
- package/lib/hooks/useAuthentication/useAuthenticationStatus.js +32 -0
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.d.ts +21 -0
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.js +41 -0
- package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.d.ts +18 -0
- package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.js +62 -0
- package/lib/hooks/useAuthentication/useFetchTerraProfile.d.ts +24 -0
- package/lib/hooks/useAuthentication/useFetchTerraProfile.js +62 -0
- package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.d.ts +15 -0
- package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.js +62 -0
- package/lib/hooks/useAuthentication/useTokenClient.d.ts +11 -0
- package/lib/hooks/useAuthentication/useTokenClient.js +29 -0
- package/lib/hooks/useAuthenticationConfig.d.ts +6 -0
- package/lib/hooks/useAuthenticationConfig.js +14 -0
- package/lib/hooks/useCategoryConfigs.d.ts +6 -0
- package/lib/hooks/useCategoryConfigs.js +17 -0
- package/lib/hooks/useCategoryFilter.js +1 -0
- package/lib/hooks/useEntityListRelatedView.d.ts +15 -0
- package/lib/hooks/useEntityListRelatedView.js +62 -0
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +15 -0
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +27 -0
- package/lib/hooks/useFileManifest/useFileManifestURL.d.ts +5 -0
- package/lib/hooks/useFileManifest/useFileManifestURL.js +11 -0
- package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +9 -0
- package/lib/hooks/useFileManifest/useRequestFileManifest.js +37 -0
- package/lib/hooks/useLayoutState.d.ts +6 -0
- package/lib/hooks/useLayoutState.js +9 -0
- package/lib/hooks/useMenu.d.ts +10 -0
- package/lib/hooks/useMenu.js +17 -0
- package/lib/hooks/useMenuWithPosition.d.ts +14 -0
- package/lib/hooks/useMenuWithPosition.js +33 -0
- package/lib/hooks/useResizeObserver.d.ts +2 -1
- package/lib/hooks/useResizeObserver.js +5 -2
- package/lib/hooks/useSessionTimeout.d.ts +11 -0
- package/lib/hooks/useSessionTimeout.js +28 -0
- package/lib/providers/authentication.d.ts +51 -0
- package/lib/providers/authentication.js +110 -0
- package/lib/providers/layoutState.d.ts +40 -0
- package/lib/providers/layoutState.js +47 -0
- package/lib/storybook/controls/constants.d.ts +4 -0
- package/lib/storybook/controls/constants.js +6 -0
- package/lib/storybook/controls/types.d.ts +4 -0
- package/lib/storybook/controls/types.js +5 -0
- package/lib/storybook/controls/utils.d.ts +9 -0
- package/lib/storybook/controls/utils.js +10 -0
- package/lib/storybook/decorators.d.ts +2 -0
- package/lib/storybook/decorators.js +11 -0
- package/lib/storybook/loremIpsum.d.ts +4 -0
- package/lib/storybook/loremIpsum.js +4 -0
- package/lib/storybook/parameters.d.ts +2 -0
- package/lib/storybook/parameters.js +12 -0
- package/lib/styles/common/mui/palette.d.ts +47 -0
- package/lib/styles/common/mui/palette.js +47 -0
- package/lib/styles/common/mui/stepper.d.ts +7 -0
- package/lib/styles/common/mui/stepper.js +7 -0
- package/lib/styles/common/mui/svgIcon.d.ts +9 -0
- package/lib/styles/common/mui/svgIcon.js +26 -0
- package/lib/styles/common/mui/typography.js +1 -0
- package/lib/tests/mui/constants.d.ts +4 -0
- package/lib/tests/mui/constants.js +4 -0
- package/lib/theme/common/typography.d.ts +6 -2
- package/lib/theme/common/typography.js +10 -1
- package/lib/theme/theme.js +2 -0
- package/lib/utils/tests.d.ts +12 -0
- package/lib/utils/tests.js +20 -0
- package/lib/views/ExploreView/exploreView.js +4 -24
- package/package.json +6 -4
- package/src/common/entities.ts +1 -0
- package/src/components/DataDictionary/components/Entities/constants.ts +2 -2
- package/src/components/DataDictionary/components/Entities/entities.tsx +4 -4
- package/src/components/DataDictionary/components/Entity/constants.ts +2 -2
- package/src/components/DataDictionary/components/Entity/entity.tsx +6 -6
- package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.tsx +1 -1
- package/src/components/Filter/components/FilterLabel/filterLabel.tsx +2 -2
- package/src/components/Filter/components/SearchAllFiltersSearch/components/SearchCloseButton/searchCloseButton.tsx +2 -2
- package/src/components/Index/components/EntitiesView/components/ChartView/chartView.styles.ts +14 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/chartView.tsx +38 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/constants.ts +13 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.ts +104 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.ts +229 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.styles.ts +30 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/chart.tsx +16 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/constants.ts +1 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/args.ts +74 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories.tsx +29 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/types.ts +9 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/constants.ts +1 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/types.ts +8 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/hooks/UseChartView/useChartView.ts +29 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/stories/args.ts +99 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/stories/chartView.stories.tsx +25 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/types.ts +7 -0
- package/src/components/Index/components/EntitiesView/components/ChartView/utils.ts +26 -0
- package/src/components/Index/components/EntitiesView/components/EntityList/entityList.tsx +29 -0
- package/src/components/Index/components/EntitiesView/components/EntityList/types.ts +3 -0
- package/src/components/Index/components/EntitiesView/constants.ts +1 -0
- package/src/components/Index/components/EntitiesView/entitiesView.styles.ts +21 -0
- package/src/components/Index/components/EntitiesView/entitiesView.tsx +30 -0
- package/src/components/Index/components/EntitiesView/hooks/UseEntitiesView/hook.ts +15 -0
- package/src/components/Index/components/EntitiesView/hooks/UseEntitiesView/types.ts +16 -0
- package/src/components/Index/components/EntitiesView/stories/entitiesView.stories.tsx +76 -0
- package/src/components/Index/components/EntitiesView/types.ts +9 -0
- package/src/components/Index/index.stories.tsx +3 -2
- package/src/components/Index/index.tsx +15 -15
- package/src/components/Index/types.ts +13 -0
- package/src/components/Layout/components/BackPage/components/BackPageHero/backPageHero.tsx +19 -14
- package/src/components/Layout/components/BackPage/components/BackPageHero/stories/backPageHero.stories.tsx +24 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.tsx +3 -3
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Toolbar/toolbar.tsx +2 -2
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.tsx +2 -2
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.ts +8 -3
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.tsx +5 -2
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.tsx +2 -2
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.tsx +2 -2
- package/src/components/Layout/components/Sidebar/components/SidebarButton/sidebarButton.tsx +2 -2
- package/src/components/Loading/loading.stories.tsx +2 -2
- package/src/components/Loading/loading.tsx +11 -3
- package/src/components/Login/components/Section/components/Consent/consent.styles.ts +2 -2
- package/src/components/Login/components/Section/components/Consent/consent.tsx +4 -4
- package/src/components/Login/components/Section/components/Consent/types.ts +2 -2
- package/src/components/NoResults/noResults.styles.ts +4 -2
- package/src/components/NoResults/noResults.tsx +16 -22
- package/src/components/NoResults/types.ts +13 -0
- package/src/components/Plot/components/BarX/barX.tsx +20 -0
- package/src/components/Plot/components/BarX/types.ts +6 -0
- package/src/components/Stepper/components/Step/components/StepContent/stepContent.styles.ts +18 -0
- package/src/components/Stepper/components/Step/components/StepContent/stepContent.tsx +16 -0
- package/src/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.styles.ts +19 -0
- package/src/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.tsx +20 -0
- package/src/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/contants.ts +6 -0
- package/src/components/Stepper/components/Step/components/StepIcon/constants.ts +1 -0
- package/src/components/Stepper/components/Step/components/StepIcon/stepIcon.styles.ts +32 -0
- package/src/components/Stepper/components/Step/components/StepIcon/stepIcon.tsx +21 -0
- package/src/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories.tsx +52 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/constants.ts +14 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/icon.tsx +13 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/contants.ts +6 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/icon.stories.tsx +30 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/types.ts +8 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/constants.ts +8 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/label.styles.ts +8 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/label.tsx +10 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/stories/label.stories.tsx +31 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Optional/constants.ts +7 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Optional/optional.tsx +9 -0
- package/src/components/Stepper/components/Step/components/StepLabel/constants.ts +10 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stepLabel.styles.ts +13 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stepLabel.tsx +10 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stories/contants.ts +19 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stories/stepLabel.stories.tsx +48 -0
- package/src/components/Stepper/components/Step/constants.ts +6 -0
- package/src/components/Stepper/components/Step/step.styles.ts +33 -0
- package/src/components/Stepper/components/Step/step.tsx +12 -0
- package/src/components/Stepper/components/Step/stories/contants.ts +18 -0
- package/src/components/Stepper/components/Step/stories/step.stories.tsx +87 -0
- package/src/components/Support/components/SupportRequest/components/Dialog/dialog.tsx +2 -2
- package/src/components/Table/components/Pagination/pagination.tsx +3 -4
- package/src/components/Table/components/TableHead/tableHead.tsx +2 -2
- package/src/components/Table/table.tsx +42 -38
- package/src/components/TableCreator/tableCreator.tsx +8 -18
- package/src/components/common/AnchorLink/anchorLink.tsx +2 -2
- package/src/components/common/Breadcrumbs/breadcrumbs.tsx +2 -2
- package/src/components/common/Breadcrumbs/typeGuard.ts +24 -0
- package/src/components/common/Button/components/DropdownButton/dropdownButton.tsx +2 -2
- package/src/components/common/Button/components/NavigationButton/navigationButton.tsx +2 -2
- package/src/components/common/CopyToClipboard/copyToClipboard.tsx +2 -2
- package/src/components/common/Dialog/components/DialogTitle/dialogTitle.tsx +2 -2
- package/src/components/common/Drawer/components/DrawerTitle/drawerTitle.tsx +2 -2
- package/src/components/common/Form/components/Select/components/DropDownIcon/dropDownIcon.tsx +5 -6
- package/src/components/common/Form/components/UploadFile/uploadFile.tsx +2 -2
- package/src/components/common/KeyValuePairs/components/KeyElType/keyElType.tsx +14 -9
- package/src/components/common/KeyValuePairs/components/ValueElType/valueElType.tsx +8 -9
- package/src/components/common/LoginDialog/loginDialog.styles.ts +1 -1
- package/src/components/common/Paper/paper.tsx +9 -3
- package/src/components/common/Section/components/CollapsableSection/collapsableSection.tsx +2 -3
- package/src/components/common/ToggleButtonGroup/hooks/UseToggleButtonGroup/hook.ts +17 -0
- package/src/components/types.ts +4 -0
- package/src/config/entities.ts +2 -0
- package/src/hooks/useCategoryFilter.ts +1 -0
- package/src/hooks/useResizeObserver.ts +5 -2
- package/src/storybook/controls/constants.ts +12 -0
- package/src/storybook/controls/types.ts +4 -0
- package/src/storybook/controls/utils.ts +18 -0
- package/src/storybook/decorators.tsx +17 -0
- package/src/storybook/loremIpsum.ts +5 -0
- package/src/storybook/parameters.ts +14 -0
- package/src/styles/common/mui/palette.ts +47 -0
- package/src/styles/common/mui/stepper.ts +14 -0
- package/src/styles/common/mui/svgIcon.ts +35 -0
- package/src/styles/common/mui/typography.ts +1 -0
- package/src/tests/mui/constants.ts +4 -0
- package/src/theme/common/typography.ts +12 -1
- package/src/theme/theme.ts +2 -0
- package/src/utils/tests.ts +20 -0
- package/src/views/ExploreView/exploreView.tsx +8 -42
- package/tests/chart.test.tsx +170 -0
- package/tests/chartView.test.tsx +36 -0
- package/tests/entitiesView.test.tsx +36 -0
- package/tests/setup.ts +19 -0
- package/tests/stepIcon.test.tsx +42 -0
- package/types/data-explorer-ui.d.ts +39 -80
- package/src/components/Index/components/Cell/cell.tsx +0 -22
- package/src/components/Index/components/NTag/components/Tooltip/tooltip.styles.ts +0 -11
- package/src/components/Index/components/NTag/components/Tooltip/tooltip.tsx +0 -90
- package/src/components/Index/components/NTag/nTag.tsx +0 -25
- package/src/components/Index/components/NTagCell/nTagCell.stories.tsx +0 -22
- package/src/components/Index/components/NTagCell/nTagCell.tsx +0 -74
- package/src/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.tsx +0 -16
- package/src/components/TableCreator/tableCreator.styles.ts +0 -5
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypographyProps } from "@mui/material";
|
|
2
2
|
/**
|
|
3
3
|
* Basic KeyValuePairs "key" wrapper component.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export declare const KeyElType: ({ children, ...props }: KeyElTypeProps) => JSX.Element;
|
|
5
|
+
export declare const KeyElType: ({ children, color, component, variant, ...props }: TypographyProps) => JSX.Element;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Typography } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { TYPOGRAPHY_PROPS } from "../../../../../styles/common/mui/typography";
|
|
4
|
+
/**
|
|
5
|
+
* Basic KeyValuePairs "key" wrapper component.
|
|
6
|
+
*/
|
|
7
|
+
export const KeyElType = ({ children, color = TYPOGRAPHY_PROPS.COLOR.INK_LIGHT, component = "div", variant = TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_400_2_LINES, ...props /* MuiTypographyProps */ }) => {
|
|
8
|
+
return (React.createElement(Typography, { color: color, component: component, variant: variant, ...props }, children));
|
|
5
9
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypographyProps } from "@mui/material";
|
|
2
2
|
/**
|
|
3
3
|
* Basic KeyValuePairs "value" wrapper component.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export declare const ValueElType: ({ children, ...props }: ValueElTypeProps) => JSX.Element;
|
|
5
|
+
export declare const ValueElType: ({ children, component, variant, ...props }: TypographyProps) => JSX.Element;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Typography } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { TYPOGRAPHY_PROPS } from "../../../../../styles/common/mui/typography";
|
|
4
|
+
/**
|
|
5
|
+
* Basic KeyValuePairs "value" wrapper component.
|
|
6
|
+
*/
|
|
7
|
+
export const ValueElType = ({ children, component = "div", variant = TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_400_2_LINES, ...props /* MuiTypographyProps */ }) => {
|
|
8
|
+
return (React.createElement(Typography, { component: component, variant: variant, ...props }, children));
|
|
5
9
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PaperProps as MPaperProps } from "@mui/material";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
|
+
import { TestIdProps } from "../../types";
|
|
3
4
|
/**
|
|
4
5
|
* An extension of the basic Mui Paper component with custom variants e.g. "panel".
|
|
5
6
|
*/
|
|
@@ -16,7 +17,7 @@ export declare enum PAPER_PANEL_STYLE {
|
|
|
16
17
|
NONE = "NONE",
|
|
17
18
|
ROUNDED = "ROUNDED"
|
|
18
19
|
}
|
|
19
|
-
export interface PaperProps {
|
|
20
|
+
export interface PaperProps extends TestIdProps {
|
|
20
21
|
children: ReactNode | ReactNode[];
|
|
21
22
|
className?: string;
|
|
22
23
|
variant?: MPaperProps["variant"];
|
|
@@ -10,6 +10,6 @@ export var PAPER_PANEL_STYLE;
|
|
|
10
10
|
PAPER_PANEL_STYLE["NONE"] = "NONE";
|
|
11
11
|
PAPER_PANEL_STYLE["ROUNDED"] = "ROUNDED";
|
|
12
12
|
})(PAPER_PANEL_STYLE || (PAPER_PANEL_STYLE = {}));
|
|
13
|
-
export const Paper = forwardRef(function Paper({ children, className, variant = "panel" }, ref) {
|
|
14
|
-
return (React.createElement(MPaper, { className: className, ref: ref, variant: variant }, children));
|
|
13
|
+
export const Paper = forwardRef(function Paper({ children, className, testId, variant = "panel" }, ref) {
|
|
14
|
+
return (React.createElement(MPaper, { className: className, "data-testid": testId, ref: ref, variant: variant }, children));
|
|
15
15
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import RemoveRoundedIcon from "@mui/icons-material/RemoveRounded";
|
|
1
|
+
import { AddRounded, RemoveRounded } from "@mui/icons-material";
|
|
3
2
|
import { Collapse } from "@mui/material";
|
|
4
3
|
import React, { useEffect, useState } from "react";
|
|
5
4
|
import { BREAKPOINT_FN_NAME, useBreakpointHelper, } from "../../../../../hooks/useBreakpointHelper";
|
|
@@ -11,7 +10,7 @@ export const CollapsableSection = ({ children, collapsable = false, title, }) =>
|
|
|
11
10
|
const [expanded, setExpanded] = useState(false);
|
|
12
11
|
const [transitionDuration, setTransitionDuration] = useState(0);
|
|
13
12
|
const disabled = !mobile || !collapsable;
|
|
14
|
-
const ExpandIcon = expanded ?
|
|
13
|
+
const ExpandIcon = expanded ? RemoveRounded : AddRounded;
|
|
15
14
|
const SectionContent = (React.createElement(SectionText, { component: "div", variant: "text-body-400-2lines" }, children));
|
|
16
15
|
const onToggleExpanded = () => {
|
|
17
16
|
setExpanded((expanded) => !expanded);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
export const useToggleButtonGroup = (initialValue = null) => {
|
|
3
|
+
const [value, setValue] = useState(initialValue);
|
|
4
|
+
const onChange = useCallback((_, value) => {
|
|
5
|
+
if (!value)
|
|
6
|
+
return;
|
|
7
|
+
setValue(value);
|
|
8
|
+
}, []);
|
|
9
|
+
return { onChange, value };
|
|
10
|
+
};
|
package/lib/config/entities.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export interface CategoryGroup {
|
|
|
71
71
|
*/
|
|
72
72
|
export interface CategoryConfig {
|
|
73
73
|
annotation?: DataDictionaryAnnotation;
|
|
74
|
+
enableChartView?: boolean;
|
|
74
75
|
key: string;
|
|
75
76
|
label: string;
|
|
76
77
|
mapSelectCategoryValue?: (selectCategoryValue: SelectCategoryValueView) => SelectCategoryValueView;
|
|
@@ -300,6 +301,7 @@ export interface SiteConfig {
|
|
|
300
301
|
contentThemeOptionsFn?: ThemeOptionsFn;
|
|
301
302
|
dataDictionary?: DataDictionary;
|
|
302
303
|
dataSource: DataSourceConfig;
|
|
304
|
+
enableEntitiesView?: boolean;
|
|
303
305
|
entities: EntityConfig[];
|
|
304
306
|
explorerTitle: HeroTitle;
|
|
305
307
|
export?: ExportConfig;
|
|
@@ -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,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 {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { AUTHENTICATION_STATUS, } from "./common/entities";
|
|
2
|
+
import { useAuthentication } from "./useAuthentication";
|
|
3
|
+
export var ONBOARDING_STEP;
|
|
4
|
+
(function (ONBOARDING_STEP) {
|
|
5
|
+
ONBOARDING_STEP[ONBOARDING_STEP["NIH_ACCOUNT"] = 3] = "NIH_ACCOUNT";
|
|
6
|
+
ONBOARDING_STEP[ONBOARDING_STEP["TERRA_ACCOUNT"] = 1] = "TERRA_ACCOUNT";
|
|
7
|
+
ONBOARDING_STEP[ONBOARDING_STEP["TERRA_TOS"] = 2] = "TERRA_TOS";
|
|
8
|
+
})(ONBOARDING_STEP || (ONBOARDING_STEP = {}));
|
|
9
|
+
/**
|
|
10
|
+
* Handles authentication form onboarding.
|
|
11
|
+
* @returns onboarding steps and corresponding status.
|
|
12
|
+
*/
|
|
13
|
+
export const useAuthenticationForm = () => {
|
|
14
|
+
const authentication = useAuthentication();
|
|
15
|
+
const isReady = authentication.authenticationStatus === AUTHENTICATION_STATUS.COMPLETED;
|
|
16
|
+
const loginStatuses = concatLoginStatuses(authentication).filter(filterLoginStatus);
|
|
17
|
+
const onboardingStatusByStep = getOnboardingStatusByStep(loginStatuses);
|
|
18
|
+
const isComplete = isAuthenticationComplete(onboardingStatusByStep);
|
|
19
|
+
return {
|
|
20
|
+
isComplete,
|
|
21
|
+
isReady,
|
|
22
|
+
onboardingStatusByStep,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Returns true if all authentication steps are complete.
|
|
27
|
+
* @param onboardingStatusByStep - Onboarding status by step.
|
|
28
|
+
* @returns true if all authentication steps are complete.
|
|
29
|
+
*/
|
|
30
|
+
function isAuthenticationComplete(onboardingStatusByStep) {
|
|
31
|
+
for (const { completed } of onboardingStatusByStep.values()) {
|
|
32
|
+
if (!completed) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns all login statuses, ordered by onboarding step.
|
|
40
|
+
* @param authentication - Authentication.
|
|
41
|
+
* @returns login statuses.
|
|
42
|
+
*/
|
|
43
|
+
function concatLoginStatuses(authentication) {
|
|
44
|
+
const { terraNIHProfileLoginStatus, terraProfileLoginStatus, terraTOSLoginStatus, } = authentication;
|
|
45
|
+
return [
|
|
46
|
+
terraProfileLoginStatus,
|
|
47
|
+
terraTOSLoginStatus,
|
|
48
|
+
terraNIHProfileLoginStatus,
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns true if login is supported.
|
|
53
|
+
* @param loginStatus - Login status.
|
|
54
|
+
* @returns true if login is supported.
|
|
55
|
+
*/
|
|
56
|
+
function filterLoginStatus(loginStatus) {
|
|
57
|
+
return loginStatus.isSupported;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns a map of onboarding steps and their status.
|
|
61
|
+
* @param loginStatuses - Login statuses.
|
|
62
|
+
* @returns map of onboarding steps and their status.
|
|
63
|
+
*/
|
|
64
|
+
function getOnboardingStatusByStep(loginStatuses) {
|
|
65
|
+
const onboardingStatusByStep = new Map();
|
|
66
|
+
for (let i = 0; i < loginStatuses.length; i++) {
|
|
67
|
+
const { isSuccess } = loginStatuses[i];
|
|
68
|
+
onboardingStatusByStep.set(i + 1, {
|
|
69
|
+
active: isStepActive(isSuccess, onboardingStatusByStep),
|
|
70
|
+
completed: isSuccess,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return onboardingStatusByStep;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns true if step is active.
|
|
77
|
+
* @param isSuccess - Response is successful.
|
|
78
|
+
* @param onboardingStatusByStep - Onboarding status by step.
|
|
79
|
+
* @returns true if step is active.
|
|
80
|
+
*/
|
|
81
|
+
function isStepActive(isSuccess, onboardingStatusByStep) {
|
|
82
|
+
for (const { active } of onboardingStatusByStep.values()) {
|
|
83
|
+
if (active) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return !isSuccess;
|
|
88
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface UseAuthenticationNIHExpiry {
|
|
2
|
+
isReady: boolean;
|
|
3
|
+
linkExpired?: boolean;
|
|
4
|
+
linkExpireTime?: number;
|
|
5
|
+
linkWillExpire?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Handles authentication NIH expiry.
|
|
9
|
+
* @returns NIH expiry status.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useAuthenticationNIHExpiry: () => UseAuthenticationNIHExpiry;
|
|
12
|
+
/**
|
|
13
|
+
* Calculates the remaining time in seconds until the given expiration time.
|
|
14
|
+
* @param expireTime - Expire time in seconds.
|
|
15
|
+
* @returns remaining time in seconds.
|
|
16
|
+
*/
|
|
17
|
+
export declare function expireTimeInSeconds(expireTime: number): number;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { REQUEST_STATUS } from "./common/entities";
|
|
2
|
+
import { useAuthentication } from "./useAuthentication";
|
|
3
|
+
const WARNING_WINDOW_SECONDS = 60 * 60 * 24 * 5; // 5 days.
|
|
4
|
+
/**
|
|
5
|
+
* Handles authentication NIH expiry.
|
|
6
|
+
* @returns NIH expiry status.
|
|
7
|
+
*/
|
|
8
|
+
export const useAuthenticationNIHExpiry = () => {
|
|
9
|
+
const authentication = useAuthentication();
|
|
10
|
+
const { terraNIHProfileLoginStatus } = authentication;
|
|
11
|
+
const { requestStatus, response } = terraNIHProfileLoginStatus;
|
|
12
|
+
const { linkExpireTime } = response || {};
|
|
13
|
+
const isReady = requestStatus === REQUEST_STATUS.COMPLETED;
|
|
14
|
+
const linkExpired = hasLinkedNIHAccountExpired(linkExpireTime);
|
|
15
|
+
const linkWillExpire = isLinkedNIHAccountWillExpire(linkExpireTime);
|
|
16
|
+
return {
|
|
17
|
+
isReady,
|
|
18
|
+
linkExpireTime,
|
|
19
|
+
linkExpired,
|
|
20
|
+
linkWillExpire,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Calculates the remaining time in seconds until the given expiration time.
|
|
25
|
+
* @param expireTime - Expire time in seconds.
|
|
26
|
+
* @returns remaining time in seconds.
|
|
27
|
+
*/
|
|
28
|
+
export function expireTimeInSeconds(expireTime) {
|
|
29
|
+
return expireTime - Date.now() / 1000;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns true if the linked NIH account has expired.
|
|
33
|
+
* @param expireTime - Expire time in seconds.
|
|
34
|
+
* @returns true if the linked NIH account has expired.
|
|
35
|
+
*/
|
|
36
|
+
function hasLinkedNIHAccountExpired(expireTime) {
|
|
37
|
+
if (!expireTime)
|
|
38
|
+
return;
|
|
39
|
+
return expireTimeInSeconds(expireTime) < 0;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns true if the linked NIH account will expire in less than a week.
|
|
43
|
+
* @param expireTime - Expire time in seconds.
|
|
44
|
+
* @returns true if the linked NIH account will expire in less than a week.
|
|
45
|
+
*/
|
|
46
|
+
function isLinkedNIHAccountWillExpire(expireTime) {
|
|
47
|
+
if (!expireTime)
|
|
48
|
+
return;
|
|
49
|
+
return expireTimeInSeconds(expireTime) < WARNING_WINDOW_SECONDS;
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AUTHENTICATION_STATUS, LoginResponse, LoginStatus } from "./common/entities";
|
|
2
|
+
import { GoogleResponse } from "./useFetchGoogleProfile";
|
|
3
|
+
import { TerraNIHResponse } from "./useFetchTerraNIHProfile";
|
|
4
|
+
import { TerraResponse } from "./useFetchTerraProfile";
|
|
5
|
+
import { TerraTermsOfServiceResponse } from "./useFetchTerraTermsOfService";
|
|
6
|
+
/**
|
|
7
|
+
* Handles the status of the authentication process.
|
|
8
|
+
* @param userProfileLoginStatus - User profile login status.
|
|
9
|
+
* @param terraProfileLoginStatus - Terra profile login status.
|
|
10
|
+
* @param terraTOSLoginStatus - Terra terms of service login status.
|
|
11
|
+
* @param terraNIHProfileLoginStatus - Terra NIH profile login status.
|
|
12
|
+
* @returns authentication status.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useAuthenticationStatus: (userProfileLoginStatus: LoginStatus<GoogleResponse>, terraProfileLoginStatus: LoginStatus<TerraResponse>, terraTOSLoginStatus: LoginStatus<TerraTermsOfServiceResponse>, terraNIHProfileLoginStatus: LoginStatus<TerraNIHResponse>) => AUTHENTICATION_STATUS;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the authentication status ("INCOMPLETE" or "COMPLETE").
|
|
17
|
+
* @param loginStatuses - Login statuses.
|
|
18
|
+
* @returns authentication status.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getAuthenticationStatus(loginStatuses: LoginStatus<LoginResponse>[]): AUTHENTICATION_STATUS;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AUTHENTICATION_STATUS, REQUEST_STATUS, } from "./common/entities";
|
|
2
|
+
/**
|
|
3
|
+
* Handles the status of the authentication process.
|
|
4
|
+
* @param userProfileLoginStatus - User profile login status.
|
|
5
|
+
* @param terraProfileLoginStatus - Terra profile login status.
|
|
6
|
+
* @param terraTOSLoginStatus - Terra terms of service login status.
|
|
7
|
+
* @param terraNIHProfileLoginStatus - Terra NIH profile login status.
|
|
8
|
+
* @returns authentication status.
|
|
9
|
+
*/
|
|
10
|
+
export const useAuthenticationStatus = (userProfileLoginStatus, terraProfileLoginStatus, terraTOSLoginStatus, terraNIHProfileLoginStatus) => {
|
|
11
|
+
return getAuthenticationStatus([
|
|
12
|
+
terraNIHProfileLoginStatus,
|
|
13
|
+
terraProfileLoginStatus,
|
|
14
|
+
terraTOSLoginStatus,
|
|
15
|
+
userProfileLoginStatus,
|
|
16
|
+
]);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Returns the authentication status ("INCOMPLETE" or "COMPLETE").
|
|
20
|
+
* @param loginStatuses - Login statuses.
|
|
21
|
+
* @returns authentication status.
|
|
22
|
+
*/
|
|
23
|
+
export function getAuthenticationStatus(loginStatuses) {
|
|
24
|
+
for (const loginStatus of loginStatuses) {
|
|
25
|
+
if (!loginStatus.isSupported)
|
|
26
|
+
continue;
|
|
27
|
+
if (loginStatus.requestStatus === REQUEST_STATUS.NOT_STARTED) {
|
|
28
|
+
return AUTHENTICATION_STATUS.INCOMPLETE;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return AUTHENTICATION_STATUS.COMPLETED;
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LoginStatus } from "./common/entities";
|
|
2
|
+
export type UserProfile = GoogleResponse;
|
|
3
|
+
export interface GoogleResponse {
|
|
4
|
+
email: string;
|
|
5
|
+
email_verified: boolean;
|
|
6
|
+
family_name: string;
|
|
7
|
+
given_name: string;
|
|
8
|
+
hd: string;
|
|
9
|
+
locale: string;
|
|
10
|
+
name: string;
|
|
11
|
+
picture: string;
|
|
12
|
+
sub: string;
|
|
13
|
+
}
|
|
14
|
+
type Status = LoginStatus<GoogleResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns user profile login status from configured endpoint.
|
|
17
|
+
* @param token - Token.
|
|
18
|
+
* @returns google profile login status.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useFetchGoogleProfile: (token?: string) => Status;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { useAuthenticationConfig } from "../useAuthenticationConfig";
|
|
3
|
+
import { LOGIN_STATUS_FAILED, LOGIN_STATUS_NOT_STARTED, } from "./common/constants";
|
|
4
|
+
import { REQUEST_STATUS } from "./common/entities";
|
|
5
|
+
import { getAuthenticationRequestOptions } from "./common/utils";
|
|
6
|
+
/**
|
|
7
|
+
* Returns user profile login status from configured endpoint.
|
|
8
|
+
* @param token - Token.
|
|
9
|
+
* @returns google profile login status.
|
|
10
|
+
*/
|
|
11
|
+
export const useFetchGoogleProfile = (token) => {
|
|
12
|
+
const authenticationConfig = useAuthenticationConfig();
|
|
13
|
+
const { googleGISAuthConfig: { googleProfileEndpoint: endpoint } = {} } = authenticationConfig;
|
|
14
|
+
const [loginStatus, setLoginStatus] = useState(LOGIN_STATUS_NOT_STARTED);
|
|
15
|
+
// Fetch google user profile.
|
|
16
|
+
const fetchEndpointData = useCallback((endpoint, accessToken) => {
|
|
17
|
+
fetch(endpoint, getAuthenticationRequestOptions(accessToken))
|
|
18
|
+
.then((response) => response.json())
|
|
19
|
+
.then((profile) => {
|
|
20
|
+
setLoginStatus((prevStatus) => ({
|
|
21
|
+
...prevStatus,
|
|
22
|
+
isSuccess: true,
|
|
23
|
+
requestStatus: REQUEST_STATUS.COMPLETED,
|
|
24
|
+
response: profile,
|
|
25
|
+
}));
|
|
26
|
+
})
|
|
27
|
+
.catch((err) => {
|
|
28
|
+
console.log(err); // TODO handle error.
|
|
29
|
+
setLoginStatus(LOGIN_STATUS_FAILED);
|
|
30
|
+
});
|
|
31
|
+
}, []);
|
|
32
|
+
// Fetches user profile.
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!token)
|
|
35
|
+
return;
|
|
36
|
+
if (!endpoint)
|
|
37
|
+
return;
|
|
38
|
+
fetchEndpointData(endpoint, token);
|
|
39
|
+
}, [endpoint, fetchEndpointData, token]);
|
|
40
|
+
return loginStatus;
|
|
41
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LoginStatus } from "./common/entities";
|
|
2
|
+
interface DatasetPermission {
|
|
3
|
+
authorized: boolean;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
type Status = LoginStatus<TerraNIHResponse>;
|
|
7
|
+
export interface TerraNIHResponse {
|
|
8
|
+
datasetPermissions: DatasetPermission[];
|
|
9
|
+
linkedNihUsername: string;
|
|
10
|
+
linkExpireTime: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Returns Terra NIH login status from configured endpoint.
|
|
14
|
+
* @param token - Token.
|
|
15
|
+
* @returns Terra NIH login status.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useFetchTerraNIHProfile: (token?: string) => Status;
|
|
18
|
+
export {};
|