mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 10:16:49 +00:00
fix(quota): handle 'standard-tier' as free in tier mapping
API returns 'standard-tier' ID for free accounts, not 'FREE'. Updated mapTierString() to recognize 'standard' substring.
This commit is contained in:
@@ -285,14 +285,16 @@ function readAuthData(provider: CLIProxyProvider, accountId: string): AuthData |
|
||||
|
||||
/**
|
||||
* Map API tier string to AccountTier type
|
||||
* API returns: "FREE", "PRO", "ULTRA" (or variants like "pro", "ultra")
|
||||
* API returns tier IDs like: "standard-tier" (free), "pro-tier" (pro), "ultra-tier" (ultra)
|
||||
* Also handles legacy formats: "FREE", "PRO", "ULTRA"
|
||||
*/
|
||||
function mapTierString(tierStr: string | undefined): AccountTier {
|
||||
if (!tierStr) return 'unknown';
|
||||
const normalized = tierStr.toLowerCase();
|
||||
if (normalized.includes('ultra')) return 'ultra';
|
||||
if (normalized.includes('pro')) return 'pro';
|
||||
if (normalized.includes('free')) return 'free';
|
||||
// "standard-tier" or "free" both map to free
|
||||
if (normalized.includes('standard') || normalized.includes('free')) return 'free';
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user