Unlock features without credits/Stripe, point docs to docs.songs2vid.com, and drop leftover billing admin surfaces. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { Plan } from "@prisma/client";
|
|
import type { LayoutSettings } from "./layout";
|
|
import {
|
|
PREMIUM_REQUIRED_CODE,
|
|
type WatermarkSettings,
|
|
} from "./watermark";
|
|
|
|
export class PremiumRequiredError extends Error {
|
|
readonly code = PREMIUM_REQUIRED_CODE;
|
|
readonly status = 403;
|
|
constructor(message: string) {
|
|
super(message);
|
|
this.name = "PremiumRequiredError";
|
|
}
|
|
}
|
|
|
|
/** OSS: all watermark / typography features unlocked. */
|
|
export function assertCustomWatermarkAllowed(_plan: Plan, _settings: WatermarkSettings) {
|
|
return;
|
|
}
|
|
|
|
/** OSS: all art-track layout features unlocked. */
|
|
export function assertArtTrackLayoutAllowed(_plan: Plan, _settings: LayoutSettings) {
|
|
return;
|
|
}
|
|
|
|
/** OSS: per-track cover images always allowed. */
|
|
export function assertPerItemImagesAllowed(
|
|
_plan: Plan,
|
|
_sharedImagePath: string,
|
|
_itemImagePaths: Array<string | null | undefined>,
|
|
) {
|
|
return;
|
|
}
|
|
|
|
export function premiumRequiredResponse(message: string) {
|
|
return {
|
|
error: message,
|
|
code: PREMIUM_REQUIRED_CODE,
|
|
};
|
|
}
|