Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(web): add AI generation entitlement helper
Richie McIlroy3f23a7c55742
diff --git a/apps/web/lib/ai-generation-entitlement.ts b/apps/web/lib/ai-generation-entitlement.tsnew file mode 100644index 000000000..58ac9361e--- /dev/null+++ b/apps/web/lib/ai-generation-entitlement.ts@@ -0,0 +1,21 @@+import { buildEnv } from "@cap/env";++export type AiGenerationEntitlementUser = {+ stripeSubscriptionStatus?: string | null;+ thirdPartyStripeSubscriptionId?: string | null;+};++export const isAiGenerationEnabledForUser = (+ user?: AiGenerationEntitlementUser | null,+) => {+ if (!buildEnv.NEXT_PUBLIC_IS_CAP) return true;+ if (!user) return false;+ if (user.thirdPartyStripeSubscriptionId) return true;++ return (+ user.stripeSubscriptionStatus === "active" ||+ user.stripeSubscriptionStatus === "trialing" ||+ user.stripeSubscriptionStatus === "complete" ||+ user.stripeSubscriptionStatus === "paid"+ );+};