From f28bb9b82a84a6fd5ed3cf31d3c9f90e9a780243 Mon Sep 17 00:00:00 2001 From: Shubham Palriwala Date: Fri, 15 Dec 2023 18:40:46 +0530 Subject: [PATCH] fix: checks for free limit reached (#1786) --- apps/web/app/api/v1/(legacy)/js/sync/lib/sync.ts | 4 ++-- .../v1/client/[environmentId]/in-app/sync/[userId]/route.ts | 2 +- .../app/api/v1/client/[environmentId]/storage/local/route.ts | 2 +- apps/web/app/api/v1/client/[environmentId]/storage/route.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/web/app/api/v1/(legacy)/js/sync/lib/sync.ts b/apps/web/app/api/v1/(legacy)/js/sync/lib/sync.ts index 9be022354b..d1ceaa2702 100644 --- a/apps/web/app/api/v1/(legacy)/js/sync/lib/sync.ts +++ b/apps/web/app/api/v1/(legacy)/js/sync/lib/sync.ts @@ -51,7 +51,7 @@ export const getUpdatedState = async (environmentId: string, personId?: string): if (IS_FORMBRICKS_CLOUD) { const hasUserTargetingSubscription = team?.billing?.features.userTargeting.status && - team?.billing?.features.userTargeting.status in ["active", "canceled"]; + ["active", "canceled"].includes(team?.billing?.features.userTargeting.status); const currentMau = await getMonthlyActiveTeamPeopleCount(team.id); const isMauLimitReached = !hasUserTargetingSubscription && currentMau >= PRICING_USERTARGETING_FREE_MTU; if (isMauLimitReached) { @@ -80,7 +80,7 @@ export const getUpdatedState = async (environmentId: string, personId?: string): if (IS_FORMBRICKS_CLOUD) { const hasAppSurveySubscription = team?.billing?.features.inAppSurvey.status && - team?.billing?.features.inAppSurvey.status in ["active", "canceled"]; + ["active", "canceled"].includes(team?.billing?.features.inAppSurvey.status); const monthlyResponsesCount = await getMonthlyTeamResponseCount(team.id); isAppSurveyLimitReached = IS_FORMBRICKS_CLOUD && diff --git a/apps/web/app/api/v1/client/[environmentId]/in-app/sync/[userId]/route.ts b/apps/web/app/api/v1/client/[environmentId]/in-app/sync/[userId]/route.ts index bab2425643..e8fe273a0f 100644 --- a/apps/web/app/api/v1/client/[environmentId]/in-app/sync/[userId]/route.ts +++ b/apps/web/app/api/v1/client/[environmentId]/in-app/sync/[userId]/route.ts @@ -67,7 +67,7 @@ export async function GET( } const hasUserTargetingSubscription = team?.billing?.features.userTargeting.status && - team?.billing?.features.userTargeting.status in ["active", "canceled"]; + ["active", "canceled"].includes(team?.billing?.features.userTargeting.status); const currentMau = await getMonthlyActiveTeamPeopleCount(team.id); isMauLimitReached = !hasUserTargetingSubscription && currentMau >= PRICING_USERTARGETING_FREE_MTU; } diff --git a/apps/web/app/api/v1/client/[environmentId]/storage/local/route.ts b/apps/web/app/api/v1/client/[environmentId]/storage/local/route.ts index 3b3433f4bc..dea62e7675 100644 --- a/apps/web/app/api/v1/client/[environmentId]/storage/local/route.ts +++ b/apps/web/app/api/v1/client/[environmentId]/storage/local/route.ts @@ -106,7 +106,7 @@ export async function POST(req: NextRequest, context: Context): Promise