mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 05:00:06 +02:00

Update "thanks for subscribing page" with AI Assist links GitOrigin-RevId: 41a23d6fd5edfc8f9ad0f97e513e1ea66aed5bdc
32 lines
No EOL
1.1 KiB
TypeScript
32 lines
No EOL
1.1 KiB
TypeScript
import { PaidSubscription } from "../../../../../types/subscription/dashboard/subscription"
|
|
import { PendingPaymentProviderPlan } from "../../../../../types/subscription/plan"
|
|
|
|
export const AI_ASSIST_STANDALONE_MONTHLY_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 = "AI Assist"
|
|
export const AI_ASSIST_STANDALONE_ANNUAL_PLAN_CODE = 'assistant-annual'
|
|
|
|
export function isStandaloneAiPlanCode(planCode?: string) {
|
|
return planCode === AI_ASSIST_STANDALONE_MONTHLY_PLAN_CODE || planCode === AI_ASSIST_STANDALONE_ANNUAL_PLAN_CODE
|
|
}
|
|
|
|
|
|
|
|
export function hasPendingAiAddonCancellation(subscription: PaidSubscription){
|
|
|
|
const pendingPlan = subscription.pendingPlan as PendingPaymentProviderPlan
|
|
|
|
const hasAiAddon = subscription.addOns?.some(
|
|
addOn => addOn.addOnCode === AI_ADD_ON_CODE
|
|
)
|
|
|
|
// cancellation of entire plan counts as removing the add-on
|
|
if(hasAiAddon && !pendingPlan){
|
|
return true
|
|
}
|
|
|
|
return hasAiAddon &&
|
|
!pendingPlan.addOns?.some(addOn => addOn.code === AI_ADD_ON_CODE)
|
|
|
|
} |