New features: - HLS video encoding/streaming (hls routes, hls-encoder) and a media transcripts pipeline (transcripts route + media-transcript queries) - AI assistant chat vs. run model: agent-course-generation worker/queue, run-monitor pane, chat-changes card, content ask-ai bar - Per-theme course-page previews across org landing-page themes (bold, classic, corporate, editorial, etc.) with a shared course token/component set - View-as-student mode and login-link / link-invite invite flows Refactor: - Extract packages/core consolidating config (env, storage, dashboard-url), services and utils previously duplicated under apps/api/src/config - Remove legacy agent service modules (chat-tools, chat-context, context-window, document, fetch-url, lesson-content) - Relax Cross-Origin-Resource-Policy to allow cross-origin media embedding - Add format script to tenant-router so turbo run format covers it
34 lines
913 B
TypeScript
34 lines
913 B
TypeScript
import { PLAN } from '../plans/constants';
|
|
import { LICENSE_FEATURE, type LicenseFeatureId } from './constants';
|
|
|
|
type OrgPlan = {
|
|
planName: string | null;
|
|
isActive: boolean | null;
|
|
};
|
|
|
|
export function getActivePlanName(plans: OrgPlan[] | undefined | null): string | null {
|
|
const activePlan = plans?.find((plan) => plan.isActive);
|
|
|
|
return activePlan?.planName ?? null;
|
|
}
|
|
|
|
/**
|
|
* Maps a cloud organization plan to dashboard license feature IDs.
|
|
* Self-hosted instances use instance-level license keys instead.
|
|
*/
|
|
export function getLicenseFeaturesForPlan(planName: string | null | undefined): LicenseFeatureId[] {
|
|
if (!planName || planName === PLAN.BASIC) {
|
|
return [];
|
|
}
|
|
|
|
if (planName === PLAN.EARLY_ADOPTER) {
|
|
return [LICENSE_FEATURE.CUSTOM_DOMAIN, LICENSE_FEATURE.CUSTOM_BRANDING];
|
|
}
|
|
|
|
if (planName === PLAN.ENTERPRISE) {
|
|
return Object.values(LICENSE_FEATURE);
|
|
}
|
|
|
|
return [];
|
|
}
|