The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add additional business tiers
Steven Tey66c643cfa573
diff --git a/apps/web/app/api/callback/stripe/route.ts b/apps/web/app/api/callback/stripe/route.tsindex 8eb834652d..4190bbcba9 100644--- a/apps/web/app/api/callback/stripe/route.ts+++ b/apps/web/app/api/callback/stripe/route.ts@@ -3,6 +3,7 @@ import prisma from "@/lib/prisma";import { stripe } from "@/lib/stripe";import { redis } from "@/lib/upstash";import { FREE_PLAN, getPlanFromPriceId, log } from "@dub/utils";+import slugify from "@sindresorhus/slugify";import { sendEmail } from "emails";import UpgradeEmail from "emails/upgrade-email";import { NextResponse } from "next/server";@@ -78,7 +79,7 @@ export const POST = async (req: Request) => {domainsLimit: plan.limits.domains!,tagsLimit: plan.limits.tags!,usersLimit: plan.limits.users!,- plan: plan.name.toLowerCase(),+ plan: slugify(plan.name),},select: {users: {@@ -108,7 +109,7 @@ export const POST = async (req: Request) => {react: UpgradeEmail({name: user.name,email: user.email as string,- plan: plan.name,+ plan: slugify(plan.name),}),marketing: true,}),@@ -162,7 +163,7 @@ export const POST = async (req: Request) => {domainsLimit: plan.limits.domains!,tagsLimit: plan.limits.tags!,usersLimit: plan.limits.users!,- plan: plan.name.toLowerCase(),+ plan: slugify(plan.name),},select: {users: {diff --git a/apps/web/app/api/cron/usage/utils.ts b/apps/web/app/api/cron/usage/utils.tsindex 9f8931c114..00c3e5089c 100644--- a/apps/web/app/api/cron/usage/utils.ts+++ b/apps/web/app/api/cron/usage/utils.ts@@ -196,7 +196,7 @@ export const updateUsage = async (skip?: number) => {? usage < usageLimit * 2: plan === "pro"? usage < usageLimit * 1.5- : plan === "business"+ : plan.startsWith("business")? usage < usageLimit * 1.2: true;diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/page-client.tsxindex 4c1047b047..1690ce05f2 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/page-client.tsx@@ -7,7 +7,7 @@ import PlanBadge from "@/ui/projects/plan-badge";import { Divider } from "@/ui/shared/icons";import ProgressBar from "@/ui/shared/progress-bar";import { Button, InfoTooltip, NumberTooltip, useRouterStuff } from "@dub/ui";-import { HOME_DOMAIN, getFirstAndLastDay, nFormatter } from "@dub/utils";+import { HOME_DOMAIN, PLANS, getFirstAndLastDay, nFormatter } from "@dub/utils";import va from "@vercel/analytics";import { useRouter, useSearchParams } from "next/navigation";import { useEffect, useMemo, useState } from "react";@@ -72,6 +72,9 @@ export default function ProjectBillingClient() {}}, [searchParams, plan]);+ const nextPlan =+ PLANS[PLANS.findIndex((p) => p.name.toLowerCase() === plan) + 1];+return (<><Confetti active={confetti} config={{ elementCount: 200, spread: 90 }} />@@ -149,11 +152,9 @@ export default function ProjectBillingClient() {<p className="text-sm text-gray-500">{plan === "enterprise"? "You're on the Enterprise plan."- : plan === "business"- ? "Need more clicks or links? Contact us for an Enterprise quote."- : `For higher limits, upgrade to the ${- plan === "free" ? "Pro" : "Business"- } plan.`}+ : plan === "business-max"+ ? "Need more clicks or links? Contact us for an Enterprise quote."+ : `For higher limits, upgrade to the ${nextPlan.name} plan.`}</p>) : (<div className="h-3 w-28 animate-pulse rounded-full bg-gray-200" />@@ -172,7 +173,7 @@ export default function ProjectBillingClient() {}variant="success"/>- ) : plan === "business" ? (+ ) : plan === "business-max" ? (<ahref={`${HOME_DOMAIN}/enterprise`}target="_blank"diff --git a/apps/web/emails/links-limit.tsx b/apps/web/emails/links-limit.tsxindex 4df10fcd9a..c58789596b 100644--- a/apps/web/emails/links-limit.tsx+++ b/apps/web/emails/links-limit.tsx@@ -78,7 +78,7 @@ export default function LinksLimitAlert({links) in your current billing cycle.</Text>- {plan === "business" || plan === "enterprise" ? (+ {plan === "business-max" || plan === "enterprise" ? (<Text className="text-sm leading-6 text-black">Since you're on the {capitalize(plan)} plan, you will still beable to create links even after you hit your limit. We'rediff --git a/apps/web/lib/types.ts b/apps/web/lib/types.tsindex a2d3efaee5..b8531e483b 100644--- a/apps/web/lib/types.ts+++ b/apps/web/lib/types.ts@@ -58,7 +58,14 @@ export type TagColorProps =| "pink"| "brown";-export type PlanProps = "free" | "pro" | "business" | "enterprise";+export type PlanProps =+ | "free"+ | "pro"+ | "business"+ | "business-plus"+ | "business-extra"+ | "business-max"+ | "enterprise";export interface ProjectProps {id: string;diff --git a/apps/web/ui/modals/upgrade-plan-modal.tsx b/apps/web/ui/modals/upgrade-plan-modal.tsxindex 2933ec5d05..8b25b63b33 100644--- a/apps/web/ui/modals/upgrade-plan-modal.tsx+++ b/apps/web/ui/modals/upgrade-plan-modal.tsx@@ -105,7 +105,8 @@ function UpgradePlanModal({className="text-center text-sm text-gray-500"variants={STAGGER_CHILD_VARIANTS}>- Enjoy higher limits and extra features with Dub.co {currentPlan.name}+ Enjoy higher limits and extra features <br /> with Dub.co{" "}+ {currentPlan.name}</motion.p></motion.div><div className="bg-gray-50 px-4 py-6 text-left sm:px-16">diff --git a/apps/web/ui/projects/plan-badge.tsx b/apps/web/ui/projects/plan-badge.tsxindex 7e2564f89e..c7a3294103 100644--- a/apps/web/ui/projects/plan-badge.tsx+++ b/apps/web/ui/projects/plan-badge.tsx@@ -7,11 +7,11 @@ export default function PlanBadge({ plan }: { plan: PlanProps }) {variant={plan === "enterprise"? "violet"- : plan === "business"- ? "sky"- : plan === "pro"- ? "blue"- : "black"+ : plan.startsWith("business")+ ? "sky"+ : plan === "pro"+ ? "blue"+ : "black"}>{plan}diff --git a/packages/utils/src/constants/pricing.tsx b/packages/utils/src/constants/pricing.tsxindex b9d863e9ad..5d90c9e40e 100644--- a/packages/utils/src/constants/pricing.tsx+++ b/packages/utils/src/constants/pricing.tsx@@ -1,3 +1,71 @@+import { nFormatter } from "../functions";++const BUSINESS_PLAN = ({+ name = "Business",+ monthly = 49,+ yearly = 39,+ links = 5000,+ clicks = 150000,+ ids = [],+}: {+ name: string;+ monthly: number;+ yearly: number;+ links: number;+ clicks: number;+ ids: string[];+}) => ({+ name,+ tagline: "For larger teams with increased usage",+ link: "https://dub.co/help/article/business-plan",+ price: {+ monthly,+ yearly,+ ids,+ },+ limits: {+ links,+ clicks,+ domains: 20,+ tags: 150,+ users: 15,+ },+ colors: {+ bg: "bg-sky-900",+ text: "text-sky-900",+ },+ cta: {+ text: "Get started with Business",+ shortText: "Get started",+ href: "https://app.dub.co/register",+ color: "bg-sky-900 border-sky-900 hover:text-sky-900",+ },+ featureTitle: "Everything in Pro, plus:",+ features: [+ { text: `${nFormatter(links, { full: true })} links/mo` },+ {+ text: `${nFormatter(clicks)} tracked clicks/mo`,+ },+ { text: "2-year analytics retention" },+ { text: "20 custom domains" },+ { text: "15 users" },+ { text: "Elevated support", footnote: "Email and chat support." },+ {+ text: "Custom branding",+ footnote: {+ title:+ "Set custom QR code logos, password-protected links logos, and more.",+ cta: "Learn more.",+ href: "https://dub.co/help/article/custom-qr-codes",+ },+ },+ {+ text: "Event callbacks (Beta)",+ footnote: "Get notified when someone clicks on your links.",+ },+ ],+});+export const PLANS = [{name: "Free",@@ -104,63 +172,44 @@ export const PLANS = [},],},- {+ BUSINESS_PLAN({name: "Business",- tagline: "For larger teams with increased usage",- link: "https://dub.co/help/article/business-plan",- price: {- monthly: 49,- yearly: 39,- ids: [- "price_1LodLoAlJJEpqkPVJdwv5zrG", // old yearly- "price_1LoyrCAlJJEpqkPVZ32BV3wm", // new monthly (test)- "price_1LodLoAlJJEpqkPV9rD0rlNL", // old & new monthly (prod, no change)- "price_1OTcRzAlJJEpqkPV6G9iP0Tb", // new yearly (test)- "price_1OZgmnAlJJEpqkPVOj4kV64R", // new yearly (prod)- ],- },- limits: {- links: 5000,- clicks: 250000,- domains: 20,- tags: 150,- users: 15,- },- colors: {- bg: "bg-sky-900",- text: "text-sky-900",- },- cta: {- text: "Get started with Business",- shortText: "Get started",- href: "https://app.dub.co/register",- color: "bg-sky-900 border-sky-900 hover:text-sky-900",- },- featureTitle: "Everything in Pro, plus:",- features: [- { text: "5,000 links/mo" },- {- text: "250K tracked clicks/mo",- },- { text: "2-year analytics retention" },- { text: "20 custom domains" },- { text: "15 users" },- { text: "Elevated support", footnote: "Email and chat support." },- {- text: "Custom branding",- footnote: {- title:- "Set custom QR code logos, password-protected links logos, and more.",- cta: "Learn more.",- href: "https://dub.co/help/article/custom-qr-codes",- },- },- {- text: "Event callbacks (Beta)",- footnote: "Get notified when someone clicks on your links.",- },+ monthly: 49,+ yearly: 39,+ links: 5000,+ clicks: 150000,+ ids: [+ "price_1LodLoAlJJEpqkPVJdwv5zrG", // old yearly+ "price_1LoyrCAlJJEpqkPVZ32BV3wm", // new monthly (test)+ "price_1LodLoAlJJEpqkPV9rD0rlNL", // old & new monthly (prod, no change)+ "price_1OTcRzAlJJEpqkPV6G9iP0Tb", // new yearly (test)+ "price_1OZgmnAlJJEpqkPVOj4kV64R", // new yearly (prod)],- },+ }),+ BUSINESS_PLAN({+ name: "Business Plus",+ monthly: 119,+ yearly: 99,+ links: 10000,+ clicks: 400000,+ ids: [],+ }),+ BUSINESS_PLAN({+ name: "Business Extra",+ monthly: 249,+ yearly: 199,+ links: 40000,+ clicks: 1000000,+ ids: [],+ }),+ BUSINESS_PLAN({+ name: "Business Max",+ monthly: 499,+ yearly: 399,+ links: 100000,+ clicks: 2500000,+ ids: [],+ }),{name: "Enterprise",tagline:@@ -202,7 +251,7 @@ export const PLANS = [export const FREE_PLAN = PLANS.find((plan) => plan.name === "Free")!;export const SELF_SERVE_PAID_PLANS = PLANS.filter(- (p) => p.name === "Pro" || p.name === "Business",+ (p) => p.name !== "Free" && p.name !== "Enterprise",);export const FREE_PROJECTS_LIMIT = 2;