()
| 1671 | * This mirrors the logic in apps/claude-ai `useIsOverageProvisioningAllowed` hook as closely as possible. |
| 1672 | */ |
| 1673 | export function isOverageProvisioningAllowed(): boolean { |
| 1674 | const accountInfo = getOauthAccountInfo() |
| 1675 | const billingType = accountInfo?.billingType |
| 1676 | |
| 1677 | // Must be a Claude subscriber with a supported subscription type |
| 1678 | if (!isClaudeAISubscriber() || !billingType) { |
| 1679 | return false |
| 1680 | } |
| 1681 | |
| 1682 | // only allow Stripe and mobile billing types to purchase extra usage |
| 1683 | if ( |
| 1684 | billingType !== 'stripe_subscription' && |
| 1685 | billingType !== 'stripe_subscription_contracted' && |
| 1686 | billingType !== 'apple_subscription' && |
| 1687 | billingType !== 'google_play_subscription' |
| 1688 | ) { |
| 1689 | return false |
| 1690 | } |
| 1691 | |
| 1692 | return true |
| 1693 | } |
| 1694 | |
| 1695 | // Returns whether the user has Opus access at all, regardless of whether they |
| 1696 | // are a subscriber or PayG. |
no test coverage detected