Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add agent upload entitlement helpers

Richie McIlroyf5aca4614477
diff --git a/apps/web/lib/agent-upload-entitlement.ts b/apps/web/lib/agent-upload-entitlement.ts
new file mode 100644
index 000000000..bd37a8a04
--- /dev/null
+++ b/apps/web/lib/agent-upload-entitlement.ts
@@ -0,0 +1,31 @@
+import { Video } from "@cap/web-domain";
+
+export function isAgentUploadAllowedForPlan({
+ durationSeconds,
+ isPro,
+}: {
+ durationSeconds: number | undefined;
+ isPro: boolean;
+}) {
+ return (
+ isPro ||
+ (durationSeconds !== undefined &&
+ durationSeconds >= 0 &&
+ durationSeconds <= Video.FREE_PLAN_MAX_RECORDING_SECONDS)
+ );
+}
+
+export function isAgentUploadAllowedForMeasuredDuration({
+ durationSeconds,
+ isPro,
+}: {
+ durationSeconds: number;
+ isPro: boolean;
+}) {
+ return (
+ isPro ||
+ (Number.isFinite(durationSeconds) &&
+ durationSeconds > 0 &&
+ durationSeconds <= Video.FREE_PLAN_MAX_RECORDING_SECONDS)
+ );
+}