32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
|
|
/**
|
|||
|
|
* Render quality policy (monetization gate).
|
|||
|
|
*
|
|||
|
|
* Free plan → 360p only, watermarked preview.
|
|||
|
|
* Pro/Business → every resolution (540p–4K), no watermark.
|
|||
|
|
*
|
|||
|
|
* (AI-generated videos will have NO free preview at all — pay/credits before the
|
|||
|
|
* result is shown. That rule belongs in the AI-video feature when it's built;
|
|||
|
|
* this module covers the normal template render flow.)
|
|||
|
|
*/
|
|||
|
|
import type { PlanId } from "@/lib/plans";
|
|||
|
|
import type { RenderSettings } from "@/lib/render-schemas";
|
|||
|
|
|
|||
|
|
export type Resolution = RenderSettings["resolution"]; // "360p" | "540p" | "720p" | "1080p" | "4K"
|
|||
|
|
|
|||
|
|
export const FREE_RESOLUTION: Resolution = "360p";
|
|||
|
|
export const ALL_RESOLUTIONS: Resolution[] = ["360p", "540p", "720p", "1080p", "4K"];
|
|||
|
|
|
|||
|
|
/** Resolutions a plan may render at. Free = 360p only; any paid plan = all. */
|
|||
|
|
export function allowedResolutions(plan: PlanId): Resolution[] {
|
|||
|
|
return plan === "free" ? [FREE_RESOLUTION] : ALL_RESOLUTIONS;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export function isResolutionAllowed(plan: PlanId, res: Resolution): boolean {
|
|||
|
|
return allowedResolutions(plan).includes(res);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** Free renders get a watermarked preview; paid plans get clean output. */
|
|||
|
|
export function isWatermarked(plan: PlanId): boolean {
|
|||
|
|
return plan === "free";
|
|||
|
|
}
|