diff --git a/src/components/quota/quotaConfigs.ts b/src/components/quota/quotaConfigs.ts index 27b852b..22f937e 100644 --- a/src/components/quota/quotaConfigs.ts +++ b/src/components/quota/quotaConfigs.ts @@ -675,11 +675,16 @@ const buildClaudeQuotaWindows = ( return windows; }; -const CLAUDE_PLAN_TYPE_MAP: Record = { - default_claude_max_5x: 'plan_max5', - default_claude_max_20x: 'plan_max20', - default_claude_pro: 'plan_pro', - default_claude_ai: 'plan_free', +const normalizeFlagValue = (value: unknown): boolean | undefined => { + if (value === undefined || value === null) return undefined; + if (typeof value === 'boolean') return value; + if (typeof value === 'number') return value !== 0; + if (typeof value === 'string') { + const trimmed = value.trim().toLowerCase(); + if (['true', '1', 'yes', 'y', 'on'].includes(trimmed)) return true; + if (['false', '0', 'no', 'n', 'off'].includes(trimmed)) return false; + } + return undefined; }; const parseClaudeProfilePayload = (payload: unknown): ClaudeProfileResponse | null => { @@ -702,10 +707,15 @@ const parseClaudeProfilePayload = (payload: unknown): ClaudeProfileResponse | nu const resolveClaudePlanType = (profile: ClaudeProfileResponse | null): string | null => { if (!profile) return null; - const tier = normalizeStringValue(profile.organization?.rate_limit_tier); - if (!tier) return null; + const hasClaudeMax = normalizeFlagValue(profile.account?.has_claude_max); + if (hasClaudeMax) return 'plan_max'; - return CLAUDE_PLAN_TYPE_MAP[tier] ?? 'plan_unknown'; + const hasClaudePro = normalizeFlagValue(profile.account?.has_claude_pro); + if (hasClaudePro) return 'plan_pro'; + + if (hasClaudeMax === false && hasClaudePro === false) return 'plan_free'; + + return null; }; const fetchClaudeQuota = async ( diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index c6cc4eb..9feaa42 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -604,6 +604,7 @@ "plan_unknown": "Unknown", "plan_free": "Free", "plan_pro": "Pro", + "plan_max": "Max", "plan_max5": "Max 5x", "plan_max20": "Max 20x" }, diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index bc7111e..c8a60c7 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -607,6 +607,7 @@ "plan_unknown": "Неизвестно", "plan_free": "Free", "plan_pro": "Pro", + "plan_max": "Max", "plan_max5": "Max 5x", "plan_max20": "Max 20x" }, diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index e01a95b..ffbd624 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -604,6 +604,7 @@ "plan_unknown": "未知", "plan_free": "免费版", "plan_pro": "专业版", + "plan_max": "Max", "plan_max5": "Max 5x", "plan_max20": "Max 20x" },