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.

BIlling updates

Marcus Farrellaa2559f44baa
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/payment-method-types.ts b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/payment-method-types.ts
index c1572e5b19..409767e0ef 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/payment-method-types.ts
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/payment-method-types.ts
@@ -12,6 +12,7 @@ export const PaymentMethodTypesList = (paymentMethod?: Stripe.PaymentMethod) =>
description: paymentMethod?.card
? `Connected ${paymentMethod.card.brand} ***${paymentMethod.card.last4}`
: "No card connected",
+ iconBgColor: "bg-neutral-100",
},
{
type: "us_bank_account",
@@ -25,7 +26,6 @@ export const PaymentMethodTypesList = (paymentMethod?: Stripe.PaymentMethod) =>
type: "link",
title: "Link",
icon: StripeLink,
- iconBgColor: "bg-green-100",
description: paymentMethod?.link
? `Connected Link account ${paymentMethod.link?.email}`
: "No Link account connected",
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/payment-methods.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/payment-methods.tsx
index 31bd54b726..dc67854f00 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/payment-methods.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/payment-methods.tsx
@@ -10,7 +10,7 @@ import { Stripe } from "stripe";
import { PaymentMethodTypesList } from "./payment-method-types";
export default function PaymentMethods() {
- const { slug, stripeId, partnersEnabled } = useWorkspace();
+ const { slug, stripeId, partnersEnabled, plan } = useWorkspace();
const { paymentMethods } = usePaymentMethods();
const regularPaymentMethods = paymentMethods?.filter(
@@ -37,6 +37,10 @@ export default function PaymentMethods() {
setIsLoading(false);
};
+ if (plan === "free") {
+ return null;
+ }
+
return (
<div className="rounded-lg border border-neutral-200 bg-white">
<div className="flex flex-col items-start justify-between gap-y-4 p-6 md:flex-row md:items-center md:p-8">
@@ -56,7 +60,7 @@ export default function PaymentMethods() {
/>
)}
</div>
- <div className="grid gap-4 border-t border-neutral-200 p-6">
+ <div className="grid gap-4 border-t border-neutral-200 bg-neutral-100 p-6">
{regularPaymentMethods ? (
regularPaymentMethods.length > 0 ? (
regularPaymentMethods.map((paymentMethod) => (
@@ -87,7 +91,7 @@ export default function PaymentMethods() {
)}
</div>
{partnersEnabled && achPaymentMethods && (
- <div className="grid gap-4 border-t border-neutral-200 p-6">
+ <div className="grid gap-4 bg-neutral-100 border-neutral-200 px-6 pb-6 drop-shadow-sm rounded-br-lg rounded-bl-lg">
{achPaymentMethods.length > 0 ? (
achPaymentMethods.map((paymentMethod) => (
<PaymentMethodCard
@@ -139,7 +143,7 @@ const PaymentMethodCard = ({
};
return (
- <div className="flex items-center justify-between rounded-lg border border-neutral-200 p-4">
+ <div className="flex items-center justify-between rounded-lg border border-neutral-200 drop-shadow-sm bg-white p-4">
<div className="flex items-center gap-4">
<div
className={cn(
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/plan-usage.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/plan-usage.tsx
index 62a405299c..a267f4f5bd 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/plan-usage.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/billing/plan-usage.tsx
@@ -8,6 +8,7 @@ import PlanBadge from "@/ui/workspaces/plan-badge";
import { buttonVariants, Icon, useRouterStuff } from "@dub/ui";
import {
CircleDollar,
+ CrownSmall,
CursorRays,
Globe,
Hyperlink,
@@ -91,15 +92,27 @@ export default function PlanUsage() {
</p>
</div>
<div className="flex items-center gap-2">
- <Link
- href={`/${slug}/settings/billing/invoices`}
- className={cn(
- buttonVariants({ variant: "secondary" }),
- "flex h-9 w-full items-center justify-center rounded-md border px-4 text-sm",
- )}
- >
- View invoices
- </Link>
+ {plan === "free" ? (
+ <Link
+ href={`/${slug}/upgrade`}
+ className={cn(
+ buttonVariants({ variant: "primary" }),
+ "flex h-9 w-full items-center justify-center rounded-md border px-4 text-sm",
+ )}
+ >
+ Upgrade Plan
+ </Link>
+ ) : (
+ <Link
+ href={`/${slug}/settings/billing/invoices`}
+ className={cn(
+ buttonVariants({ variant: "secondary" }),
+ "flex h-9 w-full items-center justify-center rounded-md border px-4 text-sm",
+ )}
+ >
+ View invoices
+ </Link>
+ )}
{stripeId && <ManageSubscriptionButton />}
</div>
</div>
@@ -127,6 +140,7 @@ export default function PlanUsage() {
usage={salesUsage}
limit={salesLimit}
unit="$"
+ plan={plan}
/>
</div>
<div className="w-full px-2 pb-8 md:px-8">
@@ -154,7 +168,7 @@ export default function PlanUsage() {
/>
</div>
</div>
- {plan !== "enterprise" && (
+ {plan !== "enterprise" && plan !== "free" && (
<div className="flex flex-col items-center justify-between space-y-3 border-t border-neutral-200 px-6 py-4 text-center md:flex-row md:space-y-0 md:px-8 md:text-left">
<p className="text-sm text-neutral-500">
{plan === "business max"
@@ -183,6 +197,7 @@ function UsageTabCard({
usage: usageProp,
limit: limitProp,
unit,
+ plan,
}: {
id: string;
icon: Icon;
@@ -190,6 +205,7 @@ function UsageTabCard({
usage?: number;
limit?: number;
unit?: string;
+ plan: string;
}) {
const { searchParams, queryParams } = useRouterStuff();
@@ -213,15 +229,25 @@ function UsageTabCard({
return (
<button
className={cn(
- "rounded-lg border border-neutral-300 bg-white px-4 py-3 text-left transition-colors duration-75 hover:bg-neutral-50 lg:px-5 lg:py-4",
+ "rounded-lg border border-neutral-300 bg-white px-4 py-3 text-left transition-colors duration-75",
"outline-none focus-visible:border-blue-600 focus-visible:ring-1 focus-visible:ring-blue-600",
isActive && "border-neutral-900 ring-1 ring-neutral-900",
+ plan === "free" || plan === "pro" ? "hover:bg-neutral-100 bg-neutral-100 border-neutral-100" : "hover:bg-neutral-50 lg:px-5 lg:py-4",
)}
aria-selected={isActive}
- onClick={() => queryParams({ set: { tab: id } })}
+ onClick={() => (plan !== "free" && plan !== "pro") && queryParams({ set: { tab: id } })}
+ disabled={plan === "free" || plan === "pro"}
>
<Icon className="size-4 text-neutral-600" />
- <div className="mt-1.5 text-sm text-neutral-600">{title}</div>
+ <div className="mt-1.5 flex items-center gap-2 text-sm text-neutral-600">
+ {title}
+ {id === "revenue" && (plan === "free" || plan === "pro") && (
+ <span className="rounded-full border border-neutral-300 px-2 py-0.5 text-xs text-neutral-500 flex items-center gap-1">
+ <CrownSmall className="size-" />
+ Business
+ </span>
+ )}
+ </div>
<div className="mt-2">
{!loading ? (
<NumberFlow
@@ -232,7 +258,7 @@ function UsageTabCard({
? {
style: "currency",
currency: "USD",
- // @ts-ignore – trailingZeroDisplay is a valid option but TS is outdated
+ // @ts-ignore – trailingZeroDisplay is a valid option but TS is outdated
trailingZeroDisplay: "stripIfInteger",
}
: {
@@ -258,7 +284,10 @@ function UsageTabCard({
>
<div
className={cn(
- "size-full rounded-full bg-gradient-to-r from-blue-500/80 to-blue-600",
+ "size-full rounded-full",
+ plan === "free" || plan === "pro"
+ ? "bg-neutral-900/10"
+ : "bg-gradient-to-r from-blue-500/80 to-blue-600",
warning && "from-neutral-900/10 via-red-500 to-red-600",
)}
style={{
diff --git a/packages/ui/src/icons/card-amex.tsx b/packages/ui/src/icons/card-amex.tsx
new file mode 100644
index 0000000000..659f21984e
--- /dev/null
+++ b/packages/ui/src/icons/card-amex.tsx
@@ -0,0 +1,20 @@
+import { SVGProps } from "react";
+
+export function CardAmex(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="20"
+ fill="none"
+ viewBox="0 0 24 20"
+ {...props}
+ >
+ <path d="M0 10.6879L4.47134 0.598724H8.82803L9.89809 2.8535V0.598724H15.2484L16.1274 2.96815L17.0446 0.598724H22.7006V10.6891L19.1083 14.3185L24 19.4013H17.2357L15.8599 17.7962L14.4459 19.4013H3.63057V10.6879H0Z" fill="#306FC5"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M5.5378 2.01274L2.25117 9.38854H4.42952L4.96455 7.93631H8.51869L9.09194 9.38854H11.2321L7.94544 2.01274H5.5378ZM7.90723 6.40765L6.72251 3.57962L5.5378 6.40765H7.90723Z" fill="white"/>
+ <path d="M21.0919 9.38854V2.01274H17.9964L16.162 6.78981L14.3276 2.01274H11.2703V9.38854H13.1047V3.69427L15.2448 9.38854H17.041L19.1811 3.69427V9.38854H21.0919Z" fill="white"/>
+ <path d="M5.11742 17.949V10.6879H11.2321V12.293H6.95181V13.5924H11.1174V15.121H6.95181V16.4586H11.2321V17.949H5.11742Z" fill="white"/>
+ <path d="M20.4805 10.6879L17.0792 14.3185L20.4805 17.949H17.9964L15.8563 15.6178L13.6779 17.949H11.3085L14.6716 14.3185L11.2703 10.6879H13.6779L15.8563 13.0573L18.0728 10.6879H20.4805Z" fill="white"/>
+ </svg>
+ );
+}
\ No newline at end of file
diff --git a/packages/ui/src/icons/card-discover.tsx b/packages/ui/src/icons/card-discover.tsx
new file mode 100644
index 0000000000..53b59bd912
--- /dev/null
+++ b/packages/ui/src/icons/card-discover.tsx
@@ -0,0 +1,38 @@
+import { SVGProps } from "react";
+
+export function CardDiscover(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="22"
+ height="22"
+ fill="none"
+ viewBox="0 0 22 22"
+ {...props}
+ >
+ <g filter="url(#filter0_i_3233_2334)">
+ <circle cx="11" cy="11" r="10.1145" fill="url(#paint0_linear_3233_2334)"/>
+ </g>
+ <defs>
+ <filter id="filter0_i_3233_2334" x="0.885498" y="0.885483" width="22.229" height="22.229" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
+ <feOffset dx="2" dy="2"/>
+ <feGaussianBlur stdDeviation="1"/>
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
+ <feColorMatrix type="matrix" values="0 0 0 0 0.675732 0 0 0 0 0.189457 0 0 0 0 0.144011 0 0 0 1 0"/>
+ <feBlend mode="normal" in2="shape" result="effect1_innerShadow_3233_2334"/>
+ </filter>
+ <linearGradient id="paint0_linear_3233_2334" x1="0.885498" y1="0.885483" x2="21.1145" y2="21.1145" gradientUnits="userSpaceOnUse">
+ <stop offset="0.28" stop-color="#E0481E"/>
+ <stop offset="0.765" stop-color="#F59214"/>
+ </linearGradient>
+ </defs>
+ </svg>
+ );
+}
+
+
+
+
diff --git a/packages/ui/src/icons/card-mastercard.tsx b/packages/ui/src/icons/card-mastercard.tsx
new file mode 100644
index 0000000000..c6658afdf9
--- /dev/null
+++ b/packages/ui/src/icons/card-mastercard.tsx
@@ -0,0 +1,18 @@
+import { SVGProps } from "react";
+
+export function CardMastercard(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="26"
+ height="16"
+ fill="none"
+ viewBox="0 0 26 16"
+ {...props}
+ >
+ <path d="M16.4812 1.71H9.48193V14.2895H16.4812V1.71Z" fill="#FF5F00"/>
+ <path d="M9.94376 7.99989C9.94267 6.78836 10.2173 5.59245 10.7467 4.50275C11.2762 3.41304 12.0467 2.45811 12.9999 1.71025C11.8197 0.782666 10.4024 0.205831 8.90991 0.045672C7.41742 -0.114488 5.90998 0.148487 4.55988 0.804545C3.20979 1.4606 2.07151 2.48327 1.27514 3.75566C0.478777 5.02805 0.0564575 6.49883 0.0564575 7.99989C0.0564575 9.50095 0.478777 10.9717 1.27514 12.2441C2.07151 13.5165 3.20979 14.5392 4.55988 15.1952C5.90998 15.8513 7.41742 16.1143 8.90991 15.9541C10.4024 15.7939 11.8197 15.2171 12.9999 14.2895C12.0467 13.5417 11.2762 12.5867 10.7467 11.497C10.2173 10.4073 9.94267 9.21142 9.94376 7.99989Z" fill="#EB001B"/>
+ <path d="M17.9436 9.58141e-06C16.1501 -0.00277122 14.4081 0.599824 12.9997 1.71025C13.952 2.45885 14.7219 3.41394 15.2513 4.50348C15.7808 5.59301 16.0558 6.78855 16.0558 7.99989C16.0558 9.21124 15.7808 10.4068 15.2513 11.4963C14.7219 12.5858 13.952 13.5409 12.9997 14.2895C14.0023 15.0776 15.1788 15.6146 16.4311 15.8557C17.6833 16.0968 18.9751 16.0351 20.1987 15.6756C21.4222 15.3161 22.5421 14.6693 23.465 13.7891C24.3878 12.909 25.0869 11.8209 25.5038 10.6157C25.9208 9.41056 26.0436 8.12316 25.862 6.86088C25.6804 5.5986 25.1997 4.39802 24.4599 3.35924C23.7201 2.32047 22.7427 1.4736 21.6092 0.889259C20.4757 0.304914 19.2189 2.34802e-05 17.9436 9.58141e-06Z" fill="#F79E1B"/>
+ </svg>
+ );
+}
\ No newline at end of file
diff --git a/packages/ui/src/icons/card-visa.tsx b/packages/ui/src/icons/card-visa.tsx
new file mode 100644
index 0000000000..22801b7365
--- /dev/null
+++ b/packages/ui/src/icons/card-visa.tsx
@@ -0,0 +1,19 @@
+import { SVGProps } from "react";
+
+export function CardVisa(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="20"
+ height="16"
+ fill="none"
+ viewBox="0 0 20 16"
+ {...props}
+ >
+ <path
+ d="M0.367215 0.000510312L0.279083 0.510302C0.279083 0.510302 1.80807 0.788926 3.18539 1.34516C4.95879 1.98252 5.08484 2.35402 5.38357 3.50628L8.63779 16H13.0003L19.7209 0.000510312H15.3686L11.0501 10.8786L9.28802 1.65746C9.12662 0.602156 8.30781 0 7.30608 0H0.367728L0.367215 0.000510312Z"
+ fill="#1434CB"
+ />
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/index.tsx b/packages/ui/src/icons/index.tsx
index c3d1a34036..7a96d2aab5 100644
--- a/packages/ui/src/icons/index.tsx
+++ b/packages/ui/src/icons/index.tsx
@@ -32,6 +32,12 @@ export * from "./twitter";
export * from "./unsplash";
export * from "./youtube";
+// Card types
+export * from "./card-amex";
+export * from "./card-discover";
+export * from "./card-mastercard";
+export * from "./card-visa";
+
// SDKs
export * from "./go";
export * from "./php";