diff --git a/packages/console/src/components/PlanUsage/index.tsx b/packages/console/src/components/PlanUsage/index.tsx index 6084381e2..47c5174bb 100644 --- a/packages/console/src/components/PlanUsage/index.tsx +++ b/packages/console/src/components/PlanUsage/index.tsx @@ -104,37 +104,54 @@ function PlanUsage({ periodicUsage: rawPeriodicUsage }: Props) { isEnterprisePlan || (onlyShowPeriodicUsage && (key === 'mauLimit' || key === 'tokenLimit')) ) - .map((key) => ({ - usage: getUsageByKey(key, { + .map((key) => { + const parsedUsage = getUsageByKey(key, { periodicUsage, countBasedUsage: currentSubscriptionUsage, basicQuota: currentSubscriptionBasicQuota, - }), - usageKey: 'subscription.usage.usage_description_with_limited_quota', - titleKey: `subscription.usage.${titleKeyMap[key]}`, - unitPrice: usageKeyPriceMap[key], - ...cond( - (key === 'tokenLimit' || key === 'mauLimit' || isPaidTenant) && { - quota: currentSubscriptionQuota[key], - } - ), - ...cond( - isPaidTenant && { - tooltipKey: `subscription.usage.${ - isEnterprisePlan ? enterpriseTooltipKeyMap[key] : tooltipKeyMap[key] - }`, - basicQuota: currentSubscriptionBasicQuota[key], - } - ), - // Hide the quota notice for Pro plans if the basic quota is 0. - // Per current pricing model design, it should apply to `enterpriseSsoLimit`. - ...cond( - planId === ReservedPlanId.Pro && - currentSubscriptionBasicQuota[key] === 0 && { - isQuotaNoticeHidden: true, + }); + return { + usage: parsedUsage, + usageKey: 'subscription.usage.usage_description_with_limited_quota', + titleKey: `subscription.usage.${titleKeyMap[key]}`, + unitPrice: usageKeyPriceMap[key], + ...cond( + (key === 'tokenLimit' || key === 'mauLimit' || isPaidTenant) && { + quota: currentSubscriptionQuota[key], } - ), - })); + ), + ...cond( + isPaidTenant && { + basicQuota: currentSubscriptionBasicQuota[key], + // Do not show tooltip if the basic quota is null (unlimited) and the usage is number-typed. + ...cond( + !(currentSubscriptionBasicQuota[key] === null && typeof parsedUsage === 'number') && { + tooltipKey: `subscription.usage.${ + isEnterprisePlan ? enterpriseTooltipKeyMap[key] : tooltipKeyMap[key] + }`, + } + ), + // Show tooltip for number-typed basic quota for 'organizationsLimit'. + ...cond( + key === 'organizationsLimit' && + typeof currentSubscriptionBasicQuota[key] === 'number' && + currentSubscriptionBasicQuota[key] > 0 && { + tooltipKey: + 'subscription.usage.organizations.tooltip_for_enterprise_with_numbered_basic_quota', + } + ), + } + ), + // Hide the quota notice for Pro plans if the basic quota is 0. + // Per current pricing model design, it should apply to `enterpriseSsoLimit`. + ...cond( + planId === ReservedPlanId.Pro && + currentSubscriptionBasicQuota[key] === 0 && { + isQuotaNoticeHidden: true, + } + ), + }; + }); return (
diff --git a/packages/phrases/src/locales/en/translation/admin-console/subscription/usage.ts b/packages/phrases/src/locales/en/translation/admin-console/subscription/usage.ts index fe7a2f059..f1544d795 100644 --- a/packages/phrases/src/locales/en/translation/admin-console/subscription/usage.ts +++ b/packages/phrases/src/locales/en/translation/admin-console/subscription/usage.ts @@ -21,6 +21,8 @@ const usage = { description_for_enterprise: '(Included)', tooltip_for_enterprise: 'Inclusion depends on your plan. If the organization feature isn’t in your initial contract, it will be added to your bill when you activate it. The add-on costs ${{price, number}}/month, regardless of the number of organizations or their activity.', + tooltip_for_enterprise_with_numbered_basic_quota: + 'Your plan includes the first {{basicQuota}} organizations for free. If you need more, you can add them with the organization add-on at a flat rate of ${{price, number}} per month, regardless of the number of organizations or their activity level.', }, mfa: { title: 'MFA',