Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: add and update pricing / billing pages
Marc Seitz07af6f94f947
diff --git a/components/billing/upgrade-plan-modal.tsx b/components/billing/upgrade-plan-modal.tsxindex acd28808..bb2c354a 100644--- a/components/billing/upgrade-plan-modal.tsx+++ b/components/billing/upgrade-plan-modal.tsx@@ -3,7 +3,6 @@ import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";import { Button } from "@/components/ui/button";import { motion } from "framer-motion";import { STAGGER_CHILD_VARIANTS } from "@/lib/constants";-import CheckCircle2 from "@/components/shared/icons/check-cirlce-2";import { capitalize } from "@/lib/utils";import { PLANS } from "@/lib/stripe/utils";import { getStripe } from "@/lib/stripe/client";@@ -11,6 +10,8 @@ import { Badge } from "../ui/badge";import { useTeam } from "@/context/team-context";import { useAnalytics } from "@/lib/analytics";import React from "react";+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";+import { CheckIcon } from "lucide-react";export function UpgradePlanModal({clickedPlan,@@ -19,28 +20,55 @@ export function UpgradePlanModal({setOpen,children,}: {- clickedPlan: "Enterprise" | "Pro";+ clickedPlan: "Business" | "Pro";trigger?: string;open?: boolean;setOpen?: React.Dispatch<React.SetStateAction<boolean>>;children?: React.ReactNode;}) {- const [plan, setPlan] = useState<"Pro" | "Enterprise">(clickedPlan);+ const [plan, setPlan] = useState<"Pro" | "Business">(clickedPlan);const [period, setPeriod] = useState<"monthly" | "yearly">("monthly");const [clicked, setClicked] = useState<boolean>(false);const teamInfo = useTeam();const analytics = useAnalytics();const features = useMemo(() => {+ if (plan === "Pro") {+ return [+ "Folders",+ "3 team members",+ "Unlimited link views",+ "Custom domains",+ "Custom branding",+ "Notion documents",+ "AI Document Assistant incl. 1500 credits",+ ];+ }++ if (plan === "Business") {+ return [+ "Unlimited subfolder levels",+ "10 team members",+ "Unlimited documents",+ "Unlimited link views",+ "Custom domains",+ "Custom branding",+ "Notion documents",+ "Data room (coming soon)",+ "Shareable folders (coming soon)",+ "AI Document Assistant incl. 2500 credits",+ "Priority Support",+ ];+ }+return [+ "Folders",+ "3 team members",+ "Unlimited link views","Custom domains","Custom branding","Notion documents",- "Unlimited link views",- "Unlimited documents",- "Team members","AI Document Assistant incl. 1500 credits",- ...(plan === "Enterprise" ? ["Priority Support"] : []),];}, [plan]);@@ -103,7 +131,18 @@ export function UpgradePlanModal({Enjoy higher limits and extra features with our {plan} plan.</motion.p></motion.div>- <div className="bg-background px-4 py-8 text-left sm:px-16">++ <div className="bg-background px-4 pb-8 text-left sm:px-16">+ <Tabs className="pb-4" defaultValue={plan}>+ <TabsList className="grid w-full grid-cols-2">+ <TabsTrigger value="Pro" onClick={() => setPlan("Pro")}>+ Pro+ </TabsTrigger>+ <TabsTrigger value="Business" onClick={() => setPlan("Business")}>+ Business+ </TabsTrigger>+ </TabsList>+ </Tabs><motion.divclassName="flex flex-col space-y-3"variants={STAGGER_CHILD_VARIANTS}@@ -121,7 +160,7 @@ export function UpgradePlanModal({className="text-sm font-normal normal-case">{`€${PLANS.find((p) => p.name === plan)!.price[period].amount- }/month`}</Badge>+ }/${period.replace("ly", "")}`}</Badge></div><buttononClick={() => {@@ -129,9 +168,7 @@ export function UpgradePlanModal({}}className="text-xs text-muted-foreground underline underline-offset-4 transition-colors hover:text-gray-800 hover:dark:text-muted-foreground/80">- {period === "monthly"- ? "Get 2 months free 🎁"- : "Switch to monthly"}+ {period === "monthly" ? "Want 20% off?" : "Switch to monthly"}</button></div><motion.div@@ -150,9 +187,12 @@ export function UpgradePlanModal({<motion.divkey={i}variants={STAGGER_CHILD_VARIANTS}- className="flex items-center space-x-2 text-sm text-muted-foreground"+ className="flex items-center gap-x-3 text-sm text-muted-foreground">- <CheckCircle2 className="h-5 w-5 text-emerald-500" />+ <CheckIcon+ className="h-5 w-5 flex-none text-[#fb7a00]"+ aria-hidden="true"+ /><span>{feature}</span></motion.div>))}@@ -194,16 +234,7 @@ export function UpgradePlanModal({target="_blank"className="text-center text-xs text-muted-foreground underline-offset-4 transition-all hover:text-gray-800 hover:dark:text-muted-foreground/80 hover:underline">- Papermark Enterprise- </a>- <p className="text-muted-foreground">•</p>- <a- href={`${process.env.NEXT_PUBLIC_BASE_URL}/pricing`}- target="_blank"- rel="noopener noreferrer"- className="text-center text-xs text-muted-foreground underline-offset-4 transition-all hover:text-gray-800 hover:dark:text-muted-foreground/80 hover:underline"- >- Compare plans+ Looking for Papermark Enterprise?</a></div></motion.div>diff --git a/lib/stripe/utils.ts b/lib/stripe/utils.tsindex fd639b1b..6e206f86 100644--- a/lib/stripe/utils.ts+++ b/lib/stripe/utils.ts@@ -51,7 +51,7 @@ export const PLANS = [},},yearly: {- amount: 24,+ amount: 290,priceIds: {test: "price_1NmHHaFJyGSZ96lhXxg2fTr7",production: "price_1Op0fFFJyGSZ96lhPVrvzz5a", // new price@@ -60,4 +60,24 @@ export const PLANS = [},},},+ {+ name: "Business",+ slug: "business",+ price: {+ monthly: {+ amount: 79,+ priceIds: {+ test: "price_1OuYgCFJyGSZ96lhF2gFs7Rs",+ production: "price_1OuYeIFJyGSZ96lhwH58Y1kU",+ },+ },+ yearly: {+ amount: 790,+ priceIds: {+ test: "price_1OuYgPFJyGSZ96lhKk6JzTf1",+ production: "price_1OuYedFJyGSZ96lhTaJx58pG",+ },+ },+ },+ },];diff --git a/pages/pricing.tsx b/pages/pricing.tsxindex fc57f7d3..45619449 100644--- a/pages/pricing.tsx+++ b/pages/pricing.tsx@@ -24,6 +24,7 @@ const tiers: {annually: string;};description: string;+ featureIntro: string;features: string[];bgColor: string;borderColor: string;@@ -35,12 +36,14 @@ const tiers: {name: "Free",id: "tier-free",href: "/login",- price: { monthly: "€0", annually: "$0" },+ price: { monthly: "€0", annually: "€0" },description: "The essentials to start sharing documents securely.",+ featureIntro: "What's included:",features: ["1 user","Unlimited links",- "Analytics for each page",+ "Page-by-page analytics",+ "30-day analytics retention","Document sharing controls",],@@ -52,15 +55,16 @@ const tiers: {},{name: "Pro",- id: "tier-freelancer",+ id: "tier-pro",href: "/login",- price: { monthly: "€29", annually: "$290" },- description:- "The essentials to provide a branded experience for your documents.",+ price: { monthly: "€29", annually: "€290" },+ description: "The branded experience for your documents.",+ featureIntro: "Everything in Free, plus:",features: [- "Everything in Free, plus:",- "Up to 3 active users",+ "3 users","Custom domain",+ "Custom branding",+ "1-year analytics retention","Advanced access controls","Papermark AI",],@@ -72,16 +76,18 @@ const tiers: {},{name: "Business",- id: "tier-startup",+ id: "tier-business",href: "/login",- price: { monthly: "€79", annually: "$790" },+ price: { monthly: "€79", annually: "€790" },description: "A plan that scales with your rapidly growing business.",+ featureIntro: "Everything in Pro, plus:",features: [- "Everything in Pro, plus:",- "Up to 10 active users",- "Data room",+ "10 users",+ "Unlimited documents",+ "Unlimited subfolder levels","Large file uploads",- "Custom Branding",+ "Data rooms (coming soon)",+ "Shareable folders (coming soon)","24h Priority Support",],bgColor: "#fb7a00",@@ -94,12 +100,14 @@ const tiers: {name: "Enterprise",id: "tier-enterprise",href: "https://cal.com/marcseitz/papermark",- price: { monthly: "Custom", annually: "$" },+ price: { monthly: "Custom", annually: "Custom" },description: "Self-hosted and advanced infrastructure for your company.",+ featureIntro: "Tailored solutions:",features: [- "Self-Hosted version",+ "Self-hosted version","Unlimited users","Unlimited documents",+ "Unlimited folders and subfolders","Different file types","Up to 5TB file uploads","Dedicated support",@@ -193,6 +201,7 @@ export default function PricingPage() {role="list"className="mt-8 space-y-3 text-sm leading-6 text-gray-600">+ <li>{tier.featureIntro}</li>{tier.features.map((feature) => (<li key={feature} className="flex gap-x-3"><CheckIcon@@ -214,17 +223,18 @@ export default function PricingPage() {});}}>- <Button- className="rounded-3xl hover:bg-gray-100"- style={{- backgroundColor: tier.bgColor,- borderColor: tier.borderColor,- color: tier.textColor,- borderWidth: "1px",- }}- >- {tier.buttonText}- </Button>+ {tier.id === "tier-business" ? (+ <Button+ className="rounded-3xl text-base"+ variant="orange"+ >+ {tier.buttonText}+ </Button>+ ) : (+ <Button className="rounded-3xl text-base text-gray-200 bg-black hover:bg-gray-900">+ {tier.buttonText}+ </Button>+ )}</Link></div></div>@@ -234,7 +244,7 @@ export default function PricingPage() {</div><div className="w-full max-w-7xl px-4 md:px-8 mx-auto ">- <div className="py-12 bg-[#fb7a00] rounded-3xl mx-auto px-6">+ <div className="py-12 bg-[#fb7a00] rounded-xl mx-auto px-6"><div className="flex lg:flex-row flex-col item-center justify-between space-y-10 lg:space-y-0"><h2 className="text-3xl text-nowrap">Looking to self-host?</h2><div className="space-x-2 flex items-center">diff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsxindex c9f8ef97..42e4da62 100644--- a/pages/settings/billing.tsx+++ b/pages/settings/billing.tsx@@ -7,27 +7,27 @@ import { useTeam } from "@/context/team-context";import { useAnalytics } from "@/lib/analytics";import { useBilling } from "@/lib/swr/use-billing";import { cn } from "@/lib/utils";+import { CheckIcon } from "lucide-react";import Link from "next/link";import { useRouter } from "next/router";import { useEffect, useState } from "react";import { toast } from "sonner";-interface Tier {- id: number;- title: string;- priceMonthly: string;- currentPlan: boolean;- hasPlan: boolean;- isTrial?: boolean;- description: string;- features: string[];-}+const frequencies: {+ value: "monthly" | "annually";+ label: "Monthly" | "Annually";+ priceSuffix: "/month" | "/year";+}[] = [+ { value: "monthly", label: "Monthly", priceSuffix: "/month" },+ { value: "annually", label: "Annually", priceSuffix: "/year" },+];export default function Billing() {const router = useRouter();const analytics = useAnalytics();const { plan, startsAt, endsAt } = useBilling();const [clicked, setClicked] = useState<boolean>(false);+ const frequency = frequencies[0];const teamInfo = useTeam();@@ -42,67 +42,110 @@ export default function Billing() {}if (router.query.cancel) {- console.log("Stripe Checkout Cancelled");analytics.capture("Stripe Checkout Cancelled", {teamId: teamInfo?.currentTeam?.id,});}}, [router.query]);- const tiers: Tier[] = [+ const tiers: {+ name: string;+ id: string;+ href: string;+ currentPlan: boolean;+ price: {+ monthly: string;+ annually: string;+ };+ description: string;+ featureIntro: string;+ features: string[];+ bgColor: string;+ borderColor: string;+ textColor: string;+ buttonText: string;+ mostPopular: boolean;+ }[] = [{- id: 1,- title: "Free",- priceMonthly: "€0/mo",- description: "What's included:",+ name: "Free",+ id: "tier-free",+ href: "/login",currentPlan: plan && plan == "free" ? true : false,- hasPlan: false,+ price: { monthly: "€0", annually: "$0" },+ description: "The essentials to start sharing documents securely.",+ featureIntro: "What's included:",features: [- "Unlimited links",- "30 MB document size limit",- "Notion documents","1 user",- "Basic support",- "Email notifications",- "Basic Papermark AI",- "100 credits, 3/day",+ "10 documents",+ "Unlimited links",+ "Page-by-page analytics",+ "30-day analytics retention",+ "Document sharing controls",],++ bgColor: "bg-gray-200",+ borderColor: "#bg-gray-800",+ textColor: "#bg-gray-800",+ buttonText: "Start for free",+ mostPopular: false,},{- id: 2,- title: "Pro",- priceMonthly: "€29/mo",- description: "Everything in Free, plus:",+ name: "Pro",+ id: "tier-pro",+ href: "/login",currentPlan: plan && plan == "pro" ? true : false,- hasPlan: plan && plan !== "free" ? true : false,- isTrial: plan && plan == "trial" ? true : false,+ price: { monthly: "€29", annually: "$290" },+ description: "The branded experience for your documents.",+ featureIntro: "Everything in Free, plus:",features: [- "Unlimited documents",- "Large file uploads",- "Team members",- "Priority support",+ "3 users",+ "Folder structure","Custom domains","Custom branding",- "Advanced Papermark AI",- "1500 credits",+ "1-year analytics retention",+ "Advanced access controls",],+ bgColor: "bg-gray-200",+ borderColor: "#bg-gray-800",+ textColor: "#bg-gray-800",+ buttonText: "Upgrade to Pro",+ mostPopular: false,},{- id: 3,- title: "Enterprise",- priceMonthly: "Contact us",- description: "Custom tailored plans, incl.:",- currentPlan: plan && plan == "enterprise" ? true : false,- hasPlan: plan && plan !== "free" ? true : false,+ name: "Business",+ id: "tier-business",+ href: "/login",+ currentPlan: plan && plan == "business" ? true : false,+ price: { monthly: "€79", annually: "$790" },+ description: "A plan that scales with your rapidly growing business.",+ featureIntro: "Everything in Pro, plus:",features: [- "Up to 5TB file uploads",- "Dedicated support",- "Custom Papermark AI / BYO",- "Unlimited credits",+ "10 users",+ "Unlimited documents",+ "Unlimited subfolder levels",+ "Large file uploads",+ "Shareable folders (coming soon)",+ "Data rooms (coming soon)",+ "24h Priority Support",],+ bgColor: "#fb7a00",+ borderColor: "#fb7a00",+ textColor: "#black",+ buttonText: "Upgrade to Business",+ mostPopular: true,},];+ const enterpriseFeatures = [+ "Self-hosted version",+ "Unlimited users",+ "Unlimited documents",+ "Different file types",+ "Up to 5TB file uploads",+ "Dedicated support",+ "Custom Papermark AI",+ ];+return (<AppLayout><Navbar current="Billing" />@@ -119,67 +162,65 @@ export default function Billing() {</div></div>- <div>- <div className="mx-auto mt-16 grid max-w-5xl grid-cols-1 gap-6 items-stretch sm:grid-cols-3 sm:gap-4">- {tiers.map((tier) => (- <div- key={tier.id}- className={cn(- `rounded-3xl p-8 sm:p-10 bg-white dark:bg-gray-800 flex flex-col justify-between h-full`,- tier.currentPlan || tier.isTrial- ? "ring-2 ring-primary"- : "ring-1 ring-gray-900/10 dark:ring-gray-200/10",- )}- >- <div className="">- <h2 className="text-xl font-bold mb-4 inline-flex items-center gap-x-2">- {tier.title}{" "}- {tier.currentPlan ? (- <Badge className="rounded-none">Current Plan</Badge>- ) : null}- {tier.isTrial ? (- <Badge className="rounded-none">Trial</Badge>- ) : null}- </h2>- <div className="text-3xl font-bold mb-4">- {tier.priceMonthly}- </div>- <div className="text-gray-900 dark:text-gray-400 mb-6">- {tier.description}- </div>- {tier.features.map((feature) => (- <div key={feature} className="flex items-center mb-2">- <svg- className="h-5 w-5 text-green-500 dark:text-green-300 mr-2"- fill="none"- stroke="currentColor"- viewBox="0 0 24 24"- xmlns="http://www.w3.org/2000/svg"+ <div className="bg-white dark:bg-gray-900">+ <div className="mx-auto space-y-8">+ <div className="isolate grid grid-cols-1 md:grid-cols-3 border border-black dark:border-muted-foreground rounded-xl overflow-hidden">+ {tiers.map((tier) => (+ <div+ key={tier.id}+ className="border-black dark:border-muted-foreground border-r-0 md:border-r md:last:!border-r-0 flex flex-col justify-between"+ >+ <div>+ <div className="border-b border-black p-6 bg-gray-100 dark:bg-gray-800 dark:border-muted-foreground">+ <h3+ id={tier.id}+ className="text-balance text-foreground text-xl leading-8 flex items-center gap-x-2">- <path- strokeLinecap="round"- strokeLinejoin="round"- strokeWidth="2"- d="M5 13l4 4L19 7"- ></path>- </svg>- {feature}+ <span>{tier.name}</span>+ {tier.currentPlan ? (+ <Badge className="rounded-md">Current Plan</Badge>+ ) : null}+ </h3></div>- ))}- </div>- <div className="mt-6 flex items-center justify-center gap-x-6">- {tier.id === 1 && (- <div className="h-10 w-24 animate-pulse rounded-md bg-border" />- )}- {tier.id === 2 &&- (plan ? (- tier.hasPlan ? (- <Button+ <div className="p-6">+ <p className="mt-4 text-sm leading-6 text-gray-600 dark:text-muted-foreground text-balance">+ {tier.description}+ </p>+ <p className="mt-6 flex items-baseline gap-x-1">+ <span className="text-balance text-4xl font-medium text-foreground">+ {tier.price[frequency.value]}+ </span>+ <spanclassName={cn(- !tier.currentPlan &&- "border border-gray-700 dark:bg-secondary hover:dark:border-gray-500 hover:dark:bg-gray-700",+ "text-sm font-semibold leading-6 text-gray-600 dark:text-muted-foreground",+ tier.id === "tier-enterprise" ? "hidden" : "",)}- variant={tier.currentPlan ? "default" : "default"}+ >+ {frequency.priceSuffix}+ </span>+ </p>+ <ul+ role="list"+ className="mt-8 space-y-3 text-sm leading-6 text-gray-600 dark:text-muted-foreground"+ >+ <li>{tier.featureIntro}</li>+ {tier.features.map((feature) => (+ <li key={feature} className="flex gap-x-3">+ <CheckIcon+ className="h-6 w-5 flex-none text-[#fb7a00]"+ aria-hidden="true"+ />+ <span>{feature}</span>+ </li>+ ))}+ </ul>+ </div>+ </div>+ <div className="p-6">+ {tier.id !== "tier-free" /** hide button on free tier */ ? (+ tier.currentPlan ? (+ <Button+ className="rounded-3xl"onClick={() => {setClicked(true);fetch(@@ -203,34 +244,74 @@ export default function Billing() {</Button>) : (<UpgradePlanModal- clickedPlan={"Pro"}+ clickedPlan={tier.name as "Pro" | "Business"}trigger={"billing_page"}>- <Button>Upgrade to Pro</Button>+ <Button+ className="rounded-3xl"+ variant={+ tier.id === "tier-business" ? "orange" : "default"+ }+ >+ {tier.buttonText}+ </Button></UpgradePlanModal>)- ) : (- <div className="h-10 w-24 animate-pulse rounded-md bg-border" />- ))}- {tier.id === 3 && (- <Link- href="https://cal.com/marcseitz/papermark"- target="_blank"- rel="noopener noreferrer"- className="text-foreground hover:underline"+ ) : null}+ </div>+ </div>+ ))}+ </div>+ <div className="isolate grid grid-cols-1 border border-black dark:border-muted-foreground rounded-xl overflow-hidden">+ <div+ key="tier-enterprise"+ className="border-black dark:border-muted-foreground border-r-0 md:border-r md:last:!border-r-0 flex flex-col justify-between"+ >+ <div>+ <div className="border-b border-black dark:border-muted-foreground p-6 bg-gray-100 dark:bg-gray-800">+ <h3+ id="tier-enterprise"+ className="text-balance text-foreground text-xl leading-8 flex items-center gap-x-2">- <Button- type="button"- variant="outline"- className="border border-gray-700 dark:bg-secondary hover:dark:border-gray-500 hover:dark:bg-gray-700"- >- Contact us- </Button>- </Link>- )}+ <span>Enterprise</span>+ </h3>+ </div>+ <div className="p-6">+ <p className="mt-4 text-sm leading-6 text-gray-600 dark:text-muted-foreground text-balance">+ Self-hosted and advanced document infrastructure for your+ company.+ </p>+ <p className="mt-6 flex items-baseline gap-x-1">+ <span className="text-balance text-4xl font-medium text-foreground">+ Custom+ </span>+ </p>+ <ul+ role="list"+ className="mt-8 text-sm leading-6 text-gray-600 dark:text-muted-foreground grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-y-3"+ >+ {enterpriseFeatures.map((feature) => (+ <li key={feature} className="flex gap-x-3">+ <CheckIcon+ className="h-6 w-5 flex-none text-[#fb7a00]"+ aria-hidden="true"+ />+ <span>{feature}</span>+ </li>+ ))}+ </ul>+ </div>+ </div>+ <div className="p-6">+ <Link+ href="https://cal.com/marcseitz/papermark"+ target="_blank"+ >+ <Button className="rounded-3xl">Talk to us</Button>+ </Link></div></div>- ))}+ </div></div></div></div>