mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
fix(console): display mfa feature item in downgrade plan modal (#4922)
This commit is contained in:
parent
15fd06fb4b
commit
27fc7b9a3b
2 changed files with 3 additions and 22 deletions
|
@ -3,7 +3,6 @@ import { useMemo } from 'react';
|
||||||
import { Trans, useTranslation } from 'react-i18next';
|
import { Trans, useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import PlanName from '@/components/PlanName';
|
import PlanName from '@/components/PlanName';
|
||||||
import { isDevFeaturesEnabled } from '@/consts/env';
|
|
||||||
import { type SubscriptionPlan } from '@/types/subscriptions';
|
import { type SubscriptionPlan } from '@/types/subscriptions';
|
||||||
|
|
||||||
import PlanQuotaDiffCard from './PlanQuotaDiffCard';
|
import PlanQuotaDiffCard from './PlanQuotaDiffCard';
|
||||||
|
@ -17,19 +16,9 @@ type Props = {
|
||||||
function DowngradeConfirmModalContent({ currentPlan, targetPlan }: Props) {
|
function DowngradeConfirmModalContent({ currentPlan, targetPlan }: Props) {
|
||||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||||
|
|
||||||
const {
|
const { quota: currentQuota, name: currentPlanName } = currentPlan;
|
||||||
quota: currentFullQuota,
|
|
||||||
quota: { mfaEnabled: currentMfaEnabled, ...currentQuotaWithoutMfa },
|
|
||||||
name: currentPlanName,
|
|
||||||
} = currentPlan;
|
|
||||||
const currentQuota = isDevFeaturesEnabled ? currentFullQuota : currentQuotaWithoutMfa;
|
|
||||||
|
|
||||||
const {
|
const { quota: targetQuota, name: targetPlanName } = targetPlan;
|
||||||
quota: targetFullQuota,
|
|
||||||
quota: { mfaEnabled: targetMfaEnabled, ...targetQuotaWithoutMfa },
|
|
||||||
name: targetPlanName,
|
|
||||||
} = targetPlan;
|
|
||||||
const targetQuota = isDevFeaturesEnabled ? targetFullQuota : targetQuotaWithoutMfa;
|
|
||||||
|
|
||||||
const currentQuotaDiff = useMemo(
|
const currentQuotaDiff = useMemo(
|
||||||
() => diff(targetQuota, currentQuota),
|
() => diff(targetQuota, currentQuota),
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { Trans, useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import ContactUsPhraseLink from '@/components/ContactUsPhraseLink';
|
import ContactUsPhraseLink from '@/components/ContactUsPhraseLink';
|
||||||
import PlanName from '@/components/PlanName';
|
import PlanName from '@/components/PlanName';
|
||||||
import { isDevFeaturesEnabled } from '@/consts/env';
|
|
||||||
import { planQuotaItemOrder } from '@/consts/plan-quotas';
|
import { planQuotaItemOrder } from '@/consts/plan-quotas';
|
||||||
import {
|
import {
|
||||||
quotaItemLimitedPhrasesMap,
|
quotaItemLimitedPhrasesMap,
|
||||||
|
@ -33,14 +32,7 @@ function NotEligibleSwitchPlanModalContent({ targetPlan, isDowngrade = false }:
|
||||||
keyPrefix: 'admin_console.subscription.not_eligible_modal',
|
keyPrefix: 'admin_console.subscription.not_eligible_modal',
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const { id, name, quota } = targetPlan;
|
||||||
id,
|
|
||||||
name,
|
|
||||||
quota: fullQuota,
|
|
||||||
quota: { mfaEnabled, ...quotaWithoutMfa },
|
|
||||||
} = targetPlan;
|
|
||||||
|
|
||||||
const quota = isDevFeaturesEnabled ? fullQuota : quotaWithoutMfa;
|
|
||||||
|
|
||||||
const orderedEntries = useMemo(() => {
|
const orderedEntries = useMemo(() => {
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
|
|
Loading…
Reference in a new issue