Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: update plans and billing
Marc Seitz3d42a814314f
diff --git a/components/billing/upgrade-plan-modal.tsx b/components/billing/upgrade-plan-modal.tsxindex 5f768611..7761942a 100644--- a/components/billing/upgrade-plan-modal.tsx+++ b/components/billing/upgrade-plan-modal.tsx@@ -16,12 +16,12 @@ export function UpgradePlanModal({setOpen,children,}: {- clickedPlan: "Starter" | "Pro";+ clickedPlan: "Enterprise" | "Pro";open?: boolean;setOpen?: React.Dispatch<React.SetStateAction<boolean>>;children?: React.ReactNode;}) {- const [plan, setPlan] = useState<"Starter" | "Pro">(clickedPlan);+ const [plan, setPlan] = useState<"Pro" | "Enterprise">(clickedPlan);const [period, setPeriod] = useState<"monthly" | "yearly">("monthly");const [clicked, setClicked] = useState<boolean>(false);const teamInfo = useTeam();@@ -29,16 +29,13 @@ export function UpgradePlanModal({const features = useMemo(() => {return ["Custom domains",+ "Custom branding","Notion documents","Unlimited link views","Unlimited documents",- ...(plan === "Pro"- ? [- "AI Document Assistant incl. 1500 credits",- "Unlimited team members",- "Priority Support",- ]- : ["AI Document Assistant incl. 500 credits"]),+ "Team members",+ "AI Document Assistant incl. 1500 credits",+ ...(plan === "Enterprise" ? ["Priority Support"] : []),];}, [plan]);@@ -94,7 +91,7 @@ export function UpgradePlanModal({className="text-sm font-normal normal-case">{`€${PLANS.find((p) => p.name === plan)!.price[period].amount- }/${period.replace("ly", "")}`}</Badge>+ }/month`}</Badge></div><buttononClick={() => {@@ -161,14 +158,13 @@ export function UpgradePlanModal({}}>{`Upgrade to ${plan} ${capitalize(period)}`}</Button><div className="flex items-center justify-center space-x-2">- <button- onClick={() => {- setPlan(plan === "Pro" ? "Starter" : "Pro");- }}+ <a+ href="https://cal.com/marcseitz/papermark"+ 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 {plan === "Pro" ? "Starter" : "Pro"}- </button>+ Papermark Enterprise+ </a><p className="text-muted-foreground">•</p><ahref={`${process.env.NEXT_PUBLIC_BASE_URL}/pricing`}diff --git a/lib/stripe/utils.ts b/lib/stripe/utils.tsindex 9d9860ed..00e01318 100644--- a/lib/stripe/utils.ts+++ b/lib/stripe/utils.ts@@ -43,39 +43,39 @@ export const PLANS = [slug: "pro",price: {monthly: {- amount: 30,+ amount: 29,priceIds: {- test: "price_1OJFd8FJyGSZ96lh3v4jW7Bf",- production: "price_1OJTUNFJyGSZ96lhOqTkCxkY",+ test: "price_1NmHGzFJyGSZ96lhp946ODFI",+ production: "price_1NmMZ7FJyGSZ96lhyad2LW90",},},yearly: {- amount: 300,+ amount: 24,priceIds: {- test: "price_1OJFd8FJyGSZ96lhVmparJSc",- production: "price_1OJTUNFJyGSZ96lhDxXgXm1e",- },- },- },- },- {- name: "Starter",- slug: "starter",- price: {- monthly: {- amount: 15,- priceIds: {- test: "price_1OIsDmFJyGSZ96lh2aIhaerk",- production: "price_1OJTUWFJyGSZ96lhTcJPVBgS",- },- },- yearly: {- amount: 150,- priceIds: {- test: "price_1OIsDmFJyGSZ96lhVOYVN8PN",- production: "price_1OJTUWFJyGSZ96lhGnKb3E9F",+ test: "price_1NmHHaFJyGSZ96lhXxg2fTr7",+ production: "price_1NmMZ7FJyGSZ96lhqZEkh50e",},},},},+ // {+ // name: "Starter",+ // slug: "starter",+ // price: {+ // monthly: {+ // amount: 15,+ // priceIds: {+ // test: "price_1OIsDmFJyGSZ96lh2aIhaerk",+ // production: "price_1OJTUWFJyGSZ96lhTcJPVBgS",+ // },+ // },+ // yearly: {+ // amount: 150,+ // priceIds: {+ // test: "price_1OIsDmFJyGSZ96lhVOYVN8PN",+ // production: "price_1OJTUWFJyGSZ96lhGnKb3E9F",+ // },+ // },+ // },+ // },];diff --git a/pages/pricing.tsx b/pages/pricing.tsxindex 6ead036e..7a0f5098 100644--- a/pages/pricing.tsx+++ b/pages/pricing.tsx@@ -8,43 +8,45 @@ export default function Pricing() {{id: 1,title: "Free",- priceMonthly: "$0/mo",- description: "Enjoy free access",+ priceMonthly: "€0/mo",+ description: "What's included:",features: [- "PDF up to 30 mb","Unlimited links",- "Analytics for each page",- "Feedback on each page",- "Notion Documents",- "Email Notifications on views",- "Papermark AI",- "100 questions, 3/day",+ "30 MB document size limit",+ "Notion documents",+ "1 user",+ "Basic support",+ "Email notifications",+ "Basic Papermark AI",+ "100 credits, 3/day",],},{id: 2,- title: "Starter",- priceMonthly: "€15/mo",- description: "All free features + ",+ title: "Pro",+ priceMonthly: "€29/mo",+ description: "Everything in Free, plus:",features: [- "Custom domains","Unlimited documents",- "Papermark AI",- "500 questions",+ "Large file uploads",+ "Team members",+ "Priority support",+ "Custom domains",+ "Custom branding",+ "Advanced Papermark AI",+ "1500 credits",],},{id: 3,- title: "Pro",- priceMonthly: "€30/mo",- description: "All features and more",+ title: "Enterprise",+ priceMonthly: "Get in touch",+ description: "Custom tailored plans, incl.:",features: [- "Team members",- "Priority Support",- "Custom Branding",- "Large file uploads",- "Papermark AI",- "1500 questions",+ "Up to 5TB file uploads",+ "Dedicated support",+ "Custom Papermark AI / BYO",+ "Unlimited credits",],},];@@ -53,32 +55,10 @@ export default function Pricing() {<><Head><title>Papermark | Pricing</title>- <meta- name="description"- content="How to launch Open Source project on Product Hunt? Best tips to launch on Product Hunt and get first place"- />- <meta- property="og:title"- content="How to launch Open Source project on Product Hunt?"- />- <meta- property="og:description"- content="How to launch Open Source project on Product Hunt? Best tips to launch on Product Hunt and get first place"- />- <meta- property="og:image"- content="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fejivoe3vst4rsdzjblo.png"- />- <meta property="og:url" content="https://www.papermark.io" />- <meta name="twitter:card" content="summary_large_image" /></Head><Navbar /><div className="min-h-screen bg-white text-black py-20">- <Head>- <title>Pricing Page</title>- </Head>-<div className="container mx-auto px-4"><div className="mx-auto max-w-2xl text-center lg:max-w-4xl"><p className="mt-16 text-4xl font-bold tracking-tight text-gray-900 sm:text-5xl">@@ -147,7 +127,7 @@ export default function Pricing() {<div className="mt-6 flex items-center justify-center gap-x-6">{tier.id === 1 && (<Link- href="/login?next=/settings/billing"+ href="/login"className="rounded-md bg-white px-3.5 py-2.5 text-sm font-semibold text-black shadow-sm border-2 border-gray-700 hover:bg-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Start for free@@ -155,7 +135,7 @@ export default function Pricing() {)}{tier.id === 2 && (<Link- href="/login"+ href="/login?next=/settings/billing"className="rounded-md bg-black px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-gray-800 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Start for freediff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsxindex 7edc5045..ab9e2c1b 100644--- a/pages/settings/billing.tsx+++ b/pages/settings/billing.tsx@@ -47,49 +47,51 @@ export default function Billing() {id: 1,title: "Free",priceMonthly: "€0/mo",- description: "Enjoy free access",+ description: "What's included:",currentPlan: plan && plan == "free" ? true : false,hasPlan: false,features: [- "PDF up to 30 mb","Unlimited links",- "Analytics for each page",- "Feedback on each page",- "Notion Documents",- "Email Notifications on views",- "Papermark AI",- "100 questions, 3/day",+ "30 MB document size limit",+ "Notion documents",+ "1 user",+ "Basic support",+ "Email notifications",+ "Basic Papermark AI",+ "100 credits, 3/day",],},{id: 2,- title: "Starter",- priceMonthly: "€15/mo",- description: "All free features +",- currentPlan: plan && plan == "starter" ? true : false,+ title: "Pro",+ priceMonthly: "€29/mo",+ description: "Everything in Free, plus:",+ currentPlan: plan && plan == "pro" ? true : false,hasPlan: plan && plan !== "free" ? true : false,+ isTrial: plan && plan == "trial" ? true : false,features: [- "Custom domains","Unlimited documents",- "Papermark AI",- "500 questions",+ "Large file uploads",+ "Team members",+ "Priority support",+ "Custom domains",+ "Custom branding",+ "Advanced Papermark AI",+ "1500 credits",],},{id: 3,- title: "Pro",- priceMonthly: "€30/mo",- description: "All features and more",- currentPlan: plan && plan == "pro" ? true : false,+ title: "Enterprise",+ priceMonthly: "Contact us",+ description: "Custom tailored plans, incl.:",+ currentPlan: plan && plan == "enterprise" ? true : false,hasPlan: plan && plan !== "free" ? true : false,- isTrial: plan && plan == "trial" ? true : false,features: [- "Team members",- "Priority Support",- "Custom Branding",- "Large file uploads",- "Papermark AI",- "1500 questions",+ "Up to 5TB file uploads",+ "Dedicated support",+ "Custom Papermark AI / BYO",+ "Unlimited credits",],},];@@ -105,16 +107,7 @@ export default function Billing() {Billing</h3><p className="text-sm text-muted-foreground">- Manage your subscription{" "}- <Link- href="https://cal.com/marcseitz/papermark"- target="_blank"- rel="noopener noreferrer"- className="text-foreground hover:underline"- >- contact us- </Link>{" "}- for support and enterprise requests+ Manage your subscription and billing information.</p></div></div>@@ -168,25 +161,9 @@ export default function Billing() {))}</div><div className="mt-6 flex items-center justify-center gap-x-6">- {tier.id === 1 &&- (plan ? (- tier.currentPlan ? (- <UpgradePlanModal clickedPlan={"Pro"}>- <Button type="button">Upgrade to Pro</Button>- </UpgradePlanModal>- ) : (- <Button- type="button"- variant="ghost"- className="border border-gray-700"- disabled- >- Change plan- </Button>- )- ) : (- <div className="h-10 w-24 animate-pulse rounded-md bg-border" />- ))}+ {tier.id === 1 && (+ <div className="h-10 w-24 animate-pulse rounded-md bg-border" />+ )}{tier.id === 2 &&(plan ? (tier.hasPlan ? (@@ -195,7 +172,7 @@ export default function Billing() {!tier.currentPlan &&"border border-gray-700 dark:bg-secondary hover:dark:border-gray-500 hover:dark:bg-gray-700",)}- variant={tier.currentPlan ? "default" : "outline"}+ variant={tier.currentPlan ? "default" : "default"}onClick={() => {setClicked(true);fetch(@@ -217,212 +194,35 @@ export default function Billing() {>Manage Subscription</Button>- ) : (- <UpgradePlanModal clickedPlan={"Starter"}>- <Button- type="button"- variant="outline"- className="border border-gray-700 dark:bg-secondary hover:dark:border-gray-500 hover:dark:bg-gray-700"- >- Upgrade to Starter- </Button>- </UpgradePlanModal>- )- ) : (- <div className="h-10 w-24 animate-pulse rounded-md bg-border" />- ))}- {tier.id === 3 &&- (plan ? (- tier.hasPlan ? (- <Button- onClick={() => {- setClicked(true);- fetch(- `/api/teams/${teamInfo?.currentTeam?.id}/billing/manage`,- {- method: "POST",- },- )- .then(async (res) => {- const url = await res.json();- router.push(url);- })- .catch((err) => {- alert(err);- setClicked(false);- });- }}- loading={clicked}- >- {tier.currentPlan- ? `Manage Subscription`- : `Upgrade to Pro`}- </Button>) : (<UpgradePlanModal clickedPlan={"Pro"}>- <Button type="button">- {tier.isTrial- ? "Upgrade to remain on Pro"- : "Upgrade to Pro"}- </Button>+ <Button>Upgrade to Pro</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"+ >+ <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>+ )}</div></div>))}</div></div>-- {/* <div>- <div className="rounded-lg border border-border bg-secondary">- <div className="flex flex-col space-y-3 p-10">- <h2 className="text-xl font-medium">Plan & Usage</h2>- <p className="text-sm text-secondary-foreground">- You are currently on the{" "}- {plan ? (- <Badge>{plan}</Badge>- ) : (- <span className="rounded-full bg-border px-2 py-0.5 text-xs text-foreground">- load- </span>- )}{" "}- plan.- {endsAt && startsAt && (- <>- {" "}- Current billing cycle:{" "}- <span className="font-medium text-foreground">- {`${formattedDate(startsAt)} - ${formattedDate(endsAt)}`}- </span>- .- </>- )}- </p>- </div>- <div className="border-b border-gray-200 dark:border-gray-700" />- <div className="grid grid-cols-1 divide-y divide-gray-200 dark:divide-gray-700 sm:grid-cols-2 sm:divide-x sm:divide-y-0">- <div className="p-10">- <div className="flex items-center space-x-2">- <h3 className="font-medium">Total Documents</h3>- </div>- {plan === "enterprise" ? (- <div className="mt-4 flex items-center">- {usage || usage === 0 ? (- <Number value={usage}>- <p className="text-2xl font-semibold text-black">- {nFormatter(usage)}- </p>- </Number>- ) : (- <div className="h-8 w-8 animate-pulse rounded-md bg-gray-200" />- )}- <Divider className="h-8 w-8 text-gray-500" />- <Infinity className="h-8 w-8 text-gray-500" />- </div>- ) : (- <div className="mt-2 flex flex-col space-y-2">- {usage !== undefined && usageLimit ? (- <p className="text-sm text-gray-600">- <Number value={usage}>- <span>{nFormatter(usage)} </span>- </Number>- / {nFormatter(usageLimit)} clicks (- {((usage / usageLimit) * 100).toFixed(1)}%)- </p>- ) : (- <div className="h-5 w-32 animate-pulse rounded-md bg-gray-200" />- )}- <div className="h-3 w-full overflow-hidden rounded-full bg-gray-200">- <motion.div- initial={{ width: 0 }}- animate={{- width:- usage !== undefined && usageLimit- ? (usage / usageLimit) * 100 + "%"- : "0%",- }}- transition={{ duration: 0.5, type: "spring" }}- className={`${- usage && usageLimit && usage > usageLimit- ? "bg-red-500"- : "bg-blue-500"- } h-3 rounded-full`}- />- </div>- </div>- )}- </div>- <div className="p-10">- <div className="flex items-center space-x-2">- <h3 className="font-medium">Number of Links</h3>- <InfoTooltip content="Number of short links in your project." />- </div>- <div className="mt-4 flex items-center">- {links || links === 0 ? (- <Number value={links} unit="links">- <p className="text-2xl font-semibold text-black">- {nFormatter(links)}- </p>- </Number>- ) : (- <div className="h-8 w-8 animate-pulse rounded-md bg-gray-200" />- )}- <Divider className="h-8 w-8 text-gray-500" />- <Infinity className="h-8 w-8 text-gray-500" />- </div>- </div>- </div>-- <div className="border-b border-gray-200 dark:border-gray-700" />- <div className="flex flex-col items-center justify-between space-y-3 px-10 py-4 text-center sm:flex-row sm:space-y-0 sm:text-left">- {plan ? (- <p className="text-sm text-muted-foreground">- {plan === "pro"- ? "On the Pro plan, the sky's the limit! Thank you for your support."- : "For higher limits, upgrade to the Pro plan."}- </p>- ) : (- <div className="h-3 w-28 animate-pulse rounded-full bg-border" />- )}- <div>- {plan ? (- plan !== "pro" ? (- <UpgradePlanModal>- <Button type="button">Upgrade</Button>- </UpgradePlanModal>- ) : (- <Button- onClick={() => {- setClicked(true);- fetch(- `/api/teams/${teamInfo?.currentTeam?.id}/billing/manage`,- {- method: "POST",- }- )- .then(async (res) => {- const url = await res.json();- router.push(url);- })- .catch((err) => {- alert(err);- setClicked(false);- });- }}- loading={clicked}>- Manage Subscription- </Button>- )- ) : (- <div className="h-10 w-24 animate-pulse rounded-md bg-border" />- )}- </div>- </div>- </div>- </div> */}</div></AppLayout>);