mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 18:30:32 -06:00
fix: checks for free limit reached (#1786)
This commit is contained in:
committed by
GitHub
parent
8dd67ec484
commit
f28bb9b82a
@@ -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 &&
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ export async function POST(req: NextRequest, context: Context): Promise<NextResp
|
||||
}
|
||||
|
||||
try {
|
||||
const plan = team.billing.features.linkSurvey.status in ["active", "canceled"] ? "pro" : "free";
|
||||
const plan = ["active", "canceled"].includes(team.billing.features.linkSurvey.status) ? "pro" : "free";
|
||||
const bytes = await file.arrayBuffer();
|
||||
const fileBuffer = Buffer.from(bytes);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ export async function POST(req: NextRequest, context: Context): Promise<NextResp
|
||||
return responses.notFoundResponse("TeamByEnvironmentId", environmentId);
|
||||
}
|
||||
|
||||
const plan = team.billing.features.linkSurvey.status in ["active", "canceled"] ? "pro" : "free";
|
||||
const plan = ["active", "canceled"].includes(team.billing.features.linkSurvey.status) ? "pro" : "free";
|
||||
|
||||
return await uploadPrivateFile(fileName, environmentId, fileType, plan);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user