Merge pull request #21954 from overleaf/em-revert-ai-add-on-deploy

Revert faulty AI add-on deploy

GitOrigin-RevId: 923ec89f01d4951596f83fcf58b820c39db1e54a
This commit is contained in:
Eric Mc Sween
2024-11-19 09:05:27 +00:00
committed by Copybot
parent 27076c50cc
commit ab36c80a26
18 changed files with 89 additions and 445 deletions
@@ -66,7 +66,6 @@
"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": "",
@@ -1485,7 +1484,6 @@
"submit_title": "",
"subscribe": "",
"subscribe_to_find_the_symbols_you_need_faster": "",
"subscribe_to_plan": "",
"subscription": "",
"subscription_admins_cannot_be_deleted": "",
"subscription_canceled": "",
@@ -7,7 +7,11 @@ 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 { isStandaloneAiPlanCode, AI_ADD_ON_CODE } from '../../data/add-on-codes'
import {
AI_STANDALONE_PLAN_CODE,
AI_STANDALONE_ANNUAL_PLAN_CODE,
AI_ADD_ON_CODE,
} from '../../data/add-on-codes'
function PastDueSubscriptionAlert({
subscription,
@@ -46,7 +50,11 @@ function PersonalSubscriptionStates({
addOn => addOn.addOnCode === AI_ADD_ON_CODE
)
const onAiStandalonePlan = isStandaloneAiPlanCode(subscription.planCode)
const onAiStandalonePlan = [
AI_STANDALONE_PLAN_CODE,
AI_STANDALONE_ANNUAL_PLAN_CODE,
].includes(subscription.planCode)
const planHasAi = onAiStandalonePlan || hasAiAddon
if (state === 'active' && planHasAi) {
@@ -15,7 +15,8 @@ import {
ADD_ON_NAME,
AI_ADD_ON_CODE,
AI_STANDALONE_PLAN_NAME,
isStandaloneAiPlanCode,
AI_STANDALONE_PLAN_CODE,
AI_STANDALONE_ANNUAL_PLAN_CODE,
} from '../../../../data/add-on-codes'
import { CancelSubscriptionButton } from './cancel-subscription-button'
@@ -31,7 +32,10 @@ export function ActiveAiAddonSubscription({
useSubscriptionDashboardContext()
if (showCancellation) return <CancelSubscription />
const onStandalonePlan = isStandaloneAiPlanCode(subscription.planCode)
const onStandalonePlan = [
AI_STANDALONE_PLAN_CODE,
AI_STANDALONE_ANNUAL_PLAN_CODE,
].includes(subscription.planCode)
const handlePlanChange = () => setModalIdShown('change-plan')
@@ -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 = isStandaloneAiPlanCode(personalSubscription.planCode)
const onStandalone = personalSubscription.planCode === AI_STANDALONE_PLAN_CODE
const cancellationEndpoint = onStandalone
? cancelSubscriptionUrl
@@ -31,17 +31,13 @@ function PreviewSubscriptionChange() {
<Row>
<Col md={8} mdOffset={2}>
<div className="card p-5">
{preview.change.type === 'add-on-purchase' ? (
{preview.change.type === 'add-on-purchase' && (
<h1>
{t('add_add_on_to_your_plan', {
addOnName: preview.change.addOn.name,
})}
</h1>
) : preview.change.type === 'premium-subscription' ? (
<h1>
{t('subscribe_to_plan', { planName: preview.change.plan.name })}
</h1>
) : null}
)}
{payNowTask.isError && (
<Notification
@@ -115,11 +111,7 @@ function PreviewSubscriptionChange() {
)}
<Row className="mt-1">
<Col xs={9}>
{preview.nextPlan.annual
? t('total_per_year')
: t('total_per_month')}
</Col>
<Col xs={9}>{t('total_per_month')}</Col>
<Col xs={3} className="text-right">
{formatCurrencyLocalized(
preview.nextInvoice.total,
@@ -3,8 +3,4 @@ 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) {
return planCode === AI_STANDALONE_PLAN_CODE || planCode === AI_STANDALONE_ANNUAL_PLAN_CODE
}
export const AI_STANDALONE_ANNUAL_PLAN_CODE = 'assistant-annual'