Merge pull request #21898 from overleaf/em-ai-add-on-checkout-page

Adapt checkout page to standalone AI add-on

GitOrigin-RevId: ed877bc10c1dd4362c981000e0d783e370f3593a
This commit is contained in:
Eric Mc Sween 2024-11-18 10:22:29 -05:00 committed by Copybot
parent b617266c6d
commit 34fa1e12e7
6 changed files with 13 additions and 19 deletions

View file

@ -66,6 +66,7 @@
"add_company_details": "",
"add_email_address": "",
"add_email_to_claim_features": "",
"add_error_assist_to_your_projects": "",
"add_files": "",
"add_more_collaborators": "",
"add_more_editors": "",

View file

@ -7,11 +7,7 @@ import { ExpiredSubscription } from './states/expired'
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
import PersonalSubscriptionRecurlySyncEmail from './personal-subscription-recurly-sync-email'
import OLNotification from '@/features/ui/components/ol/ol-notification'
import {
AI_STANDALONE_PLAN_CODE,
AI_STANDALONE_ANNUAL_PLAN_CODE,
AI_ADD_ON_CODE,
} from '../../data/add-on-codes'
import { isStandaloneAiPlanCode, AI_ADD_ON_CODE } from '../../data/add-on-codes'
function PastDueSubscriptionAlert({
subscription,
@ -50,11 +46,7 @@ function PersonalSubscriptionStates({
addOn => addOn.addOnCode === AI_ADD_ON_CODE
)
const onAiStandalonePlan = [
AI_STANDALONE_PLAN_CODE,
AI_STANDALONE_ANNUAL_PLAN_CODE,
].includes(subscription.planCode)
const onAiStandalonePlan = isStandaloneAiPlanCode(subscription.planCode)
const planHasAi = onAiStandalonePlan || hasAiAddon
if (state === 'active' && planHasAi) {

View file

@ -15,8 +15,7 @@ import {
ADD_ON_NAME,
AI_ADD_ON_CODE,
AI_STANDALONE_PLAN_NAME,
AI_STANDALONE_PLAN_CODE,
AI_STANDALONE_ANNUAL_PLAN_CODE,
isStandaloneAiPlanCode,
} from '../../../../data/add-on-codes'
import { CancelSubscriptionButton } from './cancel-subscription-button'
@ -32,10 +31,7 @@ export function ActiveAiAddonSubscription({
useSubscriptionDashboardContext()
if (showCancellation) return <CancelSubscription />
const onStandalonePlan = [
AI_STANDALONE_PLAN_CODE,
AI_STANDALONE_ANNUAL_PLAN_CODE,
].includes(subscription.planCode)
const onStandalonePlan = isStandaloneAiPlanCode(subscription.planCode)
const handlePlanChange = () => setModalIdShown('change-plan')

View file

@ -14,8 +14,8 @@ import OLButton from '@/features/ui/components/ol/ol-button'
import OLNotification from '@/features/ui/components/ol/ol-notification'
import {
AI_ADD_ON_CODE,
AI_STANDALONE_PLAN_CODE,
ADD_ON_NAME,
isStandaloneAiPlanCode,
} from '../../../../../../data/add-on-codes'
import {
cancelSubscriptionUrl,
@ -33,7 +33,7 @@ export function CancelAiAddOnModal() {
if (!personalSubscription) return null
const onStandalone = personalSubscription.planCode === AI_STANDALONE_PLAN_CODE
const onStandalone = isStandaloneAiPlanCode(personalSubscription.planCode)
const cancellationEndpoint = onStandalone
? cancelSubscriptionUrl

View file

@ -3,4 +3,8 @@ 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 const AI_STANDALONE_ANNUAL_PLAN_CODE = 'assistant-annual'
export function isStandaloneAiPlanCode(planCode: string) {
return planCode === AI_STANDALONE_PLAN_CODE || planCode === AI_STANDALONE_ANNUAL_PLAN_CODE
}

View file

@ -78,6 +78,7 @@
"add_email": "Add Email",
"add_email_address": "Add email address",
"add_email_to_claim_features": "Add an institutional email address to claim your features.",
"add_error_assist_to_your_projects": "Add Error Assist to your projects and get AI help to fix LaTeX errors faster.",
"add_files": "Add Files",
"add_more_collaborators": "Add more collaborators",
"add_more_editors": "Add more editors",