()
| 1621 | * This mirrors the logic in apps/claude-ai `useIsOverageProvisioningAllowed` hook as closely as possible. |
| 1622 | */ |
| 1623 | export function isOverageProvisioningAllowed(): boolean { |
| 1624 | const accountInfo = getOauthAccountInfo() |
| 1625 | const billingType = accountInfo?.billingType |
| 1626 | |
| 1627 | // Must be a Claude subscriber with a supported subscription type |
| 1628 | if (!isClaudeAISubscriber() || !billingType) { |
| 1629 | return false |
| 1630 | } |
| 1631 | |
| 1632 | // only allow Stripe and mobile billing types to purchase extra usage |
| 1633 | if ( |
| 1634 | billingType !== 'stripe_subscription' && |
| 1635 | billingType !== 'stripe_subscription_contracted' && |
| 1636 | billingType !== 'apple_subscription' && |
| 1637 | billingType !== 'google_play_subscription' |
| 1638 | ) { |
| 1639 | return false |
| 1640 | } |
| 1641 | |
| 1642 | return true |
| 1643 | } |
| 1644 | |
| 1645 | // Returns whether the user has Opus access at all, regardless of whether they |
| 1646 | // are a subscriber or PayG. |
no test coverage detected