44 * See License.AGPL.txt in the project root for license information.
55 */
66
7- import { AuthProviderInfo } from "@gitpod/gitpod-protocol" ;
87import * as GitpodCookie from "@gitpod/gitpod-protocol/lib/util/gitpod-cookie" ;
98import { useContext , useEffect , useState , useMemo , useCallback , FC } from "react" ;
109import { UserContext } from "./user-context" ;
@@ -18,9 +17,10 @@ import { getURLHash } from "./utils";
1817import ErrorMessage from "./components/ErrorMessage" ;
1918import { Heading1 , Heading2 , Subheading } from "./components/typography/headings" ;
2019import { SSOLoginForm } from "./login/SSOLoginForm" ;
21- import { useAuthProviders } from "./data/auth-providers/auth-provider-query" ;
20+ import { useAuthProviderDescriptions } from "./data/auth-providers/auth-provider-query" ;
2221import { SetupPending } from "./login/SetupPending" ;
2322import { useNeedsSetup } from "./dedicated-setup/use-needs-setup" ;
23+ import { AuthProviderDescription } from "@gitpod/public-api/lib/gitpod/v1/authprovider_pb" ;
2424
2525export function markLoggedIn ( ) {
2626 document . cookie = GitpodCookie . generateCookie ( window . location . hostname ) ;
@@ -38,7 +38,7 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {
3838
3939 const urlHash = useMemo ( ( ) => getURLHash ( ) , [ ] ) ;
4040
41- const authProviders = useAuthProviders ( ) ;
41+ const authProviderDescriptions = useAuthProviderDescriptions ( ) ;
4242 const [ errorMessage , setErrorMessage ] = useState < string | undefined > ( undefined ) ;
4343 const [ hostFromContext , setHostFromContext ] = useState < string | undefined > ( ) ;
4444 const [ repoPathname , setRepoPathname ] = useState < string | undefined > ( ) ;
@@ -58,9 +58,9 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {
5858 }
5959 } , [ urlHash ] ) ;
6060
61- let providerFromContext : AuthProviderInfo | undefined ;
62- if ( hostFromContext && authProviders . data ) {
63- providerFromContext = authProviders . data . find ( ( provider ) => provider . host === hostFromContext ) ;
61+ let providerFromContext : AuthProviderDescription | undefined ;
62+ if ( hostFromContext && authProviderDescriptions . data ) {
63+ providerFromContext = authProviderDescriptions . data . find ( ( provider ) => provider . host === hostFromContext ) ;
6464 }
6565
6666 const updateUser = useCallback ( async ( ) => {
@@ -158,19 +158,19 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {
158158 className = "btn-login flex-none w-56 h-10 p-0 inline-flex rounded-xl"
159159 onClick = { ( ) => openLogin ( providerFromContext ! . host ) }
160160 >
161- { iconForAuthProvider ( providerFromContext . authProviderType ) }
161+ { iconForAuthProvider ( providerFromContext . type ) }
162162 < span className = "pt-2 pb-2 mr-3 text-sm my-auto font-medium truncate overflow-ellipsis" >
163163 Continue with { simplifyProviderName ( providerFromContext . host ) }
164164 </ span >
165165 </ button >
166166 ) : (
167- authProviders . data ?. map ( ( ap ) => (
167+ authProviderDescriptions . data ?. map ( ( ap ) => (
168168 < button
169169 key = { "button" + ap . host }
170170 className = "btn-login flex-none w-56 h-10 p-0 inline-flex rounded-xl"
171171 onClick = { ( ) => openLogin ( ap . host ) }
172172 >
173- { iconForAuthProvider ( ap . authProviderType ) }
173+ { iconForAuthProvider ( ap . type ) }
174174 < span className = "pt-2 pb-2 mr-3 text-sm my-auto font-medium truncate overflow-ellipsis" >
175175 Continue with { simplifyProviderName ( ap . host ) }
176176 </ span >
@@ -179,7 +179,10 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {
179179 ) }
180180 < SSOLoginForm
181181 onSuccess = { authorizeSuccessful }
182- singleOrgMode = { ! ! authProviders . data && authProviders . data . length === 0 }
182+ singleOrgMode = {
183+ ! ! authProviderDescriptions . data &&
184+ authProviderDescriptions . data . length === 0
185+ }
183186 />
184187 </ div >
185188 { errorMessage && < ErrorMessage imgSrc = { exclamation } message = { errorMessage } /> }
0 commit comments