diff --git a/packages/console/src/components/ApplicationCreation/CreateForm/Footer/index.tsx b/packages/console/src/components/ApplicationCreation/CreateForm/Footer/index.tsx index 342dbb6d6..3dc21dd38 100644 --- a/packages/console/src/components/ApplicationCreation/CreateForm/Footer/index.tsx +++ b/packages/console/src/components/ApplicationCreation/CreateForm/Footer/index.tsx @@ -113,7 +113,7 @@ function Footer({ selectedType, isLoading, onClickCreate, isThirdParty }: Props) , - planName: , + planName: , }} > {t('paywall.applications', { count: currentSubscriptionQuota.applicationsLimit ?? 0 })} diff --git a/packages/console/src/components/CreateConnectorForm/Footer/index.tsx b/packages/console/src/components/CreateConnectorForm/Footer/index.tsx index 76b9ea664..e5e28b7f6 100644 --- a/packages/console/src/components/CreateConnectorForm/Footer/index.tsx +++ b/packages/console/src/components/CreateConnectorForm/Footer/index.tsx @@ -16,8 +16,11 @@ type Props = { function Footer({ isCreatingSocialConnector, isCreateButtonDisabled, onClickCreateButton }: Props) { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console.upsell.paywall' }); - const { currentSku, currentSubscriptionUsage, currentSubscriptionQuota } = - useContext(SubscriptionDataContext); + const { + currentSubscription: { planId, isEnterprisePlan }, + currentSubscriptionUsage, + currentSubscriptionQuota, + } = useContext(SubscriptionDataContext); const isSocialConnectorsReachLimit = hasReachedSubscriptionQuotaLimit({ quotaKey: 'socialConnectorsLimit', @@ -31,7 +34,7 @@ function Footer({ isCreatingSocialConnector, isCreateButtonDisabled, onClickCrea , - planName: , + planName: , }} > {t('social_connectors', { diff --git a/packages/console/src/components/MauExceededModal/index.tsx b/packages/console/src/components/MauExceededModal/index.tsx index 37ab70fc8..42965aa6c 100644 --- a/packages/console/src/components/MauExceededModal/index.tsx +++ b/packages/console/src/components/MauExceededModal/index.tsx @@ -20,7 +20,9 @@ import SkuName from '../SkuName'; import styles from './index.module.scss'; function MauExceededModal() { - const { currentSku } = useContext(SubscriptionDataContext); + const { + currentSubscription: { planId, isEnterprisePlan }, + } = useContext(SubscriptionDataContext); const { currentTenant } = useContext(TenantsContext); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); @@ -75,7 +77,7 @@ function MauExceededModal() { , + planName: , }} > {t('upsell.mau_exceeded_modal.notification')} diff --git a/packages/console/src/components/SkuName/index.tsx b/packages/console/src/components/SkuName/index.tsx index 48cb7b457..408b35e61 100644 --- a/packages/console/src/components/SkuName/index.tsx +++ b/packages/console/src/components/SkuName/index.tsx @@ -1,9 +1,7 @@ import { ReservedPlanId } from '@logto/schemas'; import { type TFuncKey } from 'i18next'; -import { useContext } from 'react'; import { useTranslation } from 'react-i18next'; -import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider'; import { ReservedSkuId } from '@/types/subscriptions'; const registeredSkuIdNamePhraseMap: Record< @@ -20,13 +18,11 @@ const registeredSkuIdNamePhraseMap: Record< type Props = { readonly skuId: string; + readonly isEnterprisePlan?: boolean; }; -function SkuName({ skuId: rawSkuId }: Props) { +function SkuName({ skuId: rawSkuId, isEnterprisePlan = false }: Props) { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console.subscription' }); - const { - currentSubscription: { isEnterprisePlan }, - } = useContext(SubscriptionDataContext); const skuId = isEnterprisePlan ? ReservedPlanId.Enterprise : rawSkuId; const skuNamePhrase = registeredSkuIdNamePhraseMap[skuId]; diff --git a/packages/console/src/components/Topbar/TenantSelector/TenantDropdownItem/index.tsx b/packages/console/src/components/Topbar/TenantSelector/TenantDropdownItem/index.tsx index 947de5b6c..717439731 100644 --- a/packages/console/src/components/Topbar/TenantSelector/TenantDropdownItem/index.tsx +++ b/packages/console/src/components/Topbar/TenantSelector/TenantDropdownItem/index.tsx @@ -1,4 +1,4 @@ -import { TenantTag, ReservedPlanId } from '@logto/schemas'; +import { TenantTag } from '@logto/schemas'; import classNames from 'classnames'; import { useContext, useMemo } from 'react'; @@ -31,7 +31,6 @@ function TenantDropdownItem({ tenantData, isSelected, onClick }: Props) { () => logtoSkus.find(({ id }) => id === planId), [logtoSkus, planId] ); - const skuId = isEnterprisePlan ? ReservedPlanId.Enterprise : planId; if (!tenantSubscriptionSku) { return null; @@ -49,7 +48,7 @@ function TenantDropdownItem({ tenantData, isSelected, onClick }: Props) { {tag === TenantTag.Development ? ( ) : ( - + )} diff --git a/packages/console/src/pages/ApiResourceDetails/ApiResourcePermissions/components/CreatePermissionModal/index.tsx b/packages/console/src/pages/ApiResourceDetails/ApiResourcePermissions/components/CreatePermissionModal/index.tsx index 4ed5e9972..4cfa7b0f1 100644 --- a/packages/console/src/pages/ApiResourceDetails/ApiResourcePermissions/components/CreatePermissionModal/index.tsx +++ b/packages/console/src/pages/ApiResourceDetails/ApiResourcePermissions/components/CreatePermissionModal/index.tsx @@ -28,8 +28,11 @@ type Props = { type CreatePermissionFormData = Pick; function CreatePermissionModal({ resourceId, totalResourceCount, onClose }: Props) { - const { currentSku, currentSubscriptionQuota, currentSubscriptionResourceScopeUsage } = - useContext(SubscriptionDataContext); + const { + currentSubscriptionQuota, + currentSubscriptionResourceScopeUsage, + currentSubscription: { planId, isEnterprisePlan }, + } = useContext(SubscriptionDataContext); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const { @@ -83,7 +86,7 @@ function CreatePermissionModal({ resourceId, totalResourceCount, onClose }: Prop , - planName: , + planName: , }} > {t('upsell.paywall.scopes_per_resource', { diff --git a/packages/console/src/pages/ApiResources/components/CreateForm/Footer.tsx b/packages/console/src/pages/ApiResources/components/CreateForm/Footer.tsx index 2b7906280..4da39009c 100644 --- a/packages/console/src/pages/ApiResources/components/CreateForm/Footer.tsx +++ b/packages/console/src/pages/ApiResources/components/CreateForm/Footer.tsx @@ -47,7 +47,7 @@ function Footer({ isCreationLoading, onClickCreate }: Props) { , - planName: , + planName: , }} > {t('upsell.paywall.resources', { diff --git a/packages/console/src/pages/Applications/components/ProtectedAppForm/index.tsx b/packages/console/src/pages/Applications/components/ProtectedAppForm/index.tsx index f61bebcaa..a19333a6a 100644 --- a/packages/console/src/pages/Applications/components/ProtectedAppForm/index.tsx +++ b/packages/console/src/pages/Applications/components/ProtectedAppForm/index.tsx @@ -46,7 +46,10 @@ function ProtectedAppForm({ onCreateSuccess, }: Props) { const { data } = useSWRImmutable(isCloud && 'api/systems/application'); - const { currentSku, currentSubscriptionQuota } = useContext(SubscriptionDataContext); + const { + currentSubscriptionQuota, + currentSubscription: { planId, isEnterprisePlan }, + } = useContext(SubscriptionDataContext); const { hasAppsReachedLimit } = useApplicationsUsage(); const defaultDomain = data?.protectedApps.defaultDomain ?? ''; const { navigate } = useTenantPathname(); @@ -202,7 +205,7 @@ function ProtectedAppForm({ , - planName: , + planName: , }} > {t('upsell.paywall.applications', { diff --git a/packages/console/src/pages/RoleDetails/RolePermissions/components/AssignPermissionsModal/index.tsx b/packages/console/src/pages/RoleDetails/RolePermissions/components/AssignPermissionsModal/index.tsx index f4cb96246..b00744da8 100644 --- a/packages/console/src/pages/RoleDetails/RolePermissions/components/AssignPermissionsModal/index.tsx +++ b/packages/console/src/pages/RoleDetails/RolePermissions/components/AssignPermissionsModal/index.tsx @@ -24,8 +24,11 @@ type Props = { function AssignPermissionsModal({ roleId, roleType, onClose }: Props) { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); - const { currentSku, currentSubscriptionRoleScopeUsage, currentSubscriptionQuota } = - useContext(SubscriptionDataContext); + const { + currentSubscription: { planId, isEnterprisePlan }, + currentSubscriptionRoleScopeUsage, + currentSubscriptionQuota, + } = useContext(SubscriptionDataContext); const [isSubmitting, setIsSubmitting] = useState(false); const [scopes, setScopes] = useState([]); @@ -79,7 +82,7 @@ function AssignPermissionsModal({ roleId, roleType, onClose }: Props) { , - planName: , + planName: , }} > {t('upsell.paywall.scopes_per_role', { diff --git a/packages/console/src/pages/Roles/components/CreateRoleForm/Footer.tsx b/packages/console/src/pages/Roles/components/CreateRoleForm/Footer.tsx index c0c7d1a3c..d368c5779 100644 --- a/packages/console/src/pages/Roles/components/CreateRoleForm/Footer.tsx +++ b/packages/console/src/pages/Roles/components/CreateRoleForm/Footer.tsx @@ -20,8 +20,11 @@ type Props = { function Footer({ roleType, isCreating, onClickCreate }: Props) { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); - const { currentSku, currentSubscriptionQuota, currentSubscriptionUsage } = - useContext(SubscriptionDataContext); + const { + currentSubscription: { planId, isEnterprisePlan }, + currentSubscriptionQuota, + currentSubscriptionUsage, + } = useContext(SubscriptionDataContext); const hasRoleReachedLimit = hasReachedSubscriptionQuotaLimit({ quotaKey: roleType === RoleType.User ? 'userRolesLimit' : 'machineToMachineRolesLimit', @@ -44,7 +47,7 @@ function Footer({ roleType, isCreating, onClickCreate }: Props) { , - planName: , + planName: , }} > {/* User roles limit paywall */} diff --git a/packages/console/src/pages/TenantSettings/Subscription/CurrentPlan/index.tsx b/packages/console/src/pages/TenantSettings/Subscription/CurrentPlan/index.tsx index f81cdcc83..1def21a9d 100644 --- a/packages/console/src/pages/TenantSettings/Subscription/CurrentPlan/index.tsx +++ b/packages/console/src/pages/TenantSettings/Subscription/CurrentPlan/index.tsx @@ -59,7 +59,7 @@ function CurrentPlan({ periodicUsage: rawPeriodicUsage }: Props) {
- +
diff --git a/packages/console/src/pages/Webhooks/CreateFormModal/CreateForm.tsx b/packages/console/src/pages/Webhooks/CreateFormModal/CreateForm.tsx index 8c252936b..0a8f8923d 100644 --- a/packages/console/src/pages/Webhooks/CreateFormModal/CreateForm.tsx +++ b/packages/console/src/pages/Webhooks/CreateFormModal/CreateForm.tsx @@ -26,8 +26,11 @@ type CreateHookPayload = Pick & { }; function CreateForm({ onClose }: Props) { - const { currentSku, currentSubscriptionQuota, currentSubscriptionUsage } = - useContext(SubscriptionDataContext); + const { + currentSubscription: { planId, isEnterprisePlan }, + currentSubscriptionQuota, + currentSubscriptionUsage, + } = useContext(SubscriptionDataContext); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const shouldBlockCreation = hasReachedSubscriptionQuotaLimit({ @@ -70,7 +73,7 @@ function CreateForm({ onClose }: Props) { , - planName: , + planName: , }} > {t('upsell.paywall.hooks', {