Files
speckle-server/packages/server/modules/gatekeeperCore/domain/events.ts
T
Daniel Gak Anagrov a4ab20c938 feat(activity): add workspace billing events and seats to activity (#4944)
* feat: improved gatekeeper eventsfor workspace history
* feat: userId on seat assign
* feat: record workspace seat events
* feat: workspace removals as activity
* feat: emit role and seat events on create workspace
* fix: reordered events for workspace creation
2025-06-30 16:49:36 +02:00

39 lines
1.3 KiB
TypeScript

import { BillingInterval } from '@/modules/cross-server-sync/graph/generated/graphql'
import { WorkspacePlan } from '@speckle/shared'
export const gatekeeperEventNamespace = 'gatekeeper' as const
const eventPrefix = `${gatekeeperEventNamespace}.` as const
export const GatekeeperEvents = {
WorkspaceTrialExpired: `${eventPrefix}workspace-trial-expired`,
WorkspacePlanCreated: `${eventPrefix}workspace-plan-created`,
WorkspacePlanUpdated: `${eventPrefix}workspace-plan-updated`,
WorkspaceSubscriptionUpdated: `${eventPrefix}workspace-subscription-updated`
} as const
export type SubscriptionState = {
totalEditorSeats: number
billingInterval: BillingInterval
}
export type GatekeeperEventPayloads = {
[GatekeeperEvents.WorkspaceTrialExpired]: { workspaceId: string }
[GatekeeperEvents.WorkspacePlanCreated]: {
userId: string
workspacePlan: WorkspacePlan
}
[GatekeeperEvents.WorkspacePlanUpdated]: {
userId: string | null
workspacePlan: WorkspacePlan
previousWorkspacePlan: WorkspacePlan
}
[GatekeeperEvents.WorkspaceSubscriptionUpdated]: {
userId: string | null
workspacePlan: WorkspacePlan
subscription: SubscriptionState
previousWorkspacePlan: WorkspacePlan
previousSubscription: SubscriptionState | null
}
}