File size: 964 Bytes
8059bf0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | export function normalizeUsageServiceTier(serviceTier?: string | null): string | null {
const value = serviceTier?.trim().toLowerCase()
if (!value) return null
if (value === 'fast') return 'priority'
if (value === 'default' || value === 'standard') return 'standard'
if (value === 'priority' || value === 'flex') return value
return value
}
export function formatUsageServiceTier(serviceTier?: string | null): string {
const normalized = normalizeUsageServiceTier(serviceTier)
if (!normalized) return 'standard'
return normalized
}
export function getUsageServiceTierLabel(
serviceTier: string | null | undefined,
translate: (key: string) => string,
): string {
const tier = formatUsageServiceTier(serviceTier)
if (tier === 'priority') return translate('usage.serviceTierPriority')
if (tier === 'flex') return translate('usage.serviceTierFlex')
if (tier === 'standard') return translate('usage.serviceTierStandard')
return tier
}
|