mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-13 21:53:43 +01:00
Merge pull request #22163 from overleaf/em-subscription-page-ai-add-on
Adapt the Your plan entry on the subscription page to groups and Commons GitOrigin-RevId: 7352a90d2489de48d2711f2b8a364cdd5bb54eeb
This commit is contained in:
+27
-8
@@ -14,7 +14,6 @@ import { PendingRecurlyPlan } from '../../../../../../../../types/subscription/p
|
||||
import {
|
||||
ADD_ON_NAME,
|
||||
AI_ADD_ON_CODE,
|
||||
AI_STANDALONE_PLAN_NAME,
|
||||
isStandaloneAiPlanCode,
|
||||
} from '../../../../data/add-on-codes'
|
||||
import { CancelSubscriptionButton } from './cancel-subscription-button'
|
||||
@@ -27,12 +26,36 @@ export function ActiveAiAddonSubscription({
|
||||
subscription: RecurlySubscription
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const { recurlyLoadError, showCancellation, setModalIdShown } =
|
||||
useSubscriptionDashboardContext()
|
||||
const {
|
||||
recurlyLoadError,
|
||||
showCancellation,
|
||||
setModalIdShown,
|
||||
memberGroupSubscriptions,
|
||||
institutionMemberships,
|
||||
} = useSubscriptionDashboardContext()
|
||||
if (showCancellation) return <CancelSubscription />
|
||||
|
||||
const onStandalonePlan = isStandaloneAiPlanCode(subscription.planCode)
|
||||
|
||||
let planName
|
||||
if (onStandalonePlan) {
|
||||
planName = 'Overleaf Free'
|
||||
if (institutionMemberships && institutionMemberships.length > 0) {
|
||||
planName = 'Overleaf Professional'
|
||||
}
|
||||
if (memberGroupSubscriptions.length > 0) {
|
||||
if (
|
||||
memberGroupSubscriptions.some(s => s.planLevelName === 'Professional')
|
||||
) {
|
||||
planName = 'Overleaf Professional'
|
||||
} else {
|
||||
planName = 'Overleaf Standard'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
planName = subscription.plan.name
|
||||
}
|
||||
|
||||
const handlePlanChange = () => setModalIdShown('change-plan')
|
||||
|
||||
const handleCancelClick = () => setModalIdShown('cancel-ai-add-on')
|
||||
@@ -42,11 +65,7 @@ export function ActiveAiAddonSubscription({
|
||||
<p className="mb-0">
|
||||
<Trans
|
||||
i18nKey="your_plan_is"
|
||||
values={{
|
||||
planName: onStandalonePlan
|
||||
? AI_STANDALONE_PLAN_NAME
|
||||
: subscription.plan.name,
|
||||
}}
|
||||
values={{ planName }}
|
||||
shouldUnescape
|
||||
tOptions={{ interpolation: { escapeValue: true } }}
|
||||
components={{ strong: <strong /> }}
|
||||
|
||||
@@ -2,7 +2,6 @@ export const AI_STANDALONE_PLAN_CODE = 'assistant'
|
||||
export const AI_ADD_ON_CODE = 'assistant'
|
||||
// we dont want translations on plan or add-on names
|
||||
export const ADD_ON_NAME = "Error Assist"
|
||||
export const AI_STANDALONE_PLAN_NAME = "Overleaf Free"
|
||||
export const AI_STANDALONE_ANNUAL_PLAN_CODE = 'assistant-annual'
|
||||
|
||||
export function isStandaloneAiPlanCode(planCode: string) {
|
||||
|
||||
Reference in New Issue
Block a user