Skip to content

armgit / umami

Public Imported from GitHub
0

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.

Allow unlimited cloud websites for subscribed accounts

Mike Caod2eafd68f7b8
diff --git a/src/lib/subscription.test.ts b/src/lib/subscription.test.ts
index 323abf101..6d754fc73 100644
--- a/src/lib/subscription.test.ts
+++ b/src/lib/subscription.test.ts
@@ -9,6 +9,13 @@ describe('getCloudWebsiteLimit', () => {
test('limits accounts without a subscription to the free website limit', () => {
expect(getCloudWebsiteLimit(null)).toBe(CLOUD_FREE_WEBSITE_LIMIT);
expect(getCloudWebsiteLimit({ hasSubscription: false })).toBe(CLOUD_FREE_WEBSITE_LIMIT);
+ expect(getCloudWebsiteLimit({ hasSubscription: false, unlimitedWebsites: true })).toBe(
+ CLOUD_FREE_WEBSITE_LIMIT,
+ );
+ });
+
+ test('does not limit subscribed accounts with unlimited websites enabled', () => {
+ expect(getCloudWebsiteLimit({ hasSubscription: true, unlimitedWebsites: true })).toBeNull();
});
test('limits Pro accounts to the Pro website limit', () => {
diff --git a/src/lib/subscription.ts b/src/lib/subscription.ts
index b793ac5f6..c93b4d8bc 100644
--- a/src/lib/subscription.ts
+++ b/src/lib/subscription.ts
@@ -3,6 +3,7 @@ export interface SubscriptionAccount {
isBusiness?: boolean | null;
isNoBilling?: boolean | null;
hasSubscription?: boolean | null;
+ unlimitedWebsites?: boolean | null;
}
export const CLOUD_FREE_WEBSITE_LIMIT = 3;
@@ -13,6 +14,10 @@ export function getCloudWebsiteLimit(account?: SubscriptionAccount | null): numb
return CLOUD_FREE_WEBSITE_LIMIT;
}
+ if (account.unlimitedWebsites) {
+ return null;
+ }
+
if (account.isNoBilling || account.isBusiness) {
return null;
}