diff --git a/packages/console/src/cloud/pages/Main/TenantLandingPage/TenantLandingPageContent/index.tsx b/packages/console/src/cloud/pages/Main/TenantLandingPage/TenantLandingPageContent/index.tsx index 5f870ed75..269392da8 100644 --- a/packages/console/src/cloud/pages/Main/TenantLandingPage/TenantLandingPageContent/index.tsx +++ b/packages/console/src/cloud/pages/Main/TenantLandingPage/TenantLandingPageContent/index.tsx @@ -1,5 +1,4 @@ import { Theme } from '@logto/schemas'; -import type { TenantInfo } from '@logto/schemas/models'; import classNames from 'classnames'; import { useContext, useState } from 'react'; @@ -11,6 +10,7 @@ import { TenantsContext } from '@/contexts/TenantsProvider'; import Button from '@/ds-components/Button'; import DynamicT from '@/ds-components/DynamicT'; import useTheme from '@/hooks/use-theme'; +import type { TenantInfo } from '@/types/tenant'; import * as styles from './index.module.scss'; diff --git a/packages/console/src/components/CreateTenantModal/SelectTenantPlanModal/index.tsx b/packages/console/src/components/CreateTenantModal/SelectTenantPlanModal/index.tsx index 9b733ea85..e0801698b 100644 --- a/packages/console/src/components/CreateTenantModal/SelectTenantPlanModal/index.tsx +++ b/packages/console/src/components/CreateTenantModal/SelectTenantPlanModal/index.tsx @@ -1,4 +1,3 @@ -import { type TenantInfo } from '@logto/schemas/models'; import { toast } from 'react-hot-toast'; import { Trans, useTranslation } from 'react-i18next'; import Modal from 'react-modal'; @@ -12,6 +11,7 @@ import useSubscribe from '@/hooks/use-subscribe'; import useSubscriptionPlans from '@/hooks/use-subscription-plans'; import * as modalStyles from '@/scss/modal.module.scss'; import { type SubscriptionPlan } from '@/types/subscriptions'; +import type { TenantInfo } from '@/types/tenant'; import { type CreateTenantData } from '../type'; diff --git a/packages/console/src/components/CreateTenantModal/index.tsx b/packages/console/src/components/CreateTenantModal/index.tsx index 6e3a89bbc..4e4b68082 100644 --- a/packages/console/src/components/CreateTenantModal/index.tsx +++ b/packages/console/src/components/CreateTenantModal/index.tsx @@ -1,6 +1,6 @@ import type { AdminConsoleKey } from '@logto/phrases'; import { Theme } from '@logto/schemas'; -import { TenantTag, type TenantInfo } from '@logto/schemas/models'; +import { TenantTag } from '@logto/schemas/models'; import { useState } from 'react'; import { Controller, FormProvider, useForm } from 'react-hook-form'; import { toast } from 'react-hot-toast'; @@ -18,6 +18,7 @@ import RadioGroup, { Radio } from '@/ds-components/RadioGroup'; import TextInput from '@/ds-components/TextInput'; import useTheme from '@/hooks/use-theme'; import * as modalStyles from '@/scss/modal.module.scss'; +import type { TenantInfo } from '@/types/tenant'; import SelectTenantPlanModal from './SelectTenantPlanModal'; import * as styles from './index.module.scss'; diff --git a/packages/console/src/components/CreateTenantModal/type.ts b/packages/console/src/components/CreateTenantModal/type.ts index 750d7f85e..eb1a3185c 100644 --- a/packages/console/src/components/CreateTenantModal/type.ts +++ b/packages/console/src/components/CreateTenantModal/type.ts @@ -1,3 +1,3 @@ -import { type TenantInfo } from '@logto/schemas/models'; +import type { TenantInfo } from '@/types/tenant'; export type CreateTenantData = Pick; diff --git a/packages/console/src/containers/AppContent/components/Topbar/TenantSelector/index.tsx b/packages/console/src/containers/AppContent/components/Topbar/TenantSelector/index.tsx index 6e149dab1..6ef32d289 100644 --- a/packages/console/src/containers/AppContent/components/Topbar/TenantSelector/index.tsx +++ b/packages/console/src/containers/AppContent/components/Topbar/TenantSelector/index.tsx @@ -1,5 +1,4 @@ import { adminTenantId, maxFreeTenantLimit } from '@logto/schemas'; -import { type TenantInfo } from '@logto/schemas/models'; import classNames from 'classnames'; import { useContext, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -12,6 +11,7 @@ import { TenantsContext } from '@/contexts/TenantsProvider'; import Divider from '@/ds-components/Divider'; import Dropdown, { DropdownItem } from '@/ds-components/Dropdown'; import OverlayScrollbar from '@/ds-components/OverlayScrollbar'; +import type { TenantInfo } from '@/types/tenant'; import { onKeyDownHandler } from '@/utils/a11y'; import TenantEnvTag from './TenantEnvTag'; diff --git a/packages/console/src/containers/TenantAccess/index.tsx b/packages/console/src/containers/TenantAccess/index.tsx index 071fb86f5..d1178ef02 100644 --- a/packages/console/src/containers/TenantAccess/index.tsx +++ b/packages/console/src/containers/TenantAccess/index.tsx @@ -1,5 +1,4 @@ import { useLogto } from '@logto/react'; -import { type TenantInfo } from '@logto/schemas/lib/models/tenants.js'; import { trySafe } from '@silverhand/essentials'; import { useContext, useEffect } from 'react'; import { Outlet } from 'react-router-dom'; @@ -10,6 +9,7 @@ import AppLoading from '@/components/AppLoading'; import type ProtectedRoutes from '@/containers/ProtectedRoutes'; import { TenantsContext } from '@/contexts/TenantsProvider'; import useUserDefaultTenantId from '@/hooks/use-user-default-tenant-id'; +import type { TenantInfo } from '@/types/tenant'; /** * The container that ensures the user has access to the current tenant. When the user is diff --git a/packages/console/src/contexts/TenantsProvider.tsx b/packages/console/src/contexts/TenantsProvider.tsx index 5d85b0848..881c41c7f 100644 --- a/packages/console/src/contexts/TenantsProvider.tsx +++ b/packages/console/src/contexts/TenantsProvider.tsx @@ -1,12 +1,12 @@ import { defaultManagementApi } from '@logto/schemas'; -import { type TenantInfo, TenantTag } from '@logto/schemas/models'; +import { TenantTag } from '@logto/schemas/models'; import { conditionalArray, noop } from '@silverhand/essentials'; import type { ReactNode } from 'react'; import { useCallback, useMemo, createContext, useState } from 'react'; import { isCloud } from '@/consts/env'; -import { ReservedPlanId } from '@/consts/subscriptions'; import { getUserTenantId } from '@/consts/tenants'; +import type { TenantInfo } from '@/types/tenant'; /** * The current tenant status of access validation. When it's `validated`, it indicates that a @@ -58,7 +58,6 @@ const initialTenants = Object.freeze( name: `tenant_${tenantId}`, tag: TenantTag.Development, indicator, - planId: ReservedPlanId.free, } ) ); diff --git a/packages/console/src/pages/TenantSettings/TenantBasicSettings/DeleteModal/index.tsx b/packages/console/src/pages/TenantSettings/TenantBasicSettings/DeleteModal/index.tsx index 7ae8be3cc..1249fed49 100644 --- a/packages/console/src/pages/TenantSettings/TenantBasicSettings/DeleteModal/index.tsx +++ b/packages/console/src/pages/TenantSettings/TenantBasicSettings/DeleteModal/index.tsx @@ -1,4 +1,3 @@ -import { type TenantInfo } from '@logto/schemas/models'; import classNames from 'classnames'; import { useTranslation, Trans } from 'react-i18next'; @@ -6,6 +5,7 @@ import { contactEmailLink } from '@/consts'; import { tenantTagMap } from '@/containers/AppContent/components/Topbar/TenantSelector/TenantEnvTag'; import DeleteConfirmModal from '@/ds-components/DeleteConfirmModal'; import TextLink from '@/ds-components/TextLink'; +import type { TenantInfo } from '@/types/tenant'; import * as styles from './index.module.scss'; diff --git a/packages/console/src/pages/TenantSettings/TenantBasicSettings/index.tsx b/packages/console/src/pages/TenantSettings/TenantBasicSettings/index.tsx index a9908faa6..d36a03f70 100644 --- a/packages/console/src/pages/TenantSettings/TenantBasicSettings/index.tsx +++ b/packages/console/src/pages/TenantSettings/TenantBasicSettings/index.tsx @@ -1,4 +1,4 @@ -import { type TenantInfo, TenantTag } from '@logto/schemas/models'; +import { TenantTag } from '@logto/schemas/models'; import classNames from 'classnames'; import { useContext, useEffect, useState } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; @@ -11,6 +11,7 @@ import PageMeta from '@/components/PageMeta'; import SubmitFormChangesActionBar from '@/components/SubmitFormChangesActionBar'; import UnsavedChangesAlertModal from '@/components/UnsavedChangesAlertModal'; import { TenantsContext } from '@/contexts/TenantsProvider'; +import type { TenantInfo } from '@/types/tenant'; import DeleteCard from './DeleteCard'; import DeleteModal from './DeleteModal'; diff --git a/packages/console/src/types/tenant.ts b/packages/console/src/types/tenant.ts new file mode 100644 index 000000000..ad63fdec3 --- /dev/null +++ b/packages/console/src/types/tenant.ts @@ -0,0 +1,7 @@ +import { type TenantInfo as FullTenantInfo } from '@logto/schemas/models'; + +/** + * We added an required `planId` field to the `TenantInfo` type, need to update the cloud + * API to get this field, temporarily use this type to avoid type error. + */ +export type TenantInfo = Omit & { planId?: string };