Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: new plan
Iuliia Shnai91fda77369cb
diff --git a/components/billing/add-seat-modal.tsx b/components/billing/add-seat-modal.tsxindex fe6319cc..c3b17e9a 100644--- a/components/billing/add-seat-modal.tsx+++ b/components/billing/add-seat-modal.tsx@@ -1,3 +1,4 @@+import Link from "next/link";import { useRouter } from "next/router";import { useEffect, useState } from "react";@@ -180,10 +181,17 @@ export function AddSeatModal({)}</div>- <DialogFooter>+ <DialogFooter className="flex flex-col gap-2 sm:flex-col sm:justify-center"><Button onClick={handleSubmit} className="w-full" disabled={loading}>{loading ? "Redirecting..." : "Proceed to checkout"}</Button>+ <Link+ href="/settings/upgrade"+ className="block w-full text-center text-xs text-muted-foreground underline underline-offset-4 hover:text-foreground"+ onClick={() => setOpen(false)}+ >+ or upgrade to higher plan+ </Link></DialogFooter></DialogContent></Dialog>diff --git a/components/billing/upgrade-plan-container.tsx b/components/billing/upgrade-plan-container.tsxindex 089add8d..45c3c6dc 100644--- a/components/billing/upgrade-plan-container.tsx+++ b/components/billing/upgrade-plan-container.tsx@@ -45,6 +45,7 @@ export default function UpgradePlanContainer() {plan,isFree,isDataroomsPlus,+ isDataroomsPremium,isPaused,isCancelled,isCustomer,@@ -291,9 +292,11 @@ export default function UpgradePlanContainer() {<Card className="bg-transparent"><CardHeader><CardTitle>- {isDataroomsPlus- ? "Datarooms+"- : plan.charAt(0).toUpperCase() + plan.slice(1)}{" "}+ {isDataroomsPremium+ ? "Premium"+ : isDataroomsPlus+ ? "Datarooms+"+ : plan.charAt(0).toUpperCase() + plan.slice(1)}{" "}Plan</CardTitle>{!isCancelled && startsAt && endsAt && isBillingCycleCurrent() && (diff --git a/components/billing/upgrade-plan-modal.tsx b/components/billing/upgrade-plan-modal.tsxindex d73d7126..be40ac16 100644--- a/components/billing/upgrade-plan-modal.tsx+++ b/components/billing/upgrade-plan-modal.tsx@@ -96,38 +96,49 @@ const FeatureItem = ({ feature }: { feature: Feature }) => {);};-// Segmented control component for Base/Plus selection+// Segmented control component for Base/Plus/Premium selectionconst PlanSelector = ({value,onChange,}: {- value: boolean;- onChange: (value: boolean) => void;+ value: "base" | "plus" | "premium";+ onChange: (value: "base" | "plus" | "premium") => void;}) => {return (- <div className="mt-1 flex w-1/2 rounded-lg border border-gray-200 p-1">+ <div className="mt-1 flex w-full rounded-lg border border-gray-200 p-1"><buttonclassName={cn("flex-1 rounded-md px-3 py-1 text-sm transition-colors",- !value+ value === "base"? "bg-gray-300 text-foreground dark:bg-gray-600 dark:text-white": "text-gray-600 hover:text-gray-900 dark:text-muted-foreground dark:hover:text-white",)}- onClick={() => onChange(false)}+ onClick={() => onChange("base")}>Base</button><buttonclassName={cn("flex-1 rounded-md px-3 py-1 text-sm transition-colors",- value- ? "bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900"+ value === "plus"+ ? "bg-gray-800 text-white dark:bg-gray-200 dark:text-gray-900": "text-gray-600 hover:text-gray-900 dark:text-muted-foreground dark:hover:text-white",)}- onClick={() => onChange(true)}+ onClick={() => onChange("plus")}>Plus</button>+ <button+ className={cn(+ "flex-1 rounded-md px-3 py-1 text-sm transition-colors",+ value === "premium"+ ? "bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900"+ : "text-gray-600 hover:text-gray-900 dark:text-muted-foreground dark:hover:text-white",+ )}+ onClick={() => onChange("premium")}+ >+ Premium+ </button></div>);};@@ -154,7 +165,7 @@ export function UpgradePlanModal({const teamId = teamInfo?.currentTeam?.id;const { plan: teamPlan, isCustomer, isOldAccount, isTrial } = usePlan();const analytics = useAnalytics();- const [showDataRoomsPlus, setShowDataRoomsPlus] = useState(false);+ const [dataRoomsPlanSelection, setDataRoomsPlanSelection] = useState<"base" | "plus" | "premium">("base");const plansToShow = useMemo(() => {switch (clickedPlan) {@@ -165,7 +176,9 @@ export function UpgradePlanModal({case PlanEnum.DataRooms:return [PlanEnum.DataRooms, PlanEnum.DataRoomsPlus];case PlanEnum.DataRoomsPlus:- return [PlanEnum.DataRooms, PlanEnum.DataRoomsPlus];+ return [PlanEnum.DataRoomsPlus, PlanEnum.DataRoomsPremium];+ case PlanEnum.DataRoomsPremium:+ return [PlanEnum.DataRoomsPlus, PlanEnum.DataRoomsPremium];default:return [PlanEnum.Pro, PlanEnum.Business];}@@ -179,7 +192,7 @@ export function UpgradePlanModal({teamId,});} else {- setShowDataRoomsPlus(false);+ setDataRoomsPlanSelection("base");}}, [open, trigger]);@@ -222,20 +235,26 @@ export function UpgradePlanModal({<div className="isolate grid grid-cols-1 gap-4 overflow-hidden rounded-xl p-4 md:grid-cols-2">{plansToShow.map((planOption) => {- const planFeatures = getPlanFeatures(planOption, {+ const isDataRoomsUpgrade = plansToShow.includes(PlanEnum.DataRooms);++ // Determine which plan to show based on selection for Data Rooms+ let effectivePlan = planOption;+ let displayPlanName = planOption;++ if (planOption === PlanEnum.DataRooms && isDataRoomsUpgrade) {+ if (dataRoomsPlanSelection === "plus") {+ effectivePlan = PlanEnum.DataRoomsPlus;+ displayPlanName = PlanEnum.DataRoomsPlus;+ } else if (dataRoomsPlanSelection === "premium") {+ effectivePlan = PlanEnum.DataRoomsPremium;+ displayPlanName = PlanEnum.DataRoomsPremium;+ }+ }++ const planFeatures = getPlanFeatures(effectivePlan, {period,- showDataRoomsPlus:- planOption === PlanEnum.DataRooms && showDataRoomsPlus,});- // Get the effective plan name for display- const displayPlanName =- planOption === PlanEnum.DataRooms && showDataRoomsPlus- ? PlanEnum.DataRoomsPlus- : planOption;-- const isDataRoomsUpgrade = plansToShow.includes(PlanEnum.DataRooms);-return (<divkey={displayPlanName}@@ -251,7 +270,7 @@ export function UpgradePlanModal({<div className="mb-4 border-b border-gray-200 pb-2"><div className="flex items-center justify-between"><h3 className="text-balance text-xl font-medium text-gray-900 dark:text-white">- Papermark {displayPlanName}+ {displayPlanName}</h3></div><span@@ -259,7 +278,7 @@ export function UpgradePlanModal({"absolute right-2 top-2 rounded px-2 py-1 text-xs text-white",planOption === PlanEnum.Business && "bg-[#fb7a00]",displayPlanName === PlanEnum.DataRoomsPlus &&- "bg-gray-900 dark:bg-gray-100 dark:text-gray-900",+ "bg-gray-800 dark:bg-gray-200 dark:text-gray-900",)}>{planOption === PlanEnum.Business && "Most popular"}@@ -285,8 +304,8 @@ export function UpgradePlanModal({isDataRoomsUpgrade &&!plansToShow.includes(PlanEnum.DataRoomsPlus) && (<PlanSelector- value={showDataRoomsPlus}- onChange={setShowDataRoomsPlus}+ value={dataRoomsPlanSelection}+ onChange={setDataRoomsPlanSelection}/>)}@@ -315,7 +334,9 @@ export function UpgradePlanModal({className={`w-full py-2 text-sm ${planOption === PlanEnum.Business? "bg-[#fb7a00]/90 text-white hover:bg-[#fb7a00]"- : "bg-gray-800 text-white hover:bg-gray-900 hover:text-white dark:hover:bg-gray-700/80"+ : displayPlanName === PlanEnum.DataRoomsPremium+ ? "bg-gray-900 text-white hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200"+ : "bg-gray-800 text-white hover:bg-gray-900 hover:text-white dark:hover:bg-gray-700/80"}`}loading={selectedPlan === planOption}disabled={selectedPlan !== null}@@ -385,7 +406,13 @@ export function UpgradePlanModal({analytics.<div className="flex items-center gap-2"><Link- href="/settings/upgrade"+ href={`/settings/upgrade${+ clickedPlan === PlanEnum.Pro+ ? "?view=documents"+ : clickedPlan === PlanEnum.Business+ ? "?view=business-datarooms"+ : ""+ }`}className="underline underline-offset-4 hover:text-foreground">See all plansdiff --git a/components/sidebar/app-sidebar.tsx b/components/sidebar/app-sidebar.tsxindex 5b72d6f0..becd7b9a 100644--- a/components/sidebar/app-sidebar.tsx+++ b/components/sidebar/app-sidebar.tsx@@ -58,6 +58,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {isBusiness,isDatarooms,isDataroomsPlus,+ isDataroomsPremium,isFree,isTrial,} = usePlan();@@ -215,7 +216,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {</p><p className="ml-2 flex items-center text-2xl font-bold tracking-tighter text-black group-data-[collapsible=icon]:hidden dark:text-white"><Link href="/dashboard">Papermark</Link>- {userPlan && !isFree && !isDataroomsPlus ? (+ {userPlan && !isFree && !isDataroomsPlus && !isDataroomsPremium ? (<span className="ml-4 rounded-full bg-background px-2.5 py-1 text-xs tracking-normal text-foreground ring-1 ring-gray-800">{userPlan.charAt(0).toUpperCase() + userPlan.slice(1)}</span>@@ -225,6 +226,11 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {Datarooms+</span>) : null}+ {isDataroomsPremium ? (+ <span className="ml-4 rounded-full bg-background px-2.5 py-1 text-xs tracking-normal text-foreground ring-1 ring-gray-800">+ Premium+ </span>+ ) : null}{isTrial ? (<span className="ml-2 rounded-sm bg-foreground px-2 py-0.5 text-xs tracking-normal text-background ring-1 ring-gray-800">Trialdiff --git a/components/sidebar/team-switcher.tsx b/components/sidebar/team-switcher.tsxindex f7fa6c5b..c67cc9f1 100644--- a/components/sidebar/team-switcher.tsx+++ b/components/sidebar/team-switcher.tsx@@ -27,6 +27,7 @@ import {import { AddSeatModal } from "../billing/add-seat-modal";import { UpgradePlanModal } from "../billing/upgrade-plan-modal";import { AddTeamMembers } from "../teams/add-team-member-modal";+import { AddTeamModal } from "../teams/add-team-modal";import { Avatar, AvatarFallback } from "../ui/avatar";export function TeamSwitcher({@@ -44,7 +45,7 @@ export function TeamSwitcher({React.useState<boolean>(false);const { isMobile } = useSidebar();const { canAddUsers, showUpgradePlanModal } = useLimits();- const { isTrial } = usePlan();+ const { isTrial, isDataroomsPremium } = usePlan();const switchTeam = (team: Team) => {localStorage.setItem("currentTeamId", team.id);@@ -104,13 +105,36 @@ export function TeamSwitcher({{/* <DropdownMenuShortcut>⌘{index + 1}</DropdownMenuShortcut> */}</DropdownMenuItem>))}- {/* <DropdownMenuSeparator />- <DropdownMenuItem className="gap-2 p-2">- <div className="flex size-6 items-center justify-center rounded-md border bg-background">- <Plus className="size-4" />- </div>- <div className="font-medium text-muted-foreground">Add team</div>- </DropdownMenuItem> */}+ <DropdownMenuSeparator />+ {isDataroomsPremium ? (+ <AddTeamModal setCurrentTeam={setCurrentTeam}>+ <DropdownMenuItem+ className="gap-2 p-2 cursor-pointer"+ onSelect={(e) => e.preventDefault()}+ >+ <div className="flex size-6 items-center justify-center rounded-md border bg-background">+ <UserRoundPlusIcon className="size-4" />+ </div>+ <div className="font-medium text-muted-foreground">Add new team</div>+ </DropdownMenuItem>+ </AddTeamModal>+ ) : (+ <UpgradePlanModal+ clickedPlan={PlanEnum.DataRoomsPremium}+ trigger="add_new_team"+ highlightItem={["teams"]}+ >+ <DropdownMenuItem+ className="gap-2 p-2 cursor-pointer"+ onSelect={(e) => e.preventDefault()}+ >+ <div className="flex size-6 items-center justify-center rounded-md border bg-background">+ <UserRoundPlusIcon className="size-4" />+ </div>+ <div className="font-medium text-muted-foreground">Add new team</div>+ </DropdownMenuItem>+ </UpgradePlanModal>+ )}</DropdownMenuContent></DropdownMenu></SidebarMenuItem>diff --git a/components/teams/add-team-member-modal.tsx b/components/teams/add-team-member-modal.tsxindex 1757b91c..32872538 100644--- a/components/teams/add-team-member-modal.tsx+++ b/components/teams/add-team-member-modal.tsx@@ -1,4 +1,5 @@import { useState } from "react";+import { useRouter } from "next/router";import { useTeam } from "@/context/team-context";import { toast } from "sonner";@@ -34,6 +35,7 @@ export function AddTeamMembers({const teamInfo = useTeam();const teamId = teamInfo?.currentTeam?.id;const analytics = useAnalytics();+ const router = useRouter();const emailSchema = z.string().trim()@@ -81,6 +83,9 @@ export function AddTeamMembers({toast.success("An invitation email has been sent!");setOpen(false);setLoading(false);++ // Redirect to team members page+ router.push("/settings/people");};return (diff --git a/ee/limits/constants.ts b/ee/limits/constants.tsindex d8d8e595..c0fc6e8c 100644--- a/ee/limits/constants.ts+++ b/ee/limits/constants.ts@@ -79,6 +79,22 @@ export const DATAROOMS_PLUS_PLAN_LIMITS = {},};+export const DATAROOMS_PREMIUM_PLAN_LIMITS = {+ users: 10,+ links: null,+ documents: null,+ domains: 1000,+ datarooms: 1000,+ customDomainOnPro: true,+ customDomainInDataroom: true,+ conversationsInDataroom: true,+ advancedLinkControlsOnPro: false,+ fileSizeLimits: {+ maxFiles: 5000,+ maxPages: 1000,+ },+};+export const PAUSED_PLAN_LIMITS = {// During pause: keep all data accessible but restrict new creations and viewscanCreateLinks: false,diff --git a/ee/limits/server.ts b/ee/limits/server.tsindex cba923f4..cdac4331 100644--- a/ee/limits/server.ts+++ b/ee/limits/server.ts@@ -6,6 +6,7 @@ import {BUSINESS_PLAN_LIMITS,DATAROOMS_PLAN_LIMITS,DATAROOMS_PLUS_PLAN_LIMITS,+ DATAROOMS_PREMIUM_PLAN_LIMITS,FREE_PLAN_LIMITS,PRO_PLAN_LIMITS,TPlanLimits,@@ -24,6 +25,7 @@ const planLimitsMap: Record<string, TPlanLimits> = {business: BUSINESS_PLAN_LIMITS,datarooms: DATAROOMS_PLAN_LIMITS,"datarooms-plus": DATAROOMS_PLUS_PLAN_LIMITS,+ "datarooms-premium": DATAROOMS_PREMIUM_PLAN_LIMITS,};export const configSchema = z.object({diff --git a/ee/stripe/constants.ts b/ee/stripe/constants.tsindex 7d5a5f42..b8d1abff 100644--- a/ee/stripe/constants.ts+++ b/ee/stripe/constants.ts@@ -3,6 +3,7 @@ export enum PlanEnum {Business = "Business",DataRooms = "Data Rooms",DataRoomsPlus = "Data Rooms Plus",+ DataRoomsPremium = "Data Rooms Premium",}export const PLAN_NAME_MAP: Record<string, string> = {@@ -12,6 +13,7 @@ export const PLAN_NAME_MAP: Record<string, string> = {business: "Business",datarooms: "Data Rooms","datarooms-plus": "Data Rooms Plus",+ "datarooms-premium": "Data Rooms Premium",};export type PeriodType = "monthly" | "yearly";@@ -36,26 +38,32 @@ export interface PlanFeatures {export const PLAN_PRICING = {Pro: {extraUserPrice: {- monthly: "€29/month per additional user",- yearly: "€24/month per additional user",+ monthly: "€29/month per additional team member",+ yearly: "€24/month per additional team member",},},Business: {extraUserPrice: {- monthly: "€26/month per additional user",- yearly: "€19/month per additional user",+ monthly: "€26/month per additional team member",+ yearly: "€19/month per additional team member",},},"Data Rooms": {extraUserPrice: {- monthly: "€49/month per additional user",- yearly: "€33/month per additional user",+ monthly: "€49/month per additional team member",+ yearly: "€33/month per additional team member",},},"Data Rooms Plus": {extraUserPrice: {- monthly: "€69/month per additional user",- yearly: "€49/month per additional user",+ monthly: "€69/month per additional team member",+ yearly: "€49/month per additional team member",+ },+ },+ "Data Rooms Premium": {+ extraUserPrice: {+ monthly: "€70/month per additional team member",+ yearly: "€55/month per additional team member",},},} as const;@@ -64,7 +72,7 @@ export const BASE_FEATURES: Record<PlanEnum, PlanFeatures> = {[PlanEnum.Pro]: {featureIntro: "Everything in Free, plus:",features: [- { id: "users", text: "1 user included", isUsers: true, usersIncluded: 1 },+ { id: "users", text: "1 team member included", isUsers: true, usersIncluded: 1 },{ id: "documents", text: "300 documents" },{ id: "links", text: "Unlimited links" },{ id: "folder", text: "Folder organization" },@@ -74,7 +82,7 @@ export const BASE_FEATURES: Record<PlanEnum, PlanFeatures> = {{ id: "file-types-basic", text: "More file types: ppt, docx, excel" },{ id: "branding", text: "Remove Papermark branding" },{ id: "custom-branding", text: "Custom branding" },- { id: "retention", text: "1-year analytics retention" },+ // { id: "retention", text: "1-year analytics retention" },{ id: "no-datarooms", text: "No datarooms included", isNotIncluded: true },],},@@ -83,31 +91,31 @@ export const BASE_FEATURES: Record<PlanEnum, PlanFeatures> = {features: [{id: "users",- text: "3 users included",+ text: "3 team members included",isUsers: true,usersIncluded: 3,},{id: "datarooms",- text: "Unlimited light data rooms",- tooltip: "Light data rooms include only basic security settings for sharing your data room, described in Business plan. "+ text: "Multi-file sharing",+ tooltip: "Allow you to share multiple files and folders in a single links. Simplified data rooms security settings for sharing multiple files and folders, described in Business plan. "},- { id: "documents", text: "1000 documents per data room" },+ { id: "documents", text: "1000 documents" },{id: "custom-domain",text: "Custom domain for documents",isCustomDomain: true,},- { id: "folder-levels", text: "Unlimited folder levels" },- { id: "multi-file", text: "Multi-file sharing" },++{ id: "custom-social-cards", text: "Custom social media cards" },{ id: "screenshot", text: "Screenshot protection" },{ id: "email-verify", text: "Require email verification" },{ id: "allow-block", text: "Allow/Block list" },- { id: "dataroom-branding", text: "Dataroom branding" },+{ id: "webhooks", text: "Webhooks" },- { id: "file-types-advanced", text: "More file types: dwg, kml, zip" },- { id: "retention", text: "2-year analytics retention" },+ // { id: "file-types-advanced", text: "More file types: dwg, kml, zip" },+ // { id: "retention", text: "2-year analytics retention" },],},[PlanEnum.DataRooms]: {@@ -115,25 +123,28 @@ export const BASE_FEATURES: Record<PlanEnum, PlanFeatures> = {features: [{id: "users",- text: "3 users included",+ text: "3 team members included",isUsers: true,usersIncluded: 3,},{ id: "datarooms", text: "Unlimited data rooms" },- { id: "documents", text: "Unlimited documents" },+ // { id: "documents", text: "Unlimited documents" },+ { id: "folder-levels", text: "Unlimited folder levels" },{id: "custom-domain",text: "Custom domain for data rooms",isCustomDomain: true,},- { id: "analytics", text: "Data rooms analytics" },+ { id: "dataroom-branding", text: "Data room branding" },+ { id: "analytics", text: "Data room analytics" },{ id: "nda", text: "NDA agreements" },{ id: "watermark", text: "Dynamic watermark" },- { id: "permissions", text: "Granular user/group permissions" },- { id: "audit", text: "Audit log for viewers" },- { id: "support", text: "24h priority support" },- { id: "onboarding", text: "Custom onboarding" },- { id: "retention", text: "2-year analytics retention" },+ { id: "permissions", text: "Granular file level permissions" },+ { id: "groups", text: "Data room groups" },+ // { id: "audit", text: "Audit log for viewers" },++ // { id: "onboarding", text: "Custom onboarding" },+ // { id: "retention", text: "2-year analytics retention" },],},[PlanEnum.DataRoomsPlus]: {@@ -141,26 +152,53 @@ export const BASE_FEATURES: Record<PlanEnum, PlanFeatures> = {features: [{id: "users",- text: "5 users included",+ text: "5 team members included",isUsers: true,usersIncluded: 5,},- { id: "storage", text: "Unlimited encrypted storage", highlight: true },- { id: "file-size", text: "No file size limit" },+ { id: "documents", text: "Unlimited documents in data rooms" },{id: "custom-domain",text: "Unlimited custom domains for data rooms",isCustomDomain: true,highlight: true,},+ { id: "audit", text: "Audit log for visitors" },+ { id: "email-invite", text: "Email invite viewers" },+{ id: "qa", text: "Q&A module with custom permissions" },{ id: "requests", text: "File requests with permissions" },{ id: "indexing", text: "Automatic file indexing" },- { id: "assign", text: "Assign users to particular data room" },{ id: "invite", text: "Dataroom update notifications" },+ { id: "soc2", text: "SOC 2 Type II certified" },{ id: "account-manager", text: "Dedicated account manager" },- { id: "white-label", text: "Add-on: Full white-labeling" },- { id: "retention", text: "3-year analytics retention" },+ { id: "support", text: "24/7 priority support" },+ // { id: "retention", text: "3-year analytics retention" },+ ],+ },+ [PlanEnum.DataRoomsPremium]: {+ featureIntro: "Everything in Data Rooms Plus, plus:",+ features: [+ {+ id: "teams",+ text: "Multiple teams (up to 5 teams)",+ },+ {+ id: "users",+ text: "10 team members included",+ isUsers: true,+ usersIncluded: 10,+ },+ { id: "storage", text: "Unlimited encrypted storage", highlight: true },+ { id: "file-size", text: "No file size limit" },+ { id: "workflows", text: "Workflows" },+ { id: "assign", text: "Assign team members" },+ { id: "sso", text: "SSO (Single Sign-On) on request" },+ { id: "whitelabel", text: "Whitelabeling and custom layouts" },+ { id: "api", text: "Full API access" },+ { id: "security", text: "Advanced security and certification" },+ { id: "onboarding", text: "Priority onboarding & training" },+ { id: "support", text: "Dedicated support team" },],},};diff --git a/ee/stripe/utils.ts b/ee/stripe/utils.tsindex 79103078..a068b481 100644--- a/ee/stripe/utils.ts+++ b/ee/stripe/utils.ts@@ -247,6 +247,41 @@ export const PLANS = [},},},+ {+ name: "Data Rooms Premium",+ slug: "datarooms-premium",+ minQuantity: 10,+ price: {+ monthly: {+ amount: 699,+ unitPrice: 6990,+ priceIds: {+ test: {+ old: "price_placeholder_test_old",+ new: "price_1SUWeXBYvhH6u7U7u7CJgsRE",+ },+ production: {+ old: "price_placeholder_prod_old",+ new: "price_1SUWXqBYvhH6u7U7SJKKOCKU",+ },+ },+ },+ yearly: {+ amount: 549,+ unitPrice: 5490,+ priceIds: {+ test: {+ old: "price_placeholder_test_yearly_old",+ new: "price_1SUWhQBYvhH6u7U7BE6vVLcf",+ },+ production: {+ old: "price_placeholder_prod_yearly_old",+ new: "price_1SUWWqBYvhH6u7U7I5MpZ43K",+ },+ },+ },+ },+ },];export const isOldAccount = (plan: string) => {diff --git a/ee/stripe/webhooks/checkout-session-completed.ts b/ee/stripe/webhooks/checkout-session-completed.tsindex 5bd83982..feeea92f 100644--- a/ee/stripe/webhooks/checkout-session-completed.ts+++ b/ee/stripe/webhooks/checkout-session-completed.ts@@ -2,6 +2,7 @@ import {BUSINESS_PLAN_LIMITS,DATAROOMS_PLAN_LIMITS,DATAROOMS_PLUS_PLAN_LIMITS,+ DATAROOMS_PREMIUM_PLAN_LIMITS,PRO_PLAN_LIMITS,} from "@/ee/limits/constants";import { stripeInstance } from "@/ee/stripe";@@ -63,7 +64,8 @@ export async function checkoutSessionCompleted(| typeof PRO_PLAN_LIMITS| typeof BUSINESS_PLAN_LIMITS| typeof DATAROOMS_PLAN_LIMITS- | typeof DATAROOMS_PLUS_PLAN_LIMITS = structuredClone(PRO_PLAN_LIMITS);+ | typeof DATAROOMS_PLUS_PLAN_LIMITS+ | typeof DATAROOMS_PREMIUM_PLAN_LIMITS = structuredClone(PRO_PLAN_LIMITS);if (plan.slug === "pro") {planLimits = structuredClone(PRO_PLAN_LIMITS);} else if (plan.slug === "business") {@@ -72,6 +74,8 @@ export async function checkoutSessionCompleted(planLimits = structuredClone(DATAROOMS_PLAN_LIMITS);} else if (plan.slug === "datarooms-plus") {planLimits = structuredClone(DATAROOMS_PLUS_PLAN_LIMITS);+ } else if (plan.slug === "datarooms-premium") {+ planLimits = structuredClone(DATAROOMS_PREMIUM_PLAN_LIMITS);}// Update the user limit in planLimits based on the subscription quantitydiff --git a/ee/stripe/webhooks/customer-subscription-updated.ts b/ee/stripe/webhooks/customer-subscription-updated.tsindex fbc2f4d0..2a86200d 100644--- a/ee/stripe/webhooks/customer-subscription-updated.ts+++ b/ee/stripe/webhooks/customer-subscription-updated.ts@@ -4,6 +4,7 @@ import {BUSINESS_PLAN_LIMITS,DATAROOMS_PLAN_LIMITS,DATAROOMS_PLUS_PLAN_LIMITS,+ DATAROOMS_PREMIUM_PLAN_LIMITS,PRO_PLAN_LIMITS,} from "@/ee/limits/constants";import Stripe from "stripe";@@ -66,7 +67,8 @@ export async function customerSubsciptionUpdated(| typeof PRO_PLAN_LIMITS| typeof BUSINESS_PLAN_LIMITS| typeof DATAROOMS_PLAN_LIMITS- | typeof DATAROOMS_PLUS_PLAN_LIMITS = structuredClone(PRO_PLAN_LIMITS);+ | typeof DATAROOMS_PLUS_PLAN_LIMITS+ | typeof DATAROOMS_PREMIUM_PLAN_LIMITS = structuredClone(PRO_PLAN_LIMITS);if (plan.slug === "pro") {planLimits = structuredClone(PRO_PLAN_LIMITS);} else if (plan.slug === "business") {@@ -75,6 +77,8 @@ export async function customerSubsciptionUpdated(planLimits = structuredClone(DATAROOMS_PLAN_LIMITS);} else if (plan.slug === "datarooms-plus") {planLimits = structuredClone(DATAROOMS_PLUS_PLAN_LIMITS);+ } else if (plan.slug === "datarooms-premium") {+ planLimits = structuredClone(DATAROOMS_PREMIUM_PLAN_LIMITS);}// Update the user limit in planLimits based on the subscription quantitydiff --git a/lib/swr/use-billing.ts b/lib/swr/use-billing.tsindex e968a7df..d15ea2fb 100644--- a/lib/swr/use-billing.ts+++ b/lib/swr/use-billing.ts@@ -42,7 +42,8 @@ export type BasePlan =| "trial"| "business"| "datarooms"- | "datarooms-plus";+ | "datarooms-plus"+ | "datarooms-premium";type PlanWithTrial = `${BasePlan}+drtrial`;type PlanWithOld = `${BasePlan}+old` | `${BasePlan}+drtrial+old`;@@ -127,8 +128,9 @@ export function usePlan({isPro: parsedPlan.plan === "pro",isBusiness: parsedPlan.plan === "business",isDatarooms:- parsedPlan.plan === "datarooms" || parsedPlan.plan === "datarooms-plus",+ parsedPlan.plan === "datarooms" || parsedPlan.plan === "datarooms-plus" || parsedPlan.plan === "datarooms-premium",isDataroomsPlus: parsedPlan.plan === "datarooms-plus",+ isDataroomsPremium: parsedPlan.plan === "datarooms-premium",loading: !plan && !error && !!teamId, // Only show loading if we have a teamId but no dataerror,mutate,diff --git a/pages/settings/upgrade.tsx b/pages/settings/upgrade.tsxindex 9a103880..e75020c4 100644--- a/pages/settings/upgrade.tsx+++ b/pages/settings/upgrade.tsx@@ -1,6 +1,6 @@import { useRouter } from "next/router";-import { useMemo, useState } from "react";+import { useEffect, useMemo, useState } from "react";import React from "react";import { useTeam } from "@/context/team-context";@@ -87,6 +87,47 @@ const FeatureItem = ({);};+// Toggle component for Document Sharing vs Data Rooms+const PlanTypeSelector = ({+ value,+ onChange,+ showBusinessDatarooms,+}: {+ value: "documents" | "datarooms" | "business-datarooms";+ onChange: (value: "documents" | "datarooms") => void;+ showBusinessDatarooms?: boolean;+}) => {+ const isDocuments = value === "documents";+ const isDatarooms = value === "datarooms";+ const isBusinessDatarooms = value === "business-datarooms";++ return (+ <div className="mb-8 flex w-full max-w-md items-center justify-center rounded-lg border border-gray-200 p-1">+ <button+ className={`flex-1 rounded-md px-4 py-2 text-sm font-medium transition-colors ${+ isDocuments+ ? "bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900"+ : "text-gray-600 hover:text-gray-900 dark:text-muted-foreground dark:hover:text-white"+ }`}+ onClick={() => onChange("documents")}+ >+ Document Sharing+ </button>+ <button+ className={`flex-1 rounded-md px-4 py-2 text-sm font-medium transition-colors ${+ isDatarooms+ ? "bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900"+ : "text-gray-600 hover:text-gray-900 dark:text-muted-foreground dark:hover:text-white"+ }`}+ onClick={() => onChange("datarooms")}+ >+ Data Rooms+ </button>+ </div>+ );+};++export default function UpgradePage() {const router = useRouter();const [period, setPeriod] = useState<"yearly" | "monthly">("yearly");@@ -95,11 +136,30 @@ export default function UpgradePage() {const { plan: teamPlan, trial, isCustomer, isOldAccount } = usePlan();const analytics = useAnalytics();- const plansToShow = [+ // Determine initial view based on query params or default to datarooms+ const getInitialView = () => {+ if (router.query.view === "documents") return "documents";+ if (router.query.view === "business-datarooms") return "business-datarooms";+ return "datarooms";+ };+ const [planType, setPlanType] = useState<"documents" | "datarooms" | "business-datarooms">(getInitialView());++ // Update planType when query param changes+ useEffect(() => {+ if (router.query.view === "documents") {+ setPlanType("documents");+ } else if (router.query.view === "business-datarooms") {+ setPlanType("business-datarooms");+ } else if (router.query.view === "datarooms" || !router.query.view) {+ setPlanType("datarooms");+ }+ }, [router.query.view]);++ // Document sharing plans (first 3)+ const documentSharingPlans = [PlanEnum.Pro,PlanEnum.Business,PlanEnum.DataRooms,- PlanEnum.DataRoomsPlus,];return (@@ -121,8 +181,18 @@ export default function UpgradePage() {</span></div>- <div className="grid grid-cols-1 gap-2 md:grid-cols-4">- {plansToShow.map((planOption) => {+ {/* Plan Type Selector */}+ <div className="mb-8 flex justify-center">+ <PlanTypeSelector+ value={planType}+ onChange={(value) => setPlanType(value)}+ />+ </div>++ {/* Document Sharing Plans (3 in a row) */}+ {planType === "documents" && (+ <div className="grid grid-cols-1 gap-2 md:grid-cols-3 mb-8">+ {documentSharingPlans.map((planOption) => {const planFeatures = getPlanFeatures(planOption, { period });return (@@ -131,21 +201,23 @@ export default function UpgradePage() {className={`relative flex flex-col rounded-lg border ${planOption === PlanEnum.Business? "border-[#fb7a00]"- : planOption === PlanEnum.DataRoomsPlus+ : planOption === PlanEnum.DataRoomsPremium? "border-gray-900 dark:border-gray-200"- : "border-gray-400"+ : planOption === PlanEnum.DataRoomsPlus+ ? "border-gray-800 dark:border-gray-300"+ : "border-gray-400"} bg-white p-6 shadow-sm dark:bg-gray-900`}><div className="mb-4 border-b border-gray-200 pb-2"><h3 className="text-balance text-xl font-medium text-foreground text-gray-900 dark:text-white">- Papermark {planOption}+ {planOption}</h3>{(planOption === PlanEnum.Business ||planOption === PlanEnum.DataRoomsPlus) && (<spanclassName={`absolute -top-3 right-4 rounded px-2 py-1 text-xs text-white ${planOption === PlanEnum.DataRoomsPlus- ? "bg-gray-900 dark:bg-gray-100 dark:text-black"+ ? "bg-gray-800 dark:bg-gray-200 dark:text-black": "bg-[#fb7a00]"}`}>@@ -185,7 +257,9 @@ export default function UpgradePage() {className={`w-full py-2 text-sm ${planOption === PlanEnum.Business? "bg-[#fb7a00]/90 text-white hover:bg-[#fb7a00]"- : "bg-gray-800 text-white hover:bg-gray-900 dark:hover:bg-gray-700/80"+ : planOption === PlanEnum.DataRoomsPremium+ ? "bg-gray-900 text-white hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200"+ : "bg-gray-800 text-white hover:bg-gray-900 dark:hover:bg-gray-700/80"}`}loading={selectedPlan === planOption}disabled={selectedPlan !== null}@@ -262,8 +336,324 @@ export default function UpgradePage() {</div></div>);- })}- </div>+ })}+ </div>+ )}++ {/* Business + Data Rooms Plans (4 in a row) */}+ {planType === "business-datarooms" && (+ <div className="grid grid-cols-1 gap-2 md:grid-cols-4">+ {[+ PlanEnum.Business,+ PlanEnum.DataRooms,+ PlanEnum.DataRoomsPlus,+ PlanEnum.DataRoomsPremium,+ ].map((planOption) => {+ const planFeatures = getPlanFeatures(planOption, { period });++ return (+ <div+ key={planOption}+ className={`relative flex flex-col rounded-lg border ${+ planOption === PlanEnum.Business+ ? "border-[#fb7a00]"+ : planOption === PlanEnum.DataRoomsPremium+ ? "border-gray-900 dark:border-gray-200"+ : planOption === PlanEnum.DataRoomsPlus+ ? "border-gray-800 dark:border-gray-300"+ : "border-gray-400"+ } bg-white p-6 shadow-sm dark:bg-gray-900`}+ >+ <div className="mb-4 border-b border-gray-200 pb-2">+ <h3 className="text-balance text-xl font-medium text-foreground text-gray-900 dark:text-white">+ {planOption}+ </h3>+ {(planOption === PlanEnum.Business ||+ planOption === PlanEnum.DataRoomsPlus) && (+ <span+ className={`absolute -top-3 right-4 rounded px-2 py-1 text-xs text-white ${+ planOption === PlanEnum.DataRoomsPlus+ ? "bg-gray-800 dark:bg-gray-200 dark:text-black"+ : "bg-[#fb7a00]"+ }`}+ >+ {planOption === PlanEnum.DataRoomsPlus+ ? "Best offer"+ : "Most popular"}+ </span>+ )}+ </div>++ <div className="mb-2 text-balance text-4xl font-medium tabular-nums text-foreground">+ €+ {PLANS.find((p) => p.name === planOption)!.price[period]+ .amount}+ <span className="text-base font-normal dark:text-white/75">+ /month+ </span>+ </div>+ <p className="mt-4 text-sm text-gray-600 dark:text-white">+ {planFeatures.featureIntro}+ </p>++ <ul+ role="list"+ className="mb-4 mt-4 space-y-3 text-sm leading-6 text-gray-600"+ >+ {planFeatures.features.map((feature, i) => (+ <li key={i}>+ <FeatureItem feature={feature} period={period} />+ </li>+ ))}+ </ul>+ <div className="mt-auto">+ <Button+ variant={+ planOption === PlanEnum.Business ? "default" : "default"+ }+ className={`w-full py-2 text-sm ${+ planOption === PlanEnum.Business+ ? "bg-[#fb7a00]/90 text-white hover:bg-[#fb7a00]"+ : planOption === PlanEnum.DataRoomsPremium+ ? "bg-gray-900 text-white hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200"+ : "bg-gray-800 text-white hover:bg-gray-900 dark:hover:bg-gray-700/80"+ }`}+ loading={selectedPlan === planOption}+ disabled={selectedPlan !== null}+ onClick={() => {+ setSelectedPlan(planOption);+ if (isCustomer && teamPlan !== "free") {+ fetch(+ `/api/teams/${teamInfo?.currentTeam?.id}/billing/manage`,+ {+ method: "POST",+ },+ )+ .then(async (res) => {+ if (res.status === 429) {+ toast.error(+ "Rate limit exceeded. Please try again later.",+ );+ setSelectedPlan(null);+ return;+ }++ const url = await res.json();+ router.push(url);+ })+ .catch((err) => {+ alert(err);+ setSelectedPlan(null);+ });+ } else {+ fetch(+ `/api/teams/${+ teamInfo?.currentTeam?.id+ }/billing/upgrade?priceId=${+ PLANS.find((p) => p.name === planOption)!.price[+ period+ ].priceIds[+ process.env.NEXT_PUBLIC_VERCEL_ENV ===+ "production"+ ? "production"+ : "test"+ ][isOldAccount ? "old" : "new"]+ }`,+ {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ },+ )+ .then(async (res) => {+ if (res.status === 429) {+ toast.error(+ "Rate limit exceeded. Please try again later.",+ );+ setSelectedPlan(null);+ return;+ }++ const data = await res.json();+ const { id: sessionId } = data;+ const stripe = await getStripe(isOldAccount);+ stripe?.redirectToCheckout({ sessionId });+ })+ .catch((err) => {+ alert(err);+ setSelectedPlan(null);+ });+ }+ }}+ >+ {selectedPlan === planOption+ ? "Redirecting to Stripe..."+ : `Upgrade to ${planOption} ${capitalize(period)}`}+ </Button>+ </div>+ </div>+ );+ })}+ </div>+ )}++ {/* Data Rooms Plans (3 in a row) */}+ {planType === "datarooms" && (+ <div className="grid grid-cols-1 gap-2 md:grid-cols-3">+ {[+ PlanEnum.DataRooms,+ PlanEnum.DataRoomsPlus,+ PlanEnum.DataRoomsPremium,+ ].map((planOption) => {+ const planFeatures = getPlanFeatures(planOption, { period });++ return (+ <div+ key={planOption}+ className={`relative flex flex-col rounded-lg border ${+ planOption === PlanEnum.Business+ ? "border-[#fb7a00]"+ : planOption === PlanEnum.DataRoomsPremium+ ? "border-gray-900 dark:border-gray-200"+ : planOption === PlanEnum.DataRoomsPlus+ ? "border-gray-800 dark:border-gray-300"+ : "border-gray-400"+ } bg-white p-6 shadow-sm dark:bg-gray-900`}+ >+ <div className="mb-4 border-b border-gray-200 pb-2">+ <h3 className="text-balance text-xl font-medium text-foreground text-gray-900 dark:text-white">+ {planOption}+ </h3>+ {(planOption === PlanEnum.Business ||+ planOption === PlanEnum.DataRoomsPlus) && (+ <span+ className={`absolute -top-3 right-4 rounded px-2 py-1 text-xs text-white ${+ planOption === PlanEnum.DataRoomsPlus+ ? "bg-gray-800 dark:bg-gray-200 dark:text-black"+ : "bg-[#fb7a00]"+ }`}+ >+ {planOption === PlanEnum.DataRoomsPlus+ ? "Best offer"+ : "Most popular"}+ </span>+ )}+ </div>++ <div className="mb-2 text-balance text-4xl font-medium tabular-nums text-foreground">+ €+ {PLANS.find((p) => p.name === planOption)!.price[period]+ .amount}+ <span className="text-base font-normal dark:text-white/75">+ /month+ </span>+ </div>+ <p className="mt-4 text-sm text-gray-600 dark:text-white">+ {planFeatures.featureIntro}+ </p>++ <ul+ role="list"+ className="mb-4 mt-4 space-y-3 text-sm leading-6 text-gray-600"+ >+ {planFeatures.features.map((feature, i) => (+ <li key={i}>+ <FeatureItem feature={feature} period={period} />+ </li>+ ))}+ </ul>+ <div className="mt-auto">+ <Button+ variant={+ planOption === PlanEnum.Business ? "default" : "default"+ }+ className={`w-full py-2 text-sm ${+ planOption === PlanEnum.Business+ ? "bg-[#fb7a00]/90 text-white hover:bg-[#fb7a00]"+ : planOption === PlanEnum.DataRoomsPremium+ ? "bg-gray-900 text-white hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200"+ : "bg-gray-800 text-white hover:bg-gray-900 dark:hover:bg-gray-700/80"+ }`}+ loading={selectedPlan === planOption}+ disabled={selectedPlan !== null}+ onClick={() => {+ setSelectedPlan(planOption);+ if (isCustomer && teamPlan !== "free") {+ fetch(+ `/api/teams/${teamInfo?.currentTeam?.id}/billing/manage`,+ {+ method: "POST",+ },+ )+ .then(async (res) => {+ if (res.status === 429) {+ toast.error(+ "Rate limit exceeded. Please try again later.",+ );+ setSelectedPlan(null);+ return;+ }++ const url = await res.json();+ router.push(url);+ })+ .catch((err) => {+ alert(err);+ setSelectedPlan(null);+ });+ } else {+ fetch(+ `/api/teams/${+ teamInfo?.currentTeam?.id+ }/billing/upgrade?priceId=${+ PLANS.find((p) => p.name === planOption)!.price[+ period+ ].priceIds[+ process.env.NEXT_PUBLIC_VERCEL_ENV ===+ "production"+ ? "production"+ : "test"+ ][isOldAccount ? "old" : "new"]+ }`,+ {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ },+ )+ .then(async (res) => {+ if (res.status === 429) {+ toast.error(+ "Rate limit exceeded. Please try again later.",+ );+ setSelectedPlan(null);+ return;+ }++ const data = await res.json();+ const { id: sessionId } = data;+ const stripe = await getStripe(isOldAccount);+ stripe?.redirectToCheckout({ sessionId });+ })+ .catch((err) => {+ alert(err);+ setSelectedPlan(null);+ });+ }+ }}+ >+ {selectedPlan === planOption+ ? "Redirecting to Stripe..."+ : `Upgrade to ${planOption} ${capitalize(period)}`}+ </Button>+ </div>+ </div>+ );+ })}+ </div>+ )}<div className="mt-8 flex flex-col items-center space-y-2"><a