diff --git a/apps/customer-portal/webapp/src/constants/apiConstants.ts b/apps/customer-portal/webapp/src/constants/apiConstants.ts index 4bab22a356..5e03364039 100644 --- a/apps/customer-portal/webapp/src/constants/apiConstants.ts +++ b/apps/customer-portal/webapp/src/constants/apiConstants.ts @@ -40,7 +40,6 @@ export const ApiQueryKeys = { PRODUCT_VERSIONS_SEARCH: "product-versions-search", DEPLOYMENT_PRODUCTS: "deployment-products", TIME_TRACKING_STATS: "time-tracking-stats", - RECOMMENDED_UPDATE_LEVELS: "recommended-update-levels", PRODUCT_UPDATE_LEVELS: "product-update-levels", PRODUCT_VULNERABILITY: "product-vulnerability", PRODUCT_VULNERABILITIES_SEARCH: "product-vulnerabilities-search", diff --git a/apps/customer-portal/webapp/src/features/project-details/components/deployments/__tests__/UpdateHistoryTab.test.tsx b/apps/customer-portal/webapp/src/features/project-details/components/deployments/__tests__/UpdateHistoryTab.test.tsx index 3a2d67cc0e..1a53a4e3b1 100644 --- a/apps/customer-portal/webapp/src/features/project-details/components/deployments/__tests__/UpdateHistoryTab.test.tsx +++ b/apps/customer-portal/webapp/src/features/project-details/components/deployments/__tests__/UpdateHistoryTab.test.tsx @@ -19,13 +19,6 @@ import { describe, it, expect, vi } from "vitest"; import UpdateHistoryTab from "@features/project-details/components/deployments/UpdateHistoryTab"; import type { ProductUpdate } from "@features/project-details/types/products"; -vi.mock("@features/updates/api/useGetRecommendedUpdateLevels", () => ({ - useGetRecommendedUpdateLevels: () => ({ - data: [], - isLoading: false, - }), -})); - vi.mock("@features/updates/api/usePostUpdateLevelsSearch", () => ({ usePostUpdateLevelsSearch: () => ({ data: null, diff --git a/apps/customer-portal/webapp/src/features/updates/api/useGetRecommendedUpdateLevels.ts b/apps/customer-portal/webapp/src/features/updates/api/useGetRecommendedUpdateLevels.ts deleted file mode 100644 index b5e2734ac9..0000000000 --- a/apps/customer-portal/webapp/src/features/updates/api/useGetRecommendedUpdateLevels.ts +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com). -// -// WSO2 LLC. licenses this file to you under the Apache License, -// Version 2.0 (the "License"); you may not use this file except -// in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -import { useQuery, type UseQueryResult } from "@tanstack/react-query"; -import { useAsgardeo } from "@asgardeo/react"; -import { useAuthApiClient } from "@/hooks/useAuthApiClient"; -import { useLogger } from "@hooks/useLogger"; -import { ApiQueryKeys } from "@constants/apiConstants"; -import type { RecommendedUpdateLevelItem } from "@features/updates/types/updates"; - -/** - * Fetches recommended update levels from GET /updates/recommended-update-levels. - * - * @returns {UseQueryResult} The query result. - */ -export function useGetRecommendedUpdateLevels(): UseQueryResult< - RecommendedUpdateLevelItem[], - Error -> { - const logger = useLogger(); - const { isSignedIn, isLoading: isAuthLoading } = useAsgardeo(); - const authFetch = useAuthApiClient(); - - return useQuery({ - queryKey: [ApiQueryKeys.RECOMMENDED_UPDATE_LEVELS], - queryFn: async (): Promise => { - logger.debug("Fetching recommended update levels"); - - try { - const baseUrl = window.config?.CUSTOMER_PORTAL_BACKEND_BASE_URL; - - if (!baseUrl) { - throw new Error("CUSTOMER_PORTAL_BACKEND_BASE_URL is not configured"); - } - - const requestUrl = `${baseUrl}/updates/recommended-update-levels`; - - const response = await authFetch(requestUrl, { - method: "GET", - }); - - logger.debug( - `[useGetRecommendedUpdateLevels] Response status: ${response.status}`, - ); - - if (!response.ok) { - throw new Error( - `Error fetching recommended update levels: ${response.statusText}`, - ); - } - - const data: RecommendedUpdateLevelItem[] = await response.json(); - logger.debug("[useGetRecommendedUpdateLevels] Data received:", data); - return data; - } catch (error) { - logger.error("[useGetRecommendedUpdateLevels] Error:", error); - throw error; - } - }, - enabled: isSignedIn && !isAuthLoading, - staleTime: 0, - }); -} diff --git a/apps/customer-portal/webapp/src/features/updates/constants/updatesConstants.ts b/apps/customer-portal/webapp/src/features/updates/constants/updatesConstants.ts index 72531c69e3..2de9910c1e 100644 --- a/apps/customer-portal/webapp/src/features/updates/constants/updatesConstants.ts +++ b/apps/customer-portal/webapp/src/features/updates/constants/updatesConstants.ts @@ -36,9 +36,6 @@ export const UPDATES_PAGE_TABS = [ { id: UpdatesPageTabId.All, label: "All Updates" }, ]; -export const UPDATES_RECOMMENDED_LEVELS_LOAD_ERROR = - "Could not load recommended update levels."; - export const ALL_UPDATES_TAB_INITIAL_FILTER: AllUpdatesTabFilterState = { productName: "", productVersion: "",