chore: bump @trpc/* and @tanstack/react-query (#13335)
Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Omar López <[email protected]> Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: zomars <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Benny Joo <[email protected]> Co-authored-by: Carina Wollendorfer <[email protected]> Co-authored-by: Gergő Móricz <[email protected]> Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
183 files changed
+1203
-1013
No files matched your search
@@ -3,7 +3,8 @@ import parser from "accept-language-parser";
|
||||
import type { GetServerSidePropsContext, NextApiRequest } from "next";
|
||||
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import type { Maybe } from "@calcom/trpc/server";
|
||||
|
||||
type Maybe<T> = T | null | undefined;
|
||||
|
||||
const { i18n } = require("@calcom/config/next-i18next.config");
|
||||
|
||||
|
||||
@@ -4,39 +4,39 @@ import { IS_SELF_HOSTED } from "../constants";
|
||||
import hasKeyInMetadata from "../hasKeyInMetadata";
|
||||
|
||||
export function useHasPaidPlan() {
|
||||
if (IS_SELF_HOSTED) return { isLoading: false, hasPaidPlan: true };
|
||||
if (IS_SELF_HOSTED) return { isPending: false, hasPaidPlan: true };
|
||||
|
||||
const { data: hasTeamPlan, isLoading: isLoadingTeamQuery } = trpc.viewer.teams.hasTeamPlan.useQuery();
|
||||
const { data: hasTeamPlan, isPending: isPendingTeamQuery } = trpc.viewer.teams.hasTeamPlan.useQuery();
|
||||
|
||||
const { data: user, isLoading: isLoadingUserQuery } = trpc.viewer.me.useQuery();
|
||||
const { data: user, isPending: isPendingUserQuery } = trpc.viewer.me.useQuery();
|
||||
|
||||
const isLoading = isLoadingTeamQuery || isLoadingUserQuery;
|
||||
const isPending = isPendingTeamQuery || isPendingUserQuery;
|
||||
|
||||
const isCurrentUsernamePremium =
|
||||
user && hasKeyInMetadata(user, "isPremium") ? !!user.metadata.isPremium : false;
|
||||
|
||||
const hasPaidPlan = hasTeamPlan?.hasTeamPlan || isCurrentUsernamePremium;
|
||||
|
||||
return { isLoading, hasPaidPlan };
|
||||
return { isPending, hasPaidPlan };
|
||||
}
|
||||
|
||||
export function useTeamInvites() {
|
||||
const listInvites = trpc.viewer.teams.listInvites.useQuery();
|
||||
|
||||
return { isLoading: listInvites.isLoading, listInvites: listInvites.data };
|
||||
return { isPending: listInvites.isPending, listInvites: listInvites.data };
|
||||
}
|
||||
|
||||
export function useHasTeamPlan() {
|
||||
const { data: hasTeamPlan, isLoading } = trpc.viewer.teams.hasTeamPlan.useQuery();
|
||||
const { data: hasTeamPlan, isPending } = trpc.viewer.teams.hasTeamPlan.useQuery();
|
||||
|
||||
return { isLoading, hasTeamPlan: hasTeamPlan?.hasTeamPlan };
|
||||
return { isPending, hasTeamPlan: hasTeamPlan?.hasTeamPlan };
|
||||
}
|
||||
|
||||
export function useHasEnterprisePlan() {
|
||||
// TODO: figure out how to get "has Enterprise / has Org" from the backend
|
||||
const { data: hasTeamPlan, isLoading } = trpc.viewer.teams.hasTeamPlan.useQuery();
|
||||
const { data: hasTeamPlan, isPending } = trpc.viewer.teams.hasTeamPlan.useQuery();
|
||||
|
||||
return { isLoading, hasTeamPlan: hasTeamPlan?.hasTeamPlan };
|
||||
return { isPending, hasTeamPlan: hasTeamPlan?.hasTeamPlan };
|
||||
}
|
||||
|
||||
export default useHasPaidPlan;
|
||||
Reference in new issue
Block a user