This commit is contained in:
pandeymangg
2024-05-06 16:52:57 +05:30
parent e1dae1bd98
commit 2839e49ccb
3 changed files with 8 additions and 17 deletions

View File

@@ -1,3 +1,4 @@
import { getIsEnterpriseEdition } from "@formbricks/ee/lib/service";
import { PRICING_APPSURVEYS_FREE_RESPONSES, PRICING_USERTARGETING_FREE_MTU } from "@formbricks/lib/constants";
import {
getMonthlyActiveTeamPeopleCount,
@@ -19,6 +20,9 @@ export default async function BillingPage({ params }) {
getMonthlyTeamResponseCount(team.id),
]);
const isEnterpriseEdition = await getIsEnterpriseEdition();
console.log("GETTING IS ENTERPRISE EDITION: ", isEnterpriseEdition);
return (
<>
<div>

View File

@@ -63,6 +63,7 @@ export const getIsEnterpriseEdition = async (): Promise<boolean> => {
},
});
console.log("CALLING LICENSE CHECK \n\n");
const res = await fetch("https://ee.formbricks.com/api/licenses/check", {
body: JSON.stringify({
licenseKey: ENTERPRISE_LICENSE_KEY,
@@ -72,6 +73,9 @@ export const getIsEnterpriseEdition = async (): Promise<boolean> => {
method: "POST",
});
console.log("RESPONSE: ", res);
console.log("\n\n\n");
if (res.ok) {
const responseJson = await res.json();
return responseJson.data.status === "active";

View File

@@ -1,17 +0,0 @@
import { ENTERPRISE_LICENSE_KEY, IS_FORMBRICKS_CLOUD } from "../constants";
import { getTeam } from "../team/service";
export const getIsEnterpriseEdition = (): boolean => {
if (ENTERPRISE_LICENSE_KEY) {
return ENTERPRISE_LICENSE_KEY.length > 0;
}
return false;
};
export const getMultiLanguagePermission = async (teamId: string): Promise<boolean> => {
const team = await getTeam(teamId);
if (!team) return false;
if (IS_FORMBRICKS_CLOUD) return team.billing.features.inAppSurvey.status !== "inactive";
else if (!IS_FORMBRICKS_CLOUD) return getIsEnterpriseEdition();
else return false;
};