Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Propagate unlimited website entitlement through subscription checks
Mike Cao0c0a3aee6555
diff --git a/src/app/api/auth/verify/route.ts b/src/app/api/auth/verify/route.tsindex 526e8c9f8..01c049fb6 100644--- a/src/app/api/auth/verify/route.ts+++ b/src/app/api/auth/verify/route.ts@@ -22,6 +22,7 @@ export async function POST(request: Request) {isBusiness: account.isBusiness || false,isNoBilling: account.isNoBilling || false,hasSubscription: account.hasSubscription || false,+ unlimitedWebsites: account.unlimitedWebsites || false,};}@@ -36,6 +37,7 @@ export async function POST(request: Request) {isBusiness: teamAccount.isBusiness || false,isNoBilling: teamAccount.isNoBilling || false,hasSubscription: teamAccount.hasSubscription || false,+ unlimitedWebsites: teamAccount.unlimitedWebsites || false,}: null,};diff --git a/src/app/api/teams/route.ts b/src/app/api/teams/route.tsindex 43fe235d8..0e81b3340 100644--- a/src/app/api/teams/route.ts+++ b/src/app/api/teams/route.ts@@ -70,6 +70,7 @@ export async function POST(request: Request) {isBusiness: account.isBusiness || false,isNoBilling: account.isNoBilling || false,hasSubscription: account.hasSubscription || false,+ unlimitedWebsites: account.unlimitedWebsites || false,},60 * 60 * 24 * 90,);diff --git a/src/components/hooks/useSubscription.ts b/src/components/hooks/useSubscription.tsindex 8e77f5b48..9ab287224 100644--- a/src/components/hooks/useSubscription.ts+++ b/src/components/hooks/useSubscription.ts@@ -6,6 +6,7 @@ export interface Subscription {isBusiness: boolean;isNoBilling: boolean;hasSubscription: boolean;+ unlimitedWebsites: boolean;}const FEATURES = {@@ -19,6 +20,7 @@ const defaultSubscription: Subscription = {isBusiness: false,isNoBilling: false,hasSubscription: false,+ unlimitedWebsites: false,};export function useSubscription(teamId?: string | null) {diff --git a/src/lib/subscription.test.ts b/src/lib/subscription.test.tsindex 6d754fc73..5ddd124be 100644--- a/src/lib/subscription.test.ts+++ b/src/lib/subscription.test.ts@@ -28,4 +28,18 @@ describe('getCloudWebsiteLimit', () => {expect(getCloudWebsiteLimit({ hasSubscription: true, isBusiness: true })).toBeNull();expect(getCloudWebsiteLimit({ hasSubscription: true, isNoBilling: true })).toBeNull();});++ // Team-owned websites pass the team cache object (derived from the team owner's account)+ // through this same function, so members inherit the owner's unlimitedWebsites entitlement.+ test('does not limit teams that inherit unlimited websites from a subscribed owner', () => {+ expect(+ getCloudWebsiteLimit({ hasSubscription: true, isPro: true, unlimitedWebsites: true }),+ ).toBeNull();+ });++ test('still limits teams whose owner has no subscription even if unlimited websites is set', () => {+ expect(+ getCloudWebsiteLimit({ hasSubscription: false, unlimitedWebsites: true }),+ ).toBe(CLOUD_FREE_WEBSITE_LIMIT);+ });});