2026-06-06 20:17:49 +08:00
|
|
|
import {
|
|
|
|
|
ENTERPRISE_FEATURES,
|
|
|
|
|
type EnterpriseFeature,
|
|
|
|
|
type LicensePayload,
|
2026-06-13 16:20:24 +08:00
|
|
|
PLAN_FEATURES,
|
2026-06-06 20:17:49 +08:00
|
|
|
validateLicense,
|
|
|
|
|
} from "./license.js";
|
|
|
|
|
|
|
|
|
|
let activeLicense: LicensePayload | null = null;
|
|
|
|
|
|
|
|
|
|
export function initEnterprise(licenseKey: string | undefined): {
|
|
|
|
|
valid: boolean;
|
|
|
|
|
license: LicensePayload | null;
|
|
|
|
|
} {
|
|
|
|
|
if (!licenseKey) {
|
|
|
|
|
return { valid: false, license: null };
|
|
|
|
|
}
|
|
|
|
|
activeLicense = validateLicense(licenseKey);
|
|
|
|
|
return { valid: activeLicense !== null, license: activeLicense };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function isFeatureEnabled(feature: EnterpriseFeature): boolean {
|
|
|
|
|
if (!activeLicense) return false;
|
|
|
|
|
return activeLicense.features.includes(feature);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getActiveLicense(): LicensePayload | null {
|
|
|
|
|
return activeLicense;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-13 10:15:23 +08:00
|
|
|
export type S3StorageModule = typeof import("./storage-s3.js");
|
|
|
|
|
export async function loadS3Storage(): Promise<S3StorageModule> {
|
|
|
|
|
return import("./storage-s3.js");
|
|
|
|
|
}
|
2026-06-13 17:07:49 +08:00
|
|
|
export { ENTERPRISE_FEATURES, type EnterpriseFeature, type LicensePayload, PLAN_FEATURES };
|