diff --git a/.changeset/violet-baboons-cough.md b/.changeset/violet-baboons-cough.md new file mode 100644 index 00000000000..d7b97f56990 --- /dev/null +++ b/.changeset/violet-baboons-cough.md @@ -0,0 +1,5 @@ +--- +"@wso2is/features": patch +--- + +Prevent subscription calls being sent inside suborganizations diff --git a/features/admin.extensions.v1/components/subscription/api/subscription.ts b/features/admin.extensions.v1/components/subscription/api/subscription.ts index 7ee30b6ff4f..eb24bfaa42c 100644 --- a/features/admin.extensions.v1/components/subscription/api/subscription.ts +++ b/features/admin.extensions.v1/components/subscription/api/subscription.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). + * Copyright (c) 2023-2024, 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 @@ -16,14 +16,14 @@ * under the License. */ +import { HttpMethods } from "@wso2is/core/models"; +import { OrganizationType } from "features/admin.organizations.v1/constants"; +import { Config, store } from "../../../../admin.core.v1"; import useRequest, { RequestConfigInterface, RequestErrorInterface, RequestResultInterface } from "../../../../admin.core.v1/hooks/use-request"; -import { HttpMethods } from "@wso2is/core/models"; -import { Config } from "../../../../admin.core.v1"; -import { useGetCurrentOrganizationType } from "../../../../admin.organizations.v1/hooks/use-get-organization-type"; import { getDomainQueryParam } from "../../tenants/api/tenants"; import { getTenantResourceEndpoints } from "../../tenants/configs"; import { TenantTierRequestResponse } from "../models/subscription"; @@ -36,7 +36,7 @@ import { TenantTierRequestResponse } from "../models/subscription"; const useTenantTier = (): RequestResultInterface => { - const { isFirstLevelOrganization } = useGetCurrentOrganizationType(); + const organizationType: OrganizationType = store.getState().organization.organizationType; const requestConfig: RequestConfigInterface = { headers: { @@ -48,7 +48,8 @@ const useTenantTier = ( - Config.getDeploymentConfig().extensions?.subscriptionApiPath && isFirstLevelOrganization() + organizationType === OrganizationType.FIRST_LEVEL_ORGANIZATION + && Config.getDeploymentConfig().extensions?.subscriptionApiPath ? requestConfig : null, {