Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: limit dataroom to business
Marc Seitz94c9651223d4
diff --git a/components/Sidebar.tsx b/components/Sidebar.tsxindex 6bde33eb..b507c560 100644--- a/components/Sidebar.tsx+++ b/components/Sidebar.tsx@@ -109,7 +109,7 @@ export const SidebarComponent = ({ className }: { className?: string }) => {icon: ServerIcon,current: router.pathname.includes("datarooms"),active: false,- disabled: false,+ disabled: userPlan === "business" ? false : true,},{name: "Branding",@@ -239,7 +239,7 @@ export const SidebarComponent = ({ className }: { className?: string }) => {{userPlan === "trial" && session ? (<Banner session={session} />) : null}- {userPlan === "pro" && null}+ {(userPlan === "pro" || userPlan === "business") && null}{userPlan === "free" && showProBanner ? (<ProBanner setShowProBanner={setShowProBanner} />) : null}diff --git a/lib/swr/use-billing.ts b/lib/swr/use-billing.tsindex ba1f4568..a8e74621 100644--- a/lib/swr/use-billing.ts+++ b/lib/swr/use-billing.ts@@ -34,15 +34,15 @@ export function useBilling() {}interface PlanResponse {- plan: "free" | "starter" | "pro" | "trial";+ plan: "free" | "starter" | "pro" | "trial" | "business";}export function usePlan() {const teamInfo = useTeam();+ const teamId = teamInfo?.currentTeam?.id;const { data: plan, error } = useSWR<PlanResponse>(- teamInfo?.currentTeam?.id &&- `/api/teams/${teamInfo?.currentTeam?.id}/billing/plan`,+ teamId && `/api/teams/${teamId}/billing/plan`,fetcher,{dedupingInterval: 60000,diff --git a/pages/api/teams/[teamId]/datarooms/index.ts b/pages/api/teams/[teamId]/datarooms/index.tsindex 38aec7cc..0262fe96 100644--- a/pages/api/teams/[teamId]/datarooms/index.ts+++ b/pages/api/teams/[teamId]/datarooms/index.ts@@ -71,6 +71,10 @@ export default async function handle(const team = await prisma.team.findUnique({where: {id: teamId,+ plan: {+ // exclude all teams not on `business` plan+ in: ["business"],+ },users: {some: {userId: userId,