Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

shipped new pricing changes on landing page (still need to fix up Stripe integration)

Steven Tey4eb4e9985dfc
diff --git a/components/app/settings/plan-usage.tsx b/components/app/settings/plan-usage.tsx
index dd077e201e..b2a57cb5fa 100644
--- a/components/app/settings/plan-usage.tsx
+++ b/components/app/settings/plan-usage.tsx
@@ -155,20 +155,23 @@ export default function PlanUsage() {
project.plan === "free" ? (
<button
onClick={() => {
- setClicked(true);
- fetch(`/api/projects/${slug}/upgrade`, {
- method: "POST",
- })
- .then(async (res) => {
- const data = await res.json();
- const { id: sessionId } = data;
- const stripe = await getStripe();
- stripe.redirectToCheckout({ sessionId });
- })
- .catch((err) => {
- alert(err);
- setClicked(false);
- });
+ alert(
+ "we're fixing up the checkout flow, this will be ready very soon!"
+ );
+ // setClicked(true);
+ // fetch(`/api/projects/${slug}/upgrade`, {
+ // method: "POST",
+ // })
+ // .then(async (res) => {
+ // const data = await res.json();
+ // const { id: sessionId } = data;
+ // const stripe = await getStripe();
+ // stripe.redirectToCheckout({ sessionId });
+ // })
+ // .catch((err) => {
+ // alert(err);
+ // setClicked(false);
+ // });
}}
disabled={clicked}
className={`${
diff --git a/components/home/pricing.tsx b/components/home/pricing.tsx
index 7525c29f3f..79b7380a4b 100644
--- a/components/home/pricing.tsx
+++ b/components/home/pricing.tsx
@@ -1,26 +1,37 @@
import Link from "next/link";
-import { CheckCircleFill, QuestionCircle } from "@/components/shared/icons";
+import {
+ CheckCircleFill,
+ QuestionCircle,
+ XCircleFill,
+} from "@/components/shared/icons";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
-import CountingNumbers from "@/components/shared/counting-numbers";
-import Tooltip from "@/components/shared/tooltip";
+import Tooltip, { OGImageProxy } from "@/components/shared/tooltip";
+import { useState } from "react";
+import Slider from "@/components/shared/slider";
+import { nFormatter } from "@/lib/utils";
const pricingItems = [
{
plan: "Free",
tagline: "For startups & side projects",
- price: 0,
+ clicksLimit: "Up to 1K link clicks/mo",
features: [
{
text: "Free custom domains",
footnote:
"Just bring any domain you own and turn it into a custom domain link shortener for free.",
},
- { text: "Unlimited links" },
+ { text: "Unlimited branded links" },
+ { text: "1 project" },
{
- text: "Up to 1K link clicks/mo",
+ text: "Root domain redirect",
footnote:
- "After that, your existing links will still work and we will still collect data on them, but you need to upgrade to view their stats / add more links.",
+ "Redirect vistors that land on the root of your domain (e.g. yourdomain.com) to a page of your choice.",
+ negative: true,
},
+ { text: "Password-protected links", negative: true },
+ { text: "OG Image Proxy", footnote: <OGImageProxy />, negative: true },
+ { text: "SSO/SAML", negative: true },
],
cta: "Start for free",
ctaLink: "https://app.dub.sh/register",
@@ -28,20 +39,22 @@ const pricingItems = [
{
plan: "Pro",
tagline: "For larger teams with increased usage",
- isPopular: true,
- price: 99,
features: [
{
text: "Free custom domains",
footnote:
"Just bring any domain you own and turn it into a custom domain link shortener for free.",
},
- { text: "Unlimited links" },
+ { text: "Unlimited branded links" },
+ { text: "Unlimited projects" },
{
- text: "Up to 1M link clicks/mo",
+ text: "Root domain redirect",
footnote:
- "After that, your existing links will still work and we will still collect data on them, but you need to upgrade to view their stats / add more links.",
+ "Redirect vistors that land on the root of your domain (e.g. yourdomain.com) to a page of your choice.",
},
+ { text: "Password-protected links" },
+ { text: "OG Image Proxy", footnote: <OGImageProxy /> },
+ { text: "SSO/SAML", negative: true },
],
cta: "Get started",
ctaLink: "https://app.dub.sh/register",
@@ -49,10 +62,22 @@ const pricingItems = [
{
plan: "Enterprise",
tagline: "For businesses with custom needs",
- price: "Custom",
+ clicksLimit: "Unlimited link clicks",
features: [
- { text: "Unlimited links" },
- { text: "Unlimited link clicks" },
+ {
+ text: "Free custom domains",
+ footnote:
+ "Just bring any domain you own and turn it into a custom domain link shortener for free.",
+ },
+ { text: "Unlimited branded links" },
+ { text: "Unlimited projects" },
+ {
+ text: "Root domain redirect",
+ footnote:
+ "Redirect vistors that land on the root of your domain (e.g. yourdomain.com) to a page of your choice.",
+ },
+ { text: "Password-protected links" },
+ { text: "OG Image Proxy", footnote: <OGImageProxy /> },
{ text: "SSO/SAML" },
],
cta: "Contact us",
@@ -60,7 +85,36 @@ const pricingItems = [
},
];
+const proTiers = [
+ {
+ price: 9,
+ quota: 10000,
+ },
+ {
+ price: 19,
+ quota: 25000,
+ },
+ {
+ price: 29,
+ quota: 50000,
+ },
+ {
+ price: 49,
+ quota: 100000,
+ },
+ {
+ price: 79,
+ quota: 500000,
+ },
+ {
+ price: 99,
+ quota: 1000000,
+ },
+];
+
const Pricing = () => {
+ const [tier, setTier] = useState(0);
+
return (
<MaxWidthWrapper className="mt-20 mb-40 text-center">
<div className="max-w-sm sm:max-w-md mx-auto my-10">
@@ -77,16 +131,16 @@ const Pricing = () => {
</div>
<div className="grid grid-cols-1 lg:grid-cols-3 gap-10">
{pricingItems.map(
- ({ plan, tagline, isPopular, price, features, cta, ctaLink }) => (
+ ({ plan, tagline, clicksLimit, features, cta, ctaLink }) => (
<div
key={plan}
className={`relative bg-white rounded-2xl ${
- isPopular
+ plan === "Pro"
? "border-2 border-blue-600 shadow-blue-200"
: "border border-gray-200"
} shadow-md`}
>
- {isPopular && (
+ {plan === "Pro" && (
<div className="absolute -top-5 left-0 right-0 mx-auto bg-gradient-to-r from-blue-600 to-cyan-600 text-white text-sm font-medium w-32 px-3 py-2 rounded-full">
Popular
</div>
@@ -96,40 +150,66 @@ const Pricing = () => {
{plan}
</h3>
<p className="text-gray-500">{tagline}</p>
- {typeof price === "number" ? (
+ {plan === "Enterprise" ? (
+ <p className="my-5 text-6xl font-display font-semibold">
+ Custom
+ </p>
+ ) : (
<div className="my-5 flex justify-center">
- <p className="text-6xl font-display font-semibold">$</p>
- <CountingNumbers
- value={price}
- reverse={true}
- className="text-6xl font-display font-semibold"
+ <p className="text-6xl font-display font-semibold">
+ ${plan === "Pro" ? proTiers[tier].price : 0}
+ </p>
+ </div>
+ )}
+ <p className="text-gray-500">Monthly</p>
+ </div>
+ <div className="border-t border-b border-gray-200 flex items-center justify-center h-20 bg-gray-50">
+ {plan === "Pro" ? (
+ <div className="flex flex-col space-y-1">
+ <Slider
+ value={tier}
+ setValue={setTier}
+ maxValue={proTiers.length - 1}
/>
+ <p className="text-gray-600 text-sm">
+ Up to {nFormatter(proTiers[tier].quota)} link clicks/mo
+ </p>
</div>
) : (
- <p className="my-5 text-6xl font-display font-semibold">
- {price}
- </p>
+ <p className="text-gray-600">{clicksLimit}</p>
)}
- <p className="text-gray-500">Monthly</p>
</div>
- <div className="border-t border-gray-200" />
<ul className="px-10 my-10 space-y-5">
- {features.map((feature) => (
- <li key={feature} className="flex space-x-5">
+ {features.map(({ text, footnote, negative }) => (
+ <li key={text} className="flex space-x-5">
<div className="flex-shrink-0">
- <CheckCircleFill className="w-6 h-6 text-green-500" />
+ {negative ? (
+ <XCircleFill className="w-6 h-6 text-gray-300" />
+ ) : (
+ <CheckCircleFill className="w-6 h-6 text-green-500" />
+ )}
</div>
- {feature.footnote ? (
+ {footnote ? (
<div className="flex items-center">
- <p className="text-gray-600">{feature.text}</p>
- <Tooltip content={feature.footnote}>
+ <p
+ className={
+ negative ? "text-gray-400" : "text-gray-600"
+ }
+ >
+ {text}
+ </p>
+ <Tooltip content={footnote}>
<div className="flex justify-center w-8 h-4">
<QuestionCircle className="w-4 h-4 text-gray-600" />
</div>
</Tooltip>
</div>
) : (
- <p className="text-gray-600">{feature.text}</p>
+ <p
+ className={negative ? "text-gray-400" : "text-gray-600"}
+ >
+ {text}
+ </p>
)}
</li>
))}
@@ -139,7 +219,7 @@ const Pricing = () => {
<Link href={ctaLink}>
<a
className={`${
- isPopular
+ plan === "Pro"
? "bg-gradient-to-r from-blue-600 to-cyan-600 hover:bg-white text-white hover:text-transparent hover:bg-clip-text border border-transparent hover:border-blue-700"
: "bg-black text-white hover:bg-white hover:text-black border border-gray-200 hover:border-black"
} block w-full py-2 rounded-full font-medium transition-all`}
diff --git a/components/shared/slider.tsx b/components/shared/slider.tsx
new file mode 100644
index 0000000000..9b2a631080
--- /dev/null
+++ b/components/shared/slider.tsx
@@ -0,0 +1,35 @@
+import * as SliderPrimitive from "@radix-ui/react-slider";
+import { Dispatch, SetStateAction } from "react";
+
+const Slider = ({
+ value,
+ setValue,
+ minValue,
+ maxValue,
+ stepValue,
+}: {
+ value: number;
+ setValue: Dispatch<SetStateAction<number>>;
+ minValue?: number;
+ maxValue?: number;
+ stepValue?: number;
+}) => {
+ return (
+ <SliderPrimitive.Root
+ defaultValue={[value]}
+ min={minValue || 0}
+ max={maxValue || 100}
+ step={stepValue || 1}
+ aria-label="value"
+ onValueChange={(value) => setValue(value[0])}
+ className="relative flex h-5 w-64 touch-none items-center"
+ >
+ <SliderPrimitive.Track className="relative h-1 w-full grow rounded-full bg-gray-200">
+ <SliderPrimitive.Range className="absolute h-full rounded-full bg-gradient-to-r from-blue-600 to-cyan-600" />
+ </SliderPrimitive.Track>
+ <SliderPrimitive.Thumb className="block h-5 w-5 cursor-grab active:cursor-grabbing rounded-full bg-gradient-to-r from-blue-600 to-cyan-600 focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75" />
+ </SliderPrimitive.Root>
+ );
+};
+
+export default Slider;
diff --git a/components/shared/tooltip.tsx b/components/shared/tooltip.tsx
index ebd97bd0b5..d7cbb0028b 100644
--- a/components/shared/tooltip.tsx
+++ b/components/shared/tooltip.tsx
@@ -36,6 +36,7 @@ export default function Tooltip({
/* Tooltip Contents */
import Link from "next/link";
+import BlurImage from "@/components/shared/blur-image";
export function TooltipContent({
title,
@@ -57,3 +58,22 @@ export function TooltipContent({
</div>
);
}
+
+export function OGImageProxy() {
+ return (
+ <div className="max-w-md flex flex-col text-center items-center space-y-5 p-5">
+ <BlurImage
+ alt="Demo GIF for OG Image Proxy"
+ src="https://res.cloudinary.com/dubdotsh/image/upload/v1664425639/og-image-proxy-demo.gif"
+ width={1200}
+ height={1084}
+ className="w-full rounded-md overflow-hidden shadow-md"
+ />
+ <p className="text-sm text-gray-700">
+ Add a custom OG image in front of your target URL. Bots like
+ Twitter/Facebook will be served this image, while users will be
+ redirected to your target URL.
+ </p>
+ </div>
+ );
+}