mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 21:59:00 +02:00
54505437d4
Update checkout pages for AI Assist bundle content GitOrigin-RevId: e2e1b705dd92e0858835d18eb6d8c5750030e550
32 lines
1.1 KiB
TypeScript
32 lines
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 = "Error 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)
|
|
|
|
} |