()
| 1689 | * This mirrors the logic in apps/claude-ai `useIsOverageProvisioningAllowed` hook as closely as possible. |
| 1690 | */ |
| 1691 | export function isOverageProvisioningAllowed(): boolean { |
| 1692 | const accountInfo = getOauthAccountInfo() |
| 1693 | const billingType = accountInfo?.billingType |
| 1694 | |
| 1695 | // Must be a Claude subscriber with a supported subscription type |
| 1696 | if (!isClaudeAISubscriber() || !billingType) { |
| 1697 | return false |
| 1698 | } |
| 1699 | |
| 1700 | // only allow Stripe and mobile billing types to purchase extra usage |
| 1701 | if ( |
| 1702 | billingType !== 'stripe_subscription' && |
| 1703 | billingType !== 'stripe_subscription_contracted' && |
| 1704 | billingType !== 'apple_subscription' && |
| 1705 | billingType !== 'google_play_subscription' |
| 1706 | ) { |
| 1707 | return false |
| 1708 | } |
| 1709 | |
| 1710 | return true |
| 1711 | } |
| 1712 | |
| 1713 | // Returns whether the user has Opus access at all, regardless of whether they |
| 1714 | // are a subscriber or PayG. |
no test coverage detected