72ecb9197b
* feat(gatekeeper): intoduce the enterprise plan * chore(server): remove more "magic strings" * test(shared): fix plan tests with enterprise case * Small change to format plan name --------- Co-authored-by: Mike Tasset <mike.tasset@gmail.com>
25 lines
690 B
TypeScript
25 lines
690 B
TypeScript
import { WorkspacePlans } from '@speckle/shared'
|
|
|
|
const WorkspacePlansUpgradeMapping: Record<WorkspacePlans, WorkspacePlans[]> = {
|
|
academia: [],
|
|
unlimited: [],
|
|
free: ['team', 'teamUnlimited', 'pro', 'proUnlimited'],
|
|
team: ['team', 'teamUnlimited', 'pro', 'proUnlimited'],
|
|
teamUnlimited: ['teamUnlimited', 'pro', 'proUnlimited'],
|
|
teamUnlimitedInvoiced: [],
|
|
pro: ['pro', 'proUnlimited'],
|
|
proUnlimited: ['proUnlimited'],
|
|
proUnlimitedInvoiced: [],
|
|
enterprise: []
|
|
}
|
|
|
|
export const isUpgradeWorkspacePlanValid = ({
|
|
current,
|
|
upgrade
|
|
}: {
|
|
current: WorkspacePlans
|
|
upgrade: WorkspacePlans
|
|
}): boolean => {
|
|
return WorkspacePlansUpgradeMapping[current].includes(upgrade)
|
|
}
|