Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix: swetrix is unusable with a cancelled trial (none plan code)

Blue Mouse84424df7d281
diff --git a/backend/apps/cloud/src/alert/alert.controller.ts b/backend/apps/cloud/src/alert/alert.controller.ts
index a41334175..47de6a7a8 100644
--- a/backend/apps/cloud/src/alert/alert.controller.ts
+++ b/backend/apps/cloud/src/alert/alert.controller.ts
@@ -171,13 +171,6 @@ export class AlertController {
where: { project: { id: In(pids) } },
})
- if (user.planCode === PlanCode.none) {
- throw new HttpException(
- 'You cannot create new alerts due to no active subscription. Please upgrade your account plan to continue.',
- HttpStatus.PAYMENT_REQUIRED,
- )
- }
-
if (user.isAccountBillingSuspended) {
throw new HttpException(
'The account that owns this site is currently suspended, this is because of a billing issue. Please resolve the issue to continue.',
diff --git a/backend/apps/cloud/src/auth/guards/api-key-rate-limit.guard.ts b/backend/apps/cloud/src/auth/guards/api-key-rate-limit.guard.ts
index ce42eb2b2..5d360462f 100644
--- a/backend/apps/cloud/src/auth/guards/api-key-rate-limit.guard.ts
+++ b/backend/apps/cloud/src/auth/guards/api-key-rate-limit.guard.ts
@@ -1,6 +1,5 @@
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'
import { checkRateLimitForApiKey } from '../../common/utils'
-import { PlanCode } from '../../user/entities/user.entity'
@Injectable()
export class ApiKeyRateLimitGuard implements CanActivate {
@@ -12,9 +11,7 @@ export class ApiKeyRateLimitGuard implements CanActivate {
if (!user) return false
const reqAmount =
- user.planCode === PlanCode.none ||
- user.isAccountBillingSuspended ||
- user.dashboardBlockReason !== null
+ user.isAccountBillingSuspended || user.dashboardBlockReason !== null
? 0
: user.maxApiKeyRequestsPerHour
return checkRateLimitForApiKey(user.apiKey, reqAmount)
diff --git a/backend/apps/cloud/src/experiment/experiment.controller.ts b/backend/apps/cloud/src/experiment/experiment.controller.ts
index 52f230267..6fc8cbed2 100644
--- a/backend/apps/cloud/src/experiment/experiment.controller.ts
+++ b/backend/apps/cloud/src/experiment/experiment.controller.ts
@@ -34,7 +34,6 @@ import { DataSource } from 'typeorm'
import { UserService } from '../user/user.service'
import { ProjectService } from '../project/project.service'
import { AppLoggerService } from '../logger/logger.service'
-import { PlanCode } from '../user/entities/user.entity'
import {
AnalyticsService,
getLowestPossibleTimeBucket,
@@ -216,13 +215,6 @@ export class ExperimentController {
where: { project: { id: experimentDto.pid } },
})
- if (user.planCode === PlanCode.none) {
- throw new HttpException(
- 'You cannot create new experiments due to no active subscription. Please upgrade your account plan to continue.',
- HttpStatus.PAYMENT_REQUIRED,
- )
- }
-
if (user.isAccountBillingSuspended) {
throw new HttpException(
'The account that owns this site is currently suspended, this is because of a billing issue. Please resolve the issue to continue.',
diff --git a/backend/apps/cloud/src/feature-flag/feature-flag.controller.ts b/backend/apps/cloud/src/feature-flag/feature-flag.controller.ts
index c1c42b5c1..1626e2ab1 100644
--- a/backend/apps/cloud/src/feature-flag/feature-flag.controller.ts
+++ b/backend/apps/cloud/src/feature-flag/feature-flag.controller.ts
@@ -31,7 +31,6 @@ import _round from 'lodash/round'
import { UserService } from '../user/user.service'
import { ProjectService } from '../project/project.service'
import { AppLoggerService } from '../logger/logger.service'
-import { PlanCode } from '../user/entities/user.entity'
import {
AnalyticsService,
getLowestPossibleTimeBucket,
@@ -191,13 +190,6 @@ export class FeatureFlagController {
where: { project: { id: flagDto.pid } },
})
- if (user.planCode === PlanCode.none) {
- throw new HttpException(
- 'You cannot create new feature flags due to no active subscription. Please upgrade your account plan to continue.',
- HttpStatus.PAYMENT_REQUIRED,
- )
- }
-
if (user.isAccountBillingSuspended) {
throw new HttpException(
'The account that owns this site is currently suspended, this is because of a billing issue. Please resolve the issue to continue.',
diff --git a/backend/apps/cloud/src/goal/goal.controller.ts b/backend/apps/cloud/src/goal/goal.controller.ts
index 657554968..5b9b2dd8e 100644
--- a/backend/apps/cloud/src/goal/goal.controller.ts
+++ b/backend/apps/cloud/src/goal/goal.controller.ts
@@ -27,7 +27,6 @@ import dayjs from 'dayjs'
import { UserService } from '../user/user.service'
import { ProjectService } from '../project/project.service'
import { AppLoggerService } from '../logger/logger.service'
-import { PlanCode } from '../user/entities/user.entity'
import {
AnalyticsService,
getLowestPossibleTimeBucket,
@@ -201,13 +200,6 @@ export class GoalController {
where: { project: { id: goalDto.pid } },
})
- if (user.planCode === PlanCode.none) {
- throw new HttpException(
- 'You cannot create new goals due to no active subscription. Please upgrade your account plan to continue.',
- HttpStatus.PAYMENT_REQUIRED,
- )
- }
-
if (user.isAccountBillingSuspended) {
throw new HttpException(
'The account that owns this site is currently suspended, this is because of a billing issue. Please resolve the issue to continue.',
diff --git a/backend/apps/cloud/src/project/project.controller.ts b/backend/apps/cloud/src/project/project.controller.ts
index e747db54c..d76bea41d 100644
--- a/backend/apps/cloud/src/project/project.controller.ts
+++ b/backend/apps/cloud/src/project/project.controller.ts
@@ -56,7 +56,6 @@ import {
LEGAL_PID_CHARACTERS,
PID_LENGTH,
} from './project.service'
-import { PlanCode } from '../user/entities/user.entity'
import { ActionTokenType } from '../action-tokens/action-token.entity'
import { ActionTokensService } from '../action-tokens/action-tokens.service'
import { MailerService } from '../mailer/mailer.service'
@@ -334,13 +333,6 @@ export class ProjectController {
)
}
- if (user.planCode === PlanCode.none) {
- throw new HttpException(
- 'You cannot create new projects due to no active subscription. Please upgrade your account plan to continue.',
- HttpStatus.PAYMENT_REQUIRED,
- )
- }
-
if (user.isAccountBillingSuspended) {
throw new HttpException(
'This account is currently suspended, this is because of a billing issue. Please resolve the issue to continue.',
@@ -426,13 +418,6 @@ export class ProjectController {
throw new ForbiddenException('Please, verify your email address first')
}
- if (user.planCode === PlanCode.none) {
- throw new HttpException(
- 'You cannot create new funnels due to no active subscription. Please upgrade your account plan to continue.',
- HttpStatus.PAYMENT_REQUIRED,
- )
- }
-
if (user.isAccountBillingSuspended) {
throw new HttpException(
'This account is currently suspended, this is because of a billing issue. Please resolve the issue to continue.',
@@ -482,13 +467,6 @@ export class ProjectController {
throw new ForbiddenException('Please, verify your email address first')
}
- if (user.planCode === PlanCode.none) {
- throw new HttpException(
- 'You cannot update funnels due to no active subscription. Please upgrade your account plan to continue.',
- HttpStatus.PAYMENT_REQUIRED,
- )
- }
-
if (user.isAccountBillingSuspended) {
throw new HttpException(
'This account is currently suspended, this is because of a billing issue. Please resolve the issue to continue.',
diff --git a/backend/apps/cloud/src/user/entities/user.entity.ts b/backend/apps/cloud/src/user/entities/user.entity.ts
index dc7c7e7f7..f19bb20a4 100644
--- a/backend/apps/cloud/src/user/entities/user.entity.ts
+++ b/backend/apps/cloud/src/user/entities/user.entity.ts
@@ -49,8 +49,8 @@ interface PlanSignature {
export const ACCOUNT_PLANS = {
[PlanCode.none]: {
id: PlanCode.none,
- monthlyUsageLimit: 0,
- maxAlerts: 0,
+ monthlyUsageLimit: 10000000,
+ maxAlerts: 50,
pid: null,
ypid: null,
},
diff --git a/web/app/components/Header/index.tsx b/web/app/components/Header/index.tsx
index 283db84aa..ba351f247 100644
--- a/web/app/components/Header/index.tsx
+++ b/web/app/components/Header/index.tsx
@@ -1010,7 +1010,6 @@ const Header = ({ refPage, transparent }: HeaderProps) => {
) : null}
{!isSelfhosted &&
isAuthenticated &&
- user?.planCode !== 'none' &&
user?.planCode !== 'trial' ? (
<Link
to={routes.billing}
diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.ts
index a199ebc01..f4c17bbeb 100644
--- a/web/app/lib/constants/index.ts
+++ b/web/app/lib/constants/index.ts
@@ -560,7 +560,7 @@ export const PLAN_LIMITS = {
none: {
index: 0, // 'downgrade' or 'upgrade' logic depends on this
planCode: 'none',
- monthlyUsageLimit: 0,
+ monthlyUsageLimit: 10000000,
legacy: false,
price: {
USD: {
@@ -576,7 +576,7 @@ export const PLAN_LIMITS = {
yearly: 0,
},
},
- maxAlerts: 0,
+ maxAlerts: 50,
},
free: {
index: 0, // 'downgrade' or 'upgrade' logic depends on this
diff --git a/web/app/routes/dashboard.tsx b/web/app/routes/dashboard.tsx
index 20f6332bc..d41f4c47e 100644
--- a/web/app/routes/dashboard.tsx
+++ b/web/app/routes/dashboard.tsx
@@ -8,7 +8,6 @@ import { data, redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
import { getAuthenticatedUser, serverFetch } from '~/api/api.server'
-import { isSelfhosted } from '~/lib/constants'
import { Project } from '~/lib/models/Project'
import Dashboard from '~/pages/Dashboard'
import { getDescription, getPreviewImage, getTitle } from '~/utils/seo'
@@ -208,15 +207,6 @@ export async function loader({ request }: LoaderFunctionArgs) {
return redirect('/onboarding')
}
- if (!isSelfhosted && user && (!user.planCode || user.planCode === 'none')) {
- if (authCookies.length > 0) {
- return redirect('/checkout', {
- headers: createHeadersWithCookies(authCookies),
- })
- }
- return redirect('/checkout')
- }
-
const url = new URL(request.url)
const page = parseInt(url.searchParams.get('page') || '1', 10)
const pageSize = parseInt(url.searchParams.get('pageSize') || '12', 10)
diff --git a/web/app/utils/auth.ts b/web/app/utils/auth.ts
index d8b0825b6..bfee99c38 100644
--- a/web/app/utils/auth.ts
+++ b/web/app/utils/auth.ts
@@ -17,10 +17,6 @@ export const decidePostAuthRedirect = (user: {
return routes.onboarding
}
- if (!isSelfhosted && (!user.planCode || user.planCode === 'none')) {
- return routes.checkout
- }
-
return routes.dashboard
}