mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #36140 from overleaf/mg-ai-usage-limit-show
Add 'ai-usage-limit-show' event for ai limits GitOrigin-RevId: 887ecc8b3fea52bcd45cf771ab0d22b8f4539308
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import getMeta from '@/utils/meta'
|
||||
import { AiFeatureLocations, PaywallType } from '../components/types/ai'
|
||||
|
||||
export const paywallTypeByLocation: Record<AiFeatureLocations, PaywallType> = {
|
||||
@@ -5,3 +6,24 @@ export const paywallTypeByLocation: Record<AiFeatureLocations, PaywallType> = {
|
||||
errorAssist: 'assistant',
|
||||
citationsReviewer: 'citations-reviewer',
|
||||
}
|
||||
|
||||
// Returns the plan type for a limit with no upgrade path, or null when an
|
||||
// upgrade is offered. Membership is checked before quota so commons/group users
|
||||
// with unlimited AI aren't reported as individual; group before commons matches
|
||||
// the rendered paywall's precedence for users who are in both.
|
||||
export function getAiPlanTypeWithoutUpgrade(
|
||||
hasUnlimitedQuota: boolean
|
||||
): 'commons' | 'group' | 'individual' | null {
|
||||
const { hasInstitutionLicence, isMemberOfGroupSubscription } =
|
||||
getMeta('ol-user')
|
||||
if (isMemberOfGroupSubscription) {
|
||||
return 'group'
|
||||
}
|
||||
if (hasInstitutionLicence) {
|
||||
return 'commons'
|
||||
}
|
||||
if (hasUnlimitedQuota) {
|
||||
return 'individual'
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user