Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PORTALS-3347 - Remove barrel files #1460

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions apps/SageAccountWeb/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useEffect } from 'react'
import { Route, Routes } from 'react-router-dom'
import './App.scss'
import CookiesNotification from 'synapse-react-client/components/CookiesNotification/CookiesNotification'
import { processRedirectURLInOneSage } from 'synapse-react-client/utils/AppUtils/AppUtils'
import {
CookiesNotification,
processRedirectURLInOneSage,
SynapseContextConsumer,
SynapseContextType,
useSynapseContext,
} from 'synapse-react-client'
import './App.scss'
} from 'synapse-react-client/utils/context/SynapseContext'
import { useAppContext } from './AppContext'
import { AccountCreatedPage } from './components/AccountCreatedPage'
import { AccountSettings } from './components/AccountSettings'
Expand Down
13 changes: 5 additions & 8 deletions apps/SageAccountWeb/src/AppInitializer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { SignedTokenInterface } from '@sage-bionetworks/synapse-types'
import { ReactNode, useEffect, useState } from 'react'

import {
SynapseConstants,
SynapseUtilityFunctions,
useFramebuster,
} from 'synapse-react-client'
import { useFramebuster } from 'synapse-react-client/utils/AppUtils/AppUtils'
import { hex2ascii } from 'synapse-react-client/utils/functions/StringUtils'
import * as SynapseConstants from 'synapse-react-client/utils/SynapseConstants'
import { AppContextProvider } from './AppContext'
import { useSourceApp } from './components/useSourceApp'
import useMaybeRedirectToSignTermsOfService from './hooks/useMaybeRedirectToSignTermsOfService'
Expand Down Expand Up @@ -50,12 +47,12 @@ function AppInitializer(props: { children?: ReactNode }) {
if (searchParamSignedToken) {
localStorage.setItem('signedToken', searchParamSignedToken)
const searchParamToken = JSON.parse(
SynapseUtilityFunctions.hex2ascii(searchParamSignedToken),
hex2ascii(searchParamSignedToken),
) as SignedTokenInterface
setSignedToken(searchParamToken)
} else if (localStorageSignedToken) {
const localStorageParamToken = JSON.parse(
SynapseUtilityFunctions.hex2ascii(localStorageSignedToken),
hex2ascii(localStorageSignedToken),
) as SignedTokenInterface
setSignedToken(localStorageParamToken)
}
Expand Down
14 changes: 6 additions & 8 deletions apps/SageAccountWeb/src/AppWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { PropsWithChildren } from 'react'
import { RESET_2FA_ROUTE, RESET_2FA_SIGNED_TOKEN_PARAM } from './Constants'
import { StyledEngineProvider } from '@mui/material/styles'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import {
ApplicationSessionManager,
SynapseToastContainer,
} from 'synapse-react-client'
import { SourceAppProvider } from './components/useSourceApp'
import AppInitializer from './AppInitializer'
import { PropsWithChildren } from 'react'
import { useNavigate } from 'react-router-dom'
import { SynapseToastContainer } from 'synapse-react-client/components/ToastMessage/index'
import ApplicationSessionManager from 'synapse-react-client/utils/AppUtils/session/ApplicationSessionManager'
import AppInitializer from './AppInitializer'
import { SourceAppProvider } from './components/useSourceApp'
import { RESET_2FA_ROUTE, RESET_2FA_SIGNED_TOKEN_PARAM } from './Constants'

const queryClient = new QueryClient({
defaultOptions: {
Expand Down
22 changes: 11 additions & 11 deletions apps/SageAccountWeb/src/LoginPage.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { Box, Typography } from '@mui/material'
import { useNavigate } from 'react-router-dom'
import { useLastLoginInfoState } from 'synapse-react-client/components/Authentication/LastLoginInfo'
import { LoginMethod } from 'synapse-react-client/components/Authentication/LoginMethod'
import StandaloneLoginForm from 'synapse-react-client/components/Authentication/StandaloneLoginForm'
import SystemUseNotification from 'synapse-react-client/components/SystemUseNotification/SystemUseNotification'
import {
LoginMethod,
StandaloneLoginForm,
SynapseConstants,
SystemUseNotification,
storeLastPlace,
restoreLastPlace,
useLastLoginInfoState,
useApplicationSessionContext,
} from 'synapse-react-client'
import { backButtonSx } from './components/BackButton.js'
import { SourceAppDescription, SourceAppLogo } from './components/SourceApp.js'
storeLastPlace,
} from 'synapse-react-client/utils/AppUtils/AppUtils'
import { useApplicationSessionContext } from 'synapse-react-client/utils/AppUtils/session/ApplicationSessionContext'
import * as SynapseConstants from 'synapse-react-client/utils/SynapseConstants'
import { backButtonSx } from './components/BackButton'
import { SourceAppDescription, SourceAppLogo } from './components/SourceApp'
import {
StyledInnerContainer,
StyledOuterContainer,
} from './components/StyledComponents.js'
} from './components/StyledComponents'
import { useSourceApp } from './components/useSourceApp'
import { RESET_2FA_ROUTE, RESET_2FA_SIGNED_TOKEN_PARAM } from './Constants'

Expand Down
14 changes: 4 additions & 10 deletions apps/SageAccountWeb/src/components/AccountCreatedPage.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import { processRedirectURLInOneSage } from 'synapse-react-client/utils/AppUtils/AppUtils'
import { useSourceAppConfigs } from 'synapse-react-client/utils/hooks/useSourceAppConfigs'
import { SourceAppLogo } from './SourceApp'
import { Button, Grid, Link, Typography } from '@mui/material'
import { AppContextConsumer } from '../AppContext'
import { Link as RouterLink } from 'react-router-dom'
import { LeftRightPanel } from './LeftRightPanel'
import useMembershipInvitationTokenHandler from '../hooks/useMembershipInvitationTokenHandler'
import { useSourceApp } from './useSourceApp'
import {
SynapseHookUtils,
processRedirectURLInOneSage,
} from 'synapse-react-client'
import { sourceAppConfigTableID } from '../resources'

export type AccountCreatedPageProps = {}

export const AccountCreatedPage = (props: AccountCreatedPageProps) => {
export function AccountCreatedPage() {
const membershipInvitation = useMembershipInvitationTokenHandler()
const sourceApp = useSourceApp()
const sourceAppConfigs = SynapseHookUtils.useSourceAppConfigs(
sourceAppConfigTableID,
)
const sourceAppConfigs = useSourceAppConfigs(sourceAppConfigTableID)
return (
<>
<AppContextConsumer>
Expand Down
33 changes: 15 additions & 18 deletions apps/SageAccountWeb/src/components/AccountSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,25 @@ import {
import { RefObject, useEffect, useRef, useState } from 'react'
import { Form } from 'react-bootstrap'
import { Link as RouterLink, useLocation, useNavigate } from 'react-router-dom'
import {
ChangePassword,
CookiePreferencesDialog,
displayToast,
IconSvg,
SynapseClient,
SynapseConstants,
SynapseHookUtils,
SynapseQueries,
TwoFactorAuthSettingsPanel,
useApplicationSessionContext,
useSynapseContext,
} from 'synapse-react-client'
import TwoFactorAuthSettingsPanel from 'synapse-react-client/components/Authentication/TwoFactorAuthSettingsPanel'
import ChangePassword from 'synapse-react-client/components/ChangePassword/index'
import { CookiePreferencesDialog } from 'synapse-react-client/components/CookiesNotification/index'
import IconSvg from 'synapse-react-client/components/IconSvg/IconSvg'
import { displayToast } from 'synapse-react-client/components/ToastMessage/index'
import { getUseUtcTimeFromCookie } from 'synapse-react-client/synapse-client/SynapseClient'
import { useGetFeatureFlag } from 'synapse-react-client/synapse-queries/featureflags/useGetFeatureFlag'
import { useApplicationSessionContext } from 'synapse-react-client/utils/AppUtils/session/ApplicationSessionContext'
import { useSynapseContext } from 'synapse-react-client/utils/context/SynapseContext'
import * as SynapseConstants from 'synapse-react-client/utils/SynapseConstants'
import UniversalCookies from 'universal-cookie'
import AccountSettingsTopBar from './AccountSettingsTopBar'
import { ConfigureEmail } from './ConfigureEmail'
import { ProfileAvatar } from './ProfileAvatar'
import { ORCiDButton } from './ProfileValidation/ORCiDButton'
import { UnbindORCiDDialog } from './ProfileValidation/UnbindORCiD'
import { StyledFormControl } from './StyledComponents'
import SynapseClient from 'synapse-react-client/synapse-client'
import { useCookiePreferences } from 'synapse-react-client/utils/hooks/useCookiePreferences'

function CompletionStatus({ isComplete }: { isComplete: boolean | undefined }) {
return (
Expand Down Expand Up @@ -92,19 +91,17 @@ export const AccountSettings = () => {
const webhooksRef = useRef<HTMLDivElement>(null)
const cookieManagementRef = useRef<HTMLDivElement>(null)
const signOutSectionRef = useRef<HTMLDivElement>(null)
const [cookiePreferences] = SynapseHookUtils.useCookiePreferences()
const [cookiePreferences] = useCookiePreferences()
const [isCookiePrefsDialogVisible, setIsCookiePrefsDialogVisible] =
useState(false)

const { clearSession } = useApplicationSessionContext()

const showWebhooks = SynapseQueries.useGetFeatureFlag(
FeatureFlagEnum.WEBHOOKS_UI,
)
const showWebhooks = useGetFeatureFlag(FeatureFlagEnum.WEBHOOKS_UI)

const cookies = new UniversalCookies()
const [isUTCTime, setUTCTime] = useState<string>(
SynapseClient.getUseUtcTimeFromCookie().toString(),
getUseUtcTimeFromCookie().toString(),
)
const [isUTCTimeStaged, setUTCTimeStaged] = useState<string>(isUTCTime)
const handleChangesFn = (val: string) => {
Expand Down
11 changes: 4 additions & 7 deletions apps/SageAccountWeb/src/components/AccountSettingsTopBar.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { BadgeOutlined } from '@mui/icons-material'
import { Box, SxProps, Typography } from '@mui/material'
import { useSourceApp } from './useSourceApp'
import { Box, Link, SxProps, Typography } from '@mui/material'
import SynapseClient from 'synapse-react-client/synapse-client'
import { useApplicationSessionContext } from 'synapse-react-client/utils/AppUtils/session/ApplicationSessionContext'
import { useAppContext } from '../AppContext'
import {
SynapseClient,
useApplicationSessionContext,
} from 'synapse-react-client'
import { Link } from '@mui/material'
import { useSourceApp } from './useSourceApp'

function AccountSettingsTopBar() {
const sourceApp = useSourceApp()
Expand Down
3 changes: 2 additions & 1 deletion apps/SageAccountWeb/src/components/CertificationQuiz.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Link as RouterLink } from 'react-router-dom'
import { MuiContainer, CertificationQuiz as Quiz } from 'synapse-react-client'
import Quiz from 'synapse-react-client/components/CertificationQuiz/CertificationQuiz'
import MuiContainer from 'synapse-react-client/components/MuiContainer'
import ReturnArrow from '../assets/ReturnArrow.svg?url'
import { Link, Paper } from '@mui/material'

Expand Down
4 changes: 2 additions & 2 deletions apps/SageAccountWeb/src/components/ChangePasswordPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ChangePassword from 'synapse-react-client/components/ChangePassword/ChangePassword'
import { LeftRightPanel } from './LeftRightPanel'
import { SourceAppLogo } from './SourceApp'
import { SetPasswordInstructions } from './ResetPassword'
import { ChangePassword } from 'synapse-react-client'
import { SourceAppLogo } from './SourceApp'

export const ChangePasswordPage = () => {
// previously, if the errorCode was PASSWORD_RESET_VIA_EMAIL_REQUIRED then this page would tell the user that their current password does not meet Synapse security requirements. But this is not necessarily true.
Expand Down
15 changes: 8 additions & 7 deletions apps/SageAccountWeb/src/components/ConfigureEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import {
Typography,
} from '@mui/material'
import { SyntheticEvent, useEffect, useState } from 'react'
import { displayToast } from 'synapse-react-client/components/ToastMessage/index'
import SynapseClient from 'synapse-react-client/synapse-client'
import {
displayToast,
SynapseClient,
SynapseQueries,
useSynapseContext,
} from 'synapse-react-client'
useGetCurrentUserProfile,
useGetNotificationEmail,
} from 'synapse-react-client/synapse-queries/user/useUserBundle'
import { useSynapseContext } from 'synapse-react-client/utils/context/SynapseContext'
import { getSearchParam, hexDecodeAndDeserialize } from '../URLUtils'

export type ConfigureEmailProps = {
Expand All @@ -28,9 +29,9 @@ export type ConfigureEmailProps = {
export const ConfigureEmail = (props: ConfigureEmailProps) => {
const { accessToken } = useSynapseContext()
const { data: currentProfile, refetch: refetchCurrentProfile } =
SynapseQueries.useGetCurrentUserProfile()
useGetCurrentUserProfile()
const { data: primaryEmail, refetch: refetchNotificationEmail } =
SynapseQueries.useGetNotificationEmail()
useGetNotificationEmail()
const [newEmail, setNewEmail] = useState('')
const sendEmailNotifications =
currentProfile?.notificationSettings?.sendEmailNotifications ?? true
Expand Down
20 changes: 9 additions & 11 deletions apps/SageAccountWeb/src/components/CurrentAffiliationPage.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import { useEffect, useState } from 'react'
import { SourceAppLogo } from './SourceApp'
import { TextField, Typography } from '@mui/material'
import { LeftRightPanel } from './LeftRightPanel'
import { StyledFormControl } from './StyledComponents'
import {
displayToast,
SynapseClient,
SynapseQueries,
useSynapseContext,
} from 'synapse-react-client'
import { useEffect, useState } from 'react'
import { Navigate } from 'react-router-dom'
import { displayToast } from 'synapse-react-client/components/ToastMessage/index'
import SynapseClient from 'synapse-react-client/synapse-client'
import { useGetCurrentUserProfile } from 'synapse-react-client/synapse-queries/user/useUserBundle'
import { useSynapseContext } from 'synapse-react-client/utils/context/SynapseContext'
import { LeftRightPanel } from './LeftRightPanel'
import { ContinueButton } from './ProfileValidation/ContinueButton'
import { SourceAppLogo } from './SourceApp'
import { StyledFormControl } from './StyledComponents'
import { useSourceApp } from './useSourceApp'

export const CurrentAffiliationPage = () => {
const sourceApp = useSourceApp()
const { accessToken } = useSynapseContext()
const { data: currentUserProfile } = SynapseQueries.useGetCurrentUserProfile()
const { data: currentUserProfile } = useGetCurrentUserProfile()
const [newAffiliation, setNewAffiliation] = useState(
currentUserProfile?.company,
)
Expand Down
2 changes: 1 addition & 1 deletion apps/SageAccountWeb/src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box, Typography } from '@mui/material'
import { memo } from 'react'
import { ExperimentalMode } from 'synapse-react-client'
import ExperimentalMode from 'synapse-react-client/components/ExperimentalMode/ExperimentalMode'

function Footer() {
return (
Expand Down
8 changes: 3 additions & 5 deletions apps/SageAccountWeb/src/components/JoinTeamPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { useEffect, useState } from 'react'
import { Box, Button, Typography, useTheme } from '@mui/material'
import { useAppContext } from '../AppContext'
import {
displayToast,
SynapseClient,
UserOrTeamBadge,
} from 'synapse-react-client'
import { Navigate } from 'react-router-dom'
import {
isJoinTeamSignedToken,
Expand All @@ -16,6 +11,9 @@ import {
} from '@sage-bionetworks/synapse-types'
import { CelebrationOutlined, Groups2Outlined } from '@mui/icons-material'
import { StyledOuterContainer } from './StyledComponents'
import SynapseClient from 'synapse-react-client/synapse-client'
import { displayToast } from 'synapse-react-client/components/ToastMessage/ToastMessage'
import UserOrTeamBadge from 'synapse-react-client/components/UserOrTeamBadge/UserOrTeamBadge'

export function JoinTeamPage() {
const context = useAppContext()
Expand Down
2 changes: 1 addition & 1 deletion apps/SageAccountWeb/src/components/LogoutPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useNavigate } from 'react-router-dom'
import { SynapseClient } from 'synapse-react-client'
import SynapseClient from 'synapse-react-client/synapse-client'

export default function LogoutPage() {
const navigate = useNavigate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SourceAppLogo } from './SourceApp'
import { StyledOuterContainer } from './StyledComponents'
import { Box, Paper, Typography } from '@mui/material'
import { BackButton } from './BackButton'
import { OAuthClientManagement } from 'synapse-react-client'
import { OAuthManagement as OAuthClientManagement } from 'synapse-react-client/components/OAuthClientManagement/OAuthManagement'
import { SourceAppProvider, SYNAPSE_SOURCE_APP_ID } from './useSourceApp'

export function OAuthClientManagementPageInternal() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SourceAppLogo } from './SourceApp'
import { StyledOuterContainer } from './StyledComponents'
import { Box, Paper, Typography } from '@mui/material'
import { AccessTokenPage } from 'synapse-react-client/components/AccessTokenPage/index'
import { BackButton } from './BackButton'
import { AccessTokenPage } from 'synapse-react-client'
import { SourceAppLogo } from './SourceApp'
import { StyledOuterContainer } from './StyledComponents'
import { SourceAppProvider, SYNAPSE_SOURCE_APP_ID } from './useSourceApp'

export function PersonalAccessTokensPageInternal() {
Expand Down
20 changes: 9 additions & 11 deletions apps/SageAccountWeb/src/components/ProfileAvatar.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import Slider from '@mui/material/Slider'
import { ChangeEvent, useEffect, useRef, useState } from 'react'
import { Box, IconButton, SxProps } from '@mui/material'
import {
ConfirmationDialog,
displayToast,
IconSvg,
SynapseClient,
useSynapseContext,
} from 'synapse-react-client'
import Cropper, { Area } from 'react-easy-crop'
import Person from '@mui/icons-material/Person'
import { Box, IconButton, SxProps } from '@mui/material'
import Slider from '@mui/material/Slider'
import {
FileUploadComplete,
UserProfile,
} from '@sage-bionetworks/synapse-types'
import { ChangeEvent, useEffect, useRef, useState } from 'react'
import Cropper, { Area } from 'react-easy-crop'
import { ConfirmationDialog } from 'synapse-react-client/components/ConfirmationDialog/ConfirmationDialog'
import IconSvg from 'synapse-react-client/components/IconSvg/IconSvg'
import { displayToast } from 'synapse-react-client/components/ToastMessage/ToastMessage'
import SynapseClient from 'synapse-react-client/synapse-client'
import { useSynapseContext } from 'synapse-react-client/utils/context/SynapseContext'
import { getCroppedImg } from './CropImage'

export type ProfileAvatarProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import CloudUploadOutlinedIcon from '@mui/icons-material/CloudUploadOutlined'
import { Typography } from '@mui/material'
import { useEffect, useState } from 'react'
import { FileUpload } from 'synapse-react-client'
import { displayToast } from 'synapse-react-client'
import {
VerificationSubmission,
UploadCallbackResp,
FileUploadComplete,
UploadCallbackResp,
VerificationSubmission,
} from '@sage-bionetworks/synapse-types'
import { useEffect, useState } from 'react'
import FileUpload from 'synapse-react-client/components/FileUpload/FileUpload'
import { displayToast } from 'synapse-react-client/components/ToastMessage/index'
import { ContinueButton } from './ContinueButton'
import { ReturnToAppButton } from './ReturnToAppButton'

Expand Down
Loading
Loading