gergo/web 2428 academia should be free business (#3831)

* feat(server): workspace shoul equal unpaid business

* feat(server): add free workspace plans

* feat(gatekeeper): rename plans to invoiced
This commit is contained in:
Gergő Jedlicska
2025-01-16 10:21:59 +01:00
committed by GitHub
parent ef0c800ba5
commit 35bc6918cb
7 changed files with 41 additions and 5 deletions
@@ -62,6 +62,9 @@ enum WorkspacePlans {
business
unlimited
academia
starterInvoiced
plusInvoiced
businessInvoiced
}
enum WorkspacePlanStatuses {
@@ -4537,8 +4537,11 @@ export enum WorkspacePlanStatuses {
export enum WorkspacePlans {
Academia = 'academia',
Business = 'business',
BusinessInvoiced = 'businessInvoiced',
Plus = 'plus',
PlusInvoiced = 'plusInvoiced',
Starter = 'starter',
StarterInvoiced = 'starterInvoiced',
Unlimited = 'unlimited'
}
@@ -4518,8 +4518,11 @@ export enum WorkspacePlanStatuses {
export enum WorkspacePlans {
Academia = 'academia',
Business = 'business',
BusinessInvoiced = 'businessInvoiced',
Plus = 'plus',
PlusInvoiced = 'plusInvoiced',
Starter = 'starter',
StarterInvoiced = 'starterInvoiced',
Unlimited = 'unlimited'
}
@@ -90,7 +90,10 @@ export type PaidWorkspacePlans = z.infer<typeof paidWorkspacePlans>
// these are not publicly exposed for general use on billing enabled servers
export const unpaidWorkspacePlans = z.union([
z.literal('unlimited'),
z.literal('academia')
z.literal('academia'),
z.literal('starterInvoiced'),
z.literal('plusInvoiced'),
z.literal('businessInvoiced')
])
export type UnpaidWorkspacePlans = z.infer<typeof unpaidWorkspacePlans>
@@ -156,9 +159,9 @@ const academia: WorkspacePlanFeaturesAndLimits = {
name: 'academia',
description: 'The academia plan',
oidcSso: true,
workspaceDataRegionSpecificity: false,
automateMinutes: null,
uploadSize: 100
workspaceDataRegionSpecificity: true,
automateMinutes: 900,
uploadSize: 1000
}
const paidWorkspacePlanFeatures: Record<
@@ -175,7 +178,10 @@ export const unpaidWorkspacePlanFeatures: Record<
WorkspacePlanFeaturesAndLimits
> = {
academia,
unlimited
unlimited,
starterInvoiced: starter,
plusInvoiced: plus,
businessInvoiced: business
}
export const workspacePlanFeatures: Record<
@@ -81,6 +81,9 @@ export const handleSubscriptionUpdateFactory =
break
case 'unlimited':
case 'academia':
case 'starterInvoiced':
case 'plusInvoiced':
case 'businessInvoiced':
throw new WorkspacePlanMismatchError()
default:
throwUncoveredError(workspacePlan)
@@ -131,6 +134,9 @@ export const addWorkspaceSubscriptionSeatIfNeededFactory =
break
case 'unlimited':
case 'academia':
case 'starterInvoiced':
case 'plusInvoiced':
case 'businessInvoiced':
throw new WorkspacePlanMismatchError()
default:
throwUncoveredError(workspacePlan)
@@ -261,6 +267,9 @@ export const downscaleWorkspaceSubscriptionFactory =
break
case 'unlimited':
case 'academia':
case 'starterInvoiced':
case 'plusInvoiced':
case 'businessInvoiced':
throw new WorkspacePlanMismatchError()
default:
throwUncoveredError(workspacePlan)
@@ -373,6 +382,9 @@ export const upgradeWorkspaceSubscriptionFactory =
switch (workspacePlan.name) {
case 'unlimited':
case 'academia':
case 'starterInvoiced':
case 'plusInvoiced':
case 'businessInvoiced':
throw new WorkspaceNotPaidPlanError()
case 'starter':
case 'plus':
@@ -484,6 +484,9 @@ export = FF_WORKSPACES_MODULE_ENABLED
case WorkspacePlans.Academia:
case WorkspacePlans.Unlimited:
case WorkspacePlans.StarterInvoiced:
case WorkspacePlans.PlusInvoiced:
case WorkspacePlans.BusinessInvoiced:
switch (status) {
case WorkspacePlanStatuses.Valid:
await upsertUnpaidWorkspacePlanFactory({ db })({
@@ -565,6 +568,9 @@ export = FF_WORKSPACES_MODULE_ENABLED
}
case 'unlimited':
case 'academia':
case 'starterInvoiced':
case 'plusInvoiced':
case 'businessInvoiced':
break
default:
throwUncoveredError(workspacePlan)
@@ -4519,8 +4519,11 @@ export enum WorkspacePlanStatuses {
export enum WorkspacePlans {
Academia = 'academia',
Business = 'business',
BusinessInvoiced = 'businessInvoiced',
Plus = 'plus',
PlusInvoiced = 'plusInvoiced',
Starter = 'starter',
StarterInvoiced = 'starterInvoiced',
Unlimited = 'unlimited'
}