mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Cleanup AiErrorAssistant todos post plans changes (#35067)
* feat: cleaning up ai quota leftovers fix: removing more straggler invos * fix: featureUpdater still need analyticsId in the user projection * feat: updating cypress tests to also check for fair usage text GitOrigin-RevId: 09c1167106c144084c111beea56867f6aa4a0906
This commit is contained in:
committed by
Copybot
parent
275d381656
commit
ba76fda37b
@@ -2,7 +2,6 @@ import { useEffect } from 'react'
|
||||
import Notification from '@/shared/components/notification'
|
||||
import PaywallUpgradeButton from '@/shared/components/paywall-upgrade-button'
|
||||
import { useEditorContext } from '@/shared/context/editor-context'
|
||||
import { useUserFeaturesContext } from '@/shared/context/user-features-context'
|
||||
import { useEditorAnalytics } from '@/shared/hooks/use-editor-analytics'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { formatSecondsToHoursAndMinutes } from '@/shared/utils/time'
|
||||
@@ -10,8 +9,6 @@ import getMeta from '@/utils/meta'
|
||||
import { AiFeatureLocations } from './types/ai'
|
||||
import { paywallTypeByLocation } from '../utils/ai-features'
|
||||
|
||||
const hasUnlimitedAi = getMeta('ol-hasUnlimitedAi')
|
||||
|
||||
function AiPaywallNotification({
|
||||
isActionBelowContent = false,
|
||||
featureLocation,
|
||||
@@ -26,7 +23,6 @@ function AiPaywallNotification({
|
||||
premiumSuggestionResetDate,
|
||||
} = useEditorContext()
|
||||
|
||||
const features = useUserFeaturesContext()
|
||||
const user = getMeta('ol-user')
|
||||
|
||||
const isCommons = user.hasInstitutionLicence
|
||||
@@ -36,8 +32,7 @@ function AiPaywallNotification({
|
||||
return null
|
||||
}
|
||||
|
||||
// todo: quota clean-up: remove once we are transitioned off aiErrorAssistant naming and replace with just hasUnlimitedAi, also remove null FF check
|
||||
const hasAddOn = hasUnlimitedAi || Boolean(features?.aiErrorAssistant)
|
||||
const hasAddOn = getMeta('ol-hasUnlimitedAi')
|
||||
|
||||
// error assist only needs usage quota
|
||||
const canUseErrorAssist = hasSuggestionsLeft
|
||||
|
||||
@@ -34,12 +34,7 @@ export const UserFeaturesProvider: FC<React.PropsWithChildren> = ({
|
||||
|
||||
useEffect(() => {
|
||||
const listener = async ({ isPremium }: { isPremium: boolean }) => {
|
||||
// todo: quota clean-up: remove once we are transitioned off aiErrorAssistant naming
|
||||
const hasPremiumQuota = hasUnlimitedAi
|
||||
const alreadyPremium =
|
||||
features?.aiErrorAssistant === isPremium ||
|
||||
hasPremiumQuota === isPremium
|
||||
if (alreadyPremium) {
|
||||
if (hasUnlimitedAi === isPremium) {
|
||||
// the user is premium on writefull and has the AI assist, no need to refresh the features
|
||||
return
|
||||
}
|
||||
@@ -55,7 +50,7 @@ export const UserFeaturesProvider: FC<React.PropsWithChildren> = ({
|
||||
listener
|
||||
)
|
||||
}
|
||||
}, [features?.aiErrorAssistant, writefullInstance])
|
||||
}, [writefullInstance])
|
||||
|
||||
return (
|
||||
<UserFeaturesContext.Provider value={features}>
|
||||
|
||||
Reference in New Issue
Block a user