Path: blob/main/components/dashboard/src/data/auth-providers/auth-provider-options-query.ts
2501 views
/**1* Copyright (c) 2024 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { AuthProviderType } from "@gitpod/public-api/lib/gitpod/v1/authprovider_pb";7import { isGitpodIo } from "../../utils";8import { useMemo } from "react";910const optionsForPAYG = [11{ type: AuthProviderType.GITHUB, label: "GitHub" },12{ type: AuthProviderType.GITLAB, label: "GitLab" },13{ type: AuthProviderType.BITBUCKET_SERVER, label: "Bitbucket Server" },14{ type: AuthProviderType.BITBUCKET, label: "Bitbucket Cloud" },15];1617const optionsForEnterprise = [...optionsForPAYG, { type: AuthProviderType.AZURE_DEVOPS, label: "Azure DevOps" }];1819export const isSupportAzureDevOpsIntegration = () => {20return isGitpodIo();21};2223export const useAuthProviderOptionsQuery = (isOrgLevel: boolean) => {24return useMemo(() => {25const isPAYG = isGitpodIo();26// Azure DevOps is not supported for PAYG users and is only available for org-level integrations27// because auth flow is identified by auth provider's host, which will always be `dev.azure.com`28//29// Don't remove this until we can setup an generial application for Azure DevOps (investigate needed)30if (isPAYG || !isOrgLevel) {31return optionsForPAYG;32}33return optionsForEnterprise;34}, [isOrgLevel]);35};363738