Removes team paywall for self-hosted (#7185)
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
This commit is contained in:
1 parent
4f99746f68
commit
a3b26cd1e7
3 files changed
+18
-10
No files matched your search
@@ -1,9 +1,9 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import { classNames } from "@calcom/lib";
|
||||
import { useHasPaidPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { IS_SELF_HOSTED } from "@calcom/lib/constants";
|
||||
import { useHasTeamPlan } from "@calcom/lib/hooks/useHasPaidPlan";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import isCalcom from "@calcom/lib/isCalcom";
|
||||
import { EmptyScreen } from "@calcom/ui";
|
||||
import { FiUsers } from "@calcom/ui/components/icon";
|
||||
|
||||
@@ -33,13 +33,13 @@ export function UpgradeTip({
|
||||
isParentLoading?: ReactNode;
|
||||
}) {
|
||||
const { t } = useLocale();
|
||||
const { isLoading, hasPaidPlan } = useHasPaidPlan();
|
||||
const { isLoading, hasTeamPlan } = useHasTeamPlan();
|
||||
|
||||
if (hasPaidPlan) return children;
|
||||
if (hasTeamPlan) return children;
|
||||
|
||||
if (isParentLoading || isLoading) return <>{isParentLoading}</>;
|
||||
|
||||
if (!isCalcom)
|
||||
if (IS_SELF_HOSTED)
|
||||
return (
|
||||
<EmptyScreen
|
||||
Icon={FiUsers}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
import { IS_SELF_HOSTED } from "../constants";
|
||||
import hasKeyInMetadata from "../hasKeyInMetadata";
|
||||
|
||||
export function useHasPaidPlan() {
|
||||
if (IS_SELF_HOSTED) return { isLoading: false, hasPaidPlan: true };
|
||||
|
||||
const { data: hasTeamPlan, isLoading: isLoadingTeamQuery } = trpc.viewer.teams.hasTeamPlan.useQuery();
|
||||
|
||||
const { data: user, isLoading: isLoadingUserQuery } = trpc.viewer.me.useQuery();
|
||||
@@ -22,4 +25,10 @@ export function useTeamInvites() {
|
||||
return { isLoading: listInvites.isLoading, listInvites: listInvites.data };
|
||||
}
|
||||
|
||||
export function useHasTeamPlan() {
|
||||
const { data: hasTeamPlan, isLoading } = trpc.viewer.teams.hasTeamPlan.useQuery();
|
||||
|
||||
return { isLoading, hasTeamPlan: hasTeamPlan?.hasTeamPlan };
|
||||
}
|
||||
|
||||
export default useHasPaidPlan;
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { Prisma, PrismaPromise } from "@prisma/client";
|
||||
import {
|
||||
Prisma,
|
||||
PrismaPromise,
|
||||
WorkflowTemplates,
|
||||
WorkflowActions,
|
||||
WorkflowTriggerEvents,
|
||||
@@ -32,11 +31,11 @@ import {
|
||||
verifyPhoneNumber,
|
||||
sendVerificationCode,
|
||||
} from "@calcom/features/ee/workflows/lib/reminders/verifyPhoneNumber";
|
||||
import { SENDER_ID } from "@calcom/lib/constants";
|
||||
import { IS_SELF_HOSTED, SENDER_ID } from "@calcom/lib/constants";
|
||||
import { SENDER_NAME } from "@calcom/lib/constants";
|
||||
// import { getErrorFromUnknown } from "@calcom/lib/errors";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { WorkflowStep } from "@calcom/prisma/client";
|
||||
import type { WorkflowStep } from "@calcom/prisma/client";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
@@ -1127,6 +1126,6 @@ action === WorkflowActions.EMAIL_ADDRESS*/
|
||||
getWorkflowActionOptions: authedProcedure.query(async ({ ctx }) => {
|
||||
const { hasTeamPlan } = await viewerTeamsRouter.createCaller(ctx).hasTeamPlan();
|
||||
const t = await getTranslation(ctx.user.locale, "common");
|
||||
return getWorkflowActionOptions(t, !!hasTeamPlan);
|
||||
return getWorkflowActionOptions(t, IS_SELF_HOSTED || !!hasTeamPlan);
|
||||
}),
|
||||
});
|
||||
Reference in new issue
Block a user