@speckle/shared
Version:
Shared code between various Speckle JS packages
132 lines • 5.72 kB
TypeScript
import { WorkspaceRoles } from '../../core/constants.js';
import { WorkspaceLimits } from './limits.js';
import { PaidWorkspacePlans, UnpaidWorkspacePlans, WorkspacePlanBillingIntervals, WorkspacePlans } from './plans.js';
import type { MaybeNullOrUndefined } from '../../core/helpers/utilityTypes.js';
import { FeatureFlags } from '../../environment/featureFlags.js';
/**
* WORKSPACE FEATURES
*/
export declare const WorkspacePlanFeatures: {
readonly AutomateBeta: "automateBeta";
readonly DomainDiscoverability: "domainDiscoverability";
readonly DomainSecurity: "domainBasedSecurityPolicies";
readonly SSO: "oidcSso";
readonly CustomDataRegion: "workspaceDataRegionSpecificity";
readonly HideSpeckleBranding: "hideSpeckleBranding";
readonly ExclusiveMembership: "exclusiveMembership";
readonly EmbedPrivateProjects: "embedPrivateProjects";
readonly SavedViews: "savedViews";
};
export type WorkspacePlanFeatures = (typeof WorkspacePlanFeatures)[keyof typeof WorkspacePlanFeatures];
export declare const WorkspaceFeatureFlags: {
readonly none: 0;
readonly dashboards: 1;
readonly accIntegration: 2;
readonly presentations: 64;
};
export type WorkspaceFeatureFlags = (typeof WorkspaceFeatureFlags)[keyof typeof WorkspaceFeatureFlags];
export declare const isWorkspaceFeatureFlagOn: ({ workspaceFeatureFlags, feature }: {
workspaceFeatureFlags: number;
feature: WorkspaceFeatureFlags;
}) => boolean;
export type WorkspaceFeatures = WorkspacePlanFeatures | WorkspaceFeatureFlags;
export declare const WorkspacePlanFeaturesMetadata: {
readonly automateBeta: {
readonly displayName: "Automate beta access";
readonly description: "Run custom automations on every new model version";
};
readonly domainDiscoverability: {
readonly displayName: "Domain discoverability";
readonly description: "Allow people to discover your workspace if they use a verified company email";
};
readonly domainBasedSecurityPolicies: {
readonly displayName: "Domain protection";
readonly description: "Require workspace members to use a verified company email";
};
readonly oidcSso: {
readonly displayName: "Single Sign-On (SSO)";
readonly description: "Require workspace members to authenticate with your SSO provider";
};
readonly workspaceDataRegionSpecificity: {
readonly displayName: "Custom data residency";
readonly description: "Store your data in EU, UK, North America, or Asia Pacific";
};
readonly hideSpeckleBranding: {
readonly displayName: "Customised viewer";
readonly description: "Hide the Speckle branding in embedded viewer";
};
readonly exclusiveMembership: {
readonly displayName: "Exclusive workspace membership";
readonly description: "Members of exclusive workspaces cannot join or create other workspaces";
};
readonly embedPrivateProjects: {
readonly displayName: "Embed private projects";
readonly description: "Embed projects with visibility set to private or workspace";
};
readonly savedViews: {
readonly displayName: "Saved views";
readonly description: "Create and share saved views of your models";
};
};
/**
* PLAN CONFIG - PRICES & FEATURES
*/
export type WorkspacePlanPriceStructure = {
[interval in WorkspacePlanBillingIntervals]: {
[role in WorkspaceRoles]: number;
};
};
export type WorkspacePlanConfig<Plan extends WorkspacePlans = WorkspacePlans> = {
plan: Plan;
features: readonly WorkspacePlanFeatures[];
limits: WorkspaceLimits;
};
export declare const WorkspacePaidPlanConfigs: (params: {
featureFlags: Partial<FeatureFlags> | undefined;
}) => {
[plan in PaidWorkspacePlans]: WorkspacePlanConfig<plan>;
};
export declare const WorkspaceUnpaidPlanConfigs: (params: {
featureFlags: Partial<FeatureFlags> | undefined;
}) => {
[plan in UnpaidWorkspacePlans]: WorkspacePlanConfig<plan>;
};
export declare const WorkspacePlanConfigs: (params: {
featureFlags: Partial<FeatureFlags> | undefined;
}) => {
teamUnlimitedInvoiced: WorkspacePlanConfig<"teamUnlimitedInvoiced">;
proUnlimitedInvoiced: WorkspacePlanConfig<"proUnlimitedInvoiced">;
enterprise: WorkspacePlanConfig<"enterprise">;
unlimited: WorkspacePlanConfig<"unlimited">;
academia: WorkspacePlanConfig<"academia">;
free: WorkspacePlanConfig<"free">;
team: WorkspacePlanConfig<"team">;
teamUnlimited: WorkspacePlanConfig<"teamUnlimited">;
pro: WorkspacePlanConfig<"pro">;
proUnlimited: WorkspacePlanConfig<"proUnlimited">;
};
/**
* Checks if a workspace exceeds its plan limits for projects and models
*/
export declare const workspaceExceedsPlanLimit: (params: {
plan: MaybeNullOrUndefined<WorkspacePlans>;
projectCount: MaybeNullOrUndefined<number>;
modelCount: MaybeNullOrUndefined<number>;
featureFlags: Partial<FeatureFlags> | undefined;
}) => boolean;
/**
* Checks if a workspace reached its plan limits for projects and models
*/
export declare const workspaceReachedPlanLimit: (params: {
plan: MaybeNullOrUndefined<WorkspacePlans>;
projectCount: MaybeNullOrUndefined<number>;
modelCount: MaybeNullOrUndefined<number>;
featureFlags: Partial<FeatureFlags> | undefined;
}) => boolean;
export declare const workspacePlanHasAccessToFeature: ({ plan, feature, featureFlags }: {
plan: WorkspacePlans;
feature: WorkspacePlanFeatures;
featureFlags: Partial<FeatureFlags> | undefined;
}) => boolean;
export declare const isPlanFeature: (feature: WorkspaceFeatures) => feature is WorkspacePlanFeatures;
//# sourceMappingURL=features.d.ts.map