bf80347abf
* feat(workspaces): delete workspace emit event * feat(workspaces): move workspace group metrics to the backend * Removed FE mixpanel group update * Remove fragment * test(gatekeeper): add unittest to new gatekeeper service --------- Co-authored-by: Mike Tasset <mike.tasset@gmail.com>
159 lines
3.6 KiB
TypeScript
159 lines
3.6 KiB
TypeScript
import {
|
|
PaidWorkspacePlans,
|
|
UnpaidWorkspacePlans,
|
|
WorkspacePlans
|
|
} from '@/modules/gatekeeperCore/domain/billing'
|
|
import type { MaybeNullOrUndefined } from '@speckle/shared'
|
|
|
|
export type WorkspaceFeatureName =
|
|
| 'workspace'
|
|
| 'domainBasedSecurityPolicies'
|
|
| 'oidcSso'
|
|
| 'workspaceDataRegionSpecificity'
|
|
|
|
type FeatureDetails = {
|
|
displayName: string
|
|
description?: string
|
|
}
|
|
|
|
const features: Record<WorkspaceFeatureName, FeatureDetails> = {
|
|
workspace: {
|
|
displayName: 'Workspace'
|
|
},
|
|
domainBasedSecurityPolicies: {
|
|
description: 'Email domain based security policies',
|
|
displayName: 'Domain security policies'
|
|
},
|
|
oidcSso: {
|
|
displayName: 'Login / signup to the workspace with an OIDC provider'
|
|
},
|
|
workspaceDataRegionSpecificity: {
|
|
displayName: 'Specify the geolocation, where the workspace project data is stored'
|
|
}
|
|
} as const
|
|
|
|
type WorkspaceFeatures = Record<keyof typeof features, boolean>
|
|
|
|
type WorkspaceInfoDetails = {
|
|
name: MaybeNullOrUndefined<WorkspacePlans>
|
|
description: MaybeNullOrUndefined<string>
|
|
}
|
|
|
|
const info: WorkspaceInfoDetails = {
|
|
name: null,
|
|
description: null
|
|
}
|
|
|
|
type WorkspaceInfo = Record<keyof typeof info, MaybeNullOrUndefined<string>>
|
|
|
|
type Limits = 'uploadSize' | 'automateMinutes'
|
|
|
|
type LimitDetails = {
|
|
displayName: string
|
|
measurementUnit: string | null
|
|
}
|
|
|
|
const limits: Record<Limits, LimitDetails> = {
|
|
automateMinutes: {
|
|
displayName: 'Automate minutes',
|
|
measurementUnit: 'minutes'
|
|
},
|
|
uploadSize: {
|
|
displayName: 'Upload size limit',
|
|
measurementUnit: 'MB'
|
|
}
|
|
}
|
|
|
|
export const workspacePricingPlanInformation = { features, limits }
|
|
|
|
type WorkspaceLimits = Record<keyof typeof limits, number | null>
|
|
|
|
type WorkspacePlanFeaturesAndLimits = WorkspaceInfo &
|
|
WorkspaceFeatures &
|
|
WorkspaceLimits
|
|
|
|
const baseFeatures = {
|
|
domainBasedSecurityPolicies: true,
|
|
workspace: true
|
|
}
|
|
|
|
const starter: WorkspacePlanFeaturesAndLimits = {
|
|
...baseFeatures,
|
|
name: 'starter',
|
|
description: 'The team plan',
|
|
oidcSso: false,
|
|
workspaceDataRegionSpecificity: false,
|
|
automateMinutes: 300,
|
|
uploadSize: 500
|
|
}
|
|
|
|
const plus: WorkspacePlanFeaturesAndLimits = {
|
|
...baseFeatures,
|
|
name: 'plus',
|
|
description: 'The pro plan',
|
|
oidcSso: true,
|
|
workspaceDataRegionSpecificity: false,
|
|
automateMinutes: 900,
|
|
uploadSize: 1000
|
|
}
|
|
|
|
const business: WorkspacePlanFeaturesAndLimits = {
|
|
...baseFeatures,
|
|
name: 'business',
|
|
description: 'The business plan',
|
|
oidcSso: true,
|
|
workspaceDataRegionSpecificity: true,
|
|
automateMinutes: 900,
|
|
uploadSize: 1000
|
|
}
|
|
|
|
const unlimited: WorkspacePlanFeaturesAndLimits = {
|
|
...baseFeatures,
|
|
name: 'unlimited',
|
|
description: 'The unlimited plan',
|
|
oidcSso: true,
|
|
workspaceDataRegionSpecificity: true,
|
|
automateMinutes: null,
|
|
uploadSize: 1000
|
|
}
|
|
|
|
const academia: WorkspacePlanFeaturesAndLimits = {
|
|
...baseFeatures,
|
|
name: 'academia',
|
|
description: 'The academia plan',
|
|
oidcSso: true,
|
|
workspaceDataRegionSpecificity: true,
|
|
automateMinutes: 900,
|
|
uploadSize: 1000
|
|
}
|
|
|
|
const paidWorkspacePlanFeatures: Record<
|
|
PaidWorkspacePlans,
|
|
WorkspacePlanFeaturesAndLimits
|
|
> = {
|
|
starter,
|
|
plus,
|
|
business
|
|
}
|
|
|
|
export const unpaidWorkspacePlanFeatures: Record<
|
|
UnpaidWorkspacePlans,
|
|
WorkspacePlanFeaturesAndLimits
|
|
> = {
|
|
academia,
|
|
unlimited,
|
|
starterInvoiced: starter,
|
|
plusInvoiced: plus,
|
|
businessInvoiced: business
|
|
}
|
|
|
|
export const workspacePlanFeatures: Record<
|
|
WorkspacePlans,
|
|
WorkspacePlanFeaturesAndLimits
|
|
> = { ...paidWorkspacePlanFeatures, ...unpaidWorkspacePlanFeatures }
|
|
|
|
export const pricingTable = {
|
|
workspacePricingPlanInformation,
|
|
workspacePlanInformation: paidWorkspacePlanFeatures
|
|
}
|