Files
speckle-server/packages/server/modules/gatekeeperCore/domain/billing.ts
T
Gergő Jedlicska f501cc4ad5 gergo/web 2888 workspace project cancreate (#4294)
* WIP can create project

* WIP can create project more work

* complete body, stencil tests

* feat(shared): move workspace plan types into shared

* test progress wip

* feat(shared): add more logic to canCreateWorkspaceProject

* a few more tests, as a treat

* chore(authz): round out tests

* fixed loaders, new GQL checks, dataLoaders in auth loaders

* fix(authz): get workspace limits loader

* chore(authz): update loaders

* frontend fixed up to snuff

* fix(authz): fix workspace plans for tests

* fix(authz): classic

* fix(authz): 0 counts

---------

Co-authored-by: Chuck Driesler <chuck@speckle.systems>
Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
2025-04-01 16:38:20 +01:00

40 lines
1010 B
TypeScript

import {
PaidWorkspacePlans,
WorkspacePlanBillingIntervals,
WorkspacePlans
} from '@speckle/shared'
import { OverrideProperties, SetOptional } from 'type-fest'
/**
* This includes the pricing plans (Stripe products) a customer can sub to
*/
export type WorkspacePricingProducts = PaidWorkspacePlans | 'guest'
type WorkspacePlanProductsMetadata<PriceData = string> = OverrideProperties<
Record<
WorkspacePricingProducts,
Record<WorkspacePlanBillingIntervals, PriceData> & {
productId: string
}
>,
{
// Team has no yearly plan
[PaidWorkspacePlans.Team]: {
productId: string
monthly: PriceData
}
}
>
export type WorkspacePlanProductAndPriceIds = SetOptional<
WorkspacePlanProductsMetadata<string>,
typeof WorkspacePlans.Team | typeof WorkspacePlans.Pro
>
export type WorkspacePlanProductPrices = SetOptional<
WorkspacePlanProductsMetadata<{
amount: number
currency: string
}>,
typeof WorkspacePlans.Team | typeof WorkspacePlans.Pro
>