(limits: ClaudeAILimits)
| 301 | * Used for transient notifications when entering overage mode |
| 302 | */ |
| 303 | export function getUsingOverageText(limits: ClaudeAILimits): string { |
| 304 | const resetTime = limits.resetsAt |
| 305 | ? formatResetTime(limits.resetsAt, true) |
| 306 | : '' |
| 307 | |
| 308 | let limitName = '' |
| 309 | if (limits.rateLimitType === 'five_hour') { |
| 310 | limitName = 'session limit' |
| 311 | } else if (limits.rateLimitType === 'seven_day') { |
| 312 | limitName = 'weekly limit' |
| 313 | } else if (limits.rateLimitType === 'seven_day_opus') { |
| 314 | limitName = 'Opus limit' |
| 315 | } else if (limits.rateLimitType === 'seven_day_sonnet') { |
| 316 | const subscriptionType = getSubscriptionType() |
| 317 | const isProOrEnterprise = |
| 318 | subscriptionType === 'pro' || subscriptionType === 'enterprise' |
| 319 | // For pro and enterprise, Sonnet limit is the same as weekly |
| 320 | limitName = isProOrEnterprise ? 'weekly limit' : 'Sonnet limit' |
| 321 | } |
| 322 | |
| 323 | if (!limitName) { |
| 324 | return 'Now using extra usage' |
| 325 | } |
| 326 | |
| 327 | const resetMessage = resetTime |
| 328 | ? ` · Your ${limitName} resets ${resetTime}` |
| 329 | : '' |
| 330 | return `You're now using extra usage${resetMessage}` |
| 331 | } |
| 332 | |
| 333 | function formatLimitReachedText( |
| 334 | limit: string, |
no test coverage detected