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.

feat: add credits on upgrade

flooorianflof44d7ebddf9a
diff --git a/apps/web/app/api/callback/stripe/route.ts b/apps/web/app/api/callback/stripe/route.ts
index 0770d3d0fb..d530e30557 100644
--- a/apps/web/app/api/callback/stripe/route.ts
+++ b/apps/web/app/api/callback/stripe/route.ts
@@ -77,6 +77,7 @@ export const POST = async (req: Request) => {
usageLimit: plan.limits.clicks!,
linksLimit: plan.limits.links!,
domainsLimit: plan.limits.domains!,
+ aiLimit: plan.limits.ai!,
tagsLimit: plan.limits.tags!,
usersLimit: plan.limits.users!,
},
diff --git a/apps/web/ui/modals/add-edit-link-modal/tooltip-button.tsx b/apps/web/ui/modals/add-edit-link-modal/tooltip-button.tsx
index 66d989ab3c..31b114e352 100644
--- a/apps/web/ui/modals/add-edit-link-modal/tooltip-button.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/tooltip-button.tsx
@@ -31,7 +31,7 @@ export default function TooltipButton() {
const { queryParams } = useRouterStuff();
const { plan, nextPlan } = useWorkspace();
- const showUsage = plan === "free" || plan === "pro" || plan === "business";
+ const showUsage = plan === "free" || plan === "pro";
return (
<Tooltip
@@ -40,13 +40,12 @@ export default function TooltipButton() {
ai.data.usage < ai.data.limit ? (
<div className="flex items-center gap-4 px-4 py-2">
<div>
- <span className="block max-w-xs text-center text-sm text-gray-700">
+ <span className="block max-w-xs text-left text-sm text-gray-700">
{ai.title}
</span>
<span className="text-xs text-gray-500">
- {showUsage
- ? `${ai.data.limit - ai.data.usage} / ${ai.data.limit} AI credits left`
- : "Unlimited credits left"}
+ {showUsage &&
+ `${ai.data.limit - ai.data.usage} / ${ai.data.limit} AI credits left`}
</span>
</div>
{showUsage ? (
@@ -65,7 +64,9 @@ export default function TooltipButton() {
]}
/>
) : (
- <Infinity className="h-6 w-6 text-gray-500" />
+ <div className="rounded-full border-4 border-black p-1">
+ <Infinity className="h-6 w-6" />
+ </div>
)}
</div>
) : (
diff --git a/packages/utils/src/constants/pricing.tsx b/packages/utils/src/constants/pricing.tsx
index c89dd2152b..acf2b61ca6 100644
--- a/packages/utils/src/constants/pricing.tsx
+++ b/packages/utils/src/constants/pricing.tsx
@@ -9,7 +9,7 @@ const BUSINESS_PLAN_MODIFIER = ({
domains = 40,
tags = 150,
users = 15,
- aiCredits = "∞",
+ ai = 10000,
ids = [],
}: {
name: string;
@@ -19,7 +19,7 @@ const BUSINESS_PLAN_MODIFIER = ({
clicks: number;
domains: number;
users: number;
- aiCredits?: string;
+ ai: number;
tags: number;
ids: string[];
}) => ({
@@ -37,6 +37,7 @@ const BUSINESS_PLAN_MODIFIER = ({
domains,
tags,
users,
+ ai,
},
colors: {
bg: "bg-sky-900",
@@ -57,7 +58,7 @@ const BUSINESS_PLAN_MODIFIER = ({
{ text: "2-year analytics retention" },
{ text: `${domains} custom domains` },
{ text: `${users} users` },
- { text: `${aiCredits} AI credits` },
+ { text: `∞ AI credits` },
{
text: `${nFormatter(tags, { full: true })} tags`,
footnote: {
@@ -93,6 +94,7 @@ export const PLANS = [
domains: 3,
tags: 5,
users: 1,
+ ai: 10,
},
colors: {
bg: "bg-black",
@@ -149,6 +151,7 @@ export const PLANS = [
domains: 10,
tags: 25,
users: 5,
+ ai: 1000,
},
colors: {
bg: "bg-blue-500",
@@ -196,7 +199,7 @@ export const PLANS = [
domains: 40,
tags: 150,
users: 15,
- aiCredits: "∞",
+ ai: 10000,
ids: [
"price_1LodLoAlJJEpqkPV9rD0rlNL", // old monthly
"price_1LodLoAlJJEpqkPVJdwv5zrG", // oldest yearly
@@ -216,7 +219,7 @@ export const PLANS = [
domains: 100,
tags: 300,
users: 40,
- aiCredits: "∞",
+ ai: 10000,
ids: [
"price_1OnWu0AlJJEpqkPVWk4144ZG", // monthly (test)
"price_1OnWu0AlJJEpqkPVkDWVriAB", // yearly (test)
@@ -233,7 +236,7 @@ export const PLANS = [
domains: 250,
tags: 500,
users: 100,
- aiCredits: "∞",
+ ai: 10000,
ids: [
"price_1OnWvCAlJJEpqkPVLzLHx5QD", // monthly (test)
"price_1OnWvCAlJJEpqkPVHhCCvIOq", // yearly (test)
@@ -250,7 +253,7 @@ export const PLANS = [
domains: 500,
tags: 1000,
users: 250,
- aiCredits: "∞",
+ ai: 10000,
ids: [
"price_1OnWwLAlJJEpqkPVXtJyPqLk", // monthly (test)
"price_1OnWwLAlJJEpqkPV4eMbOkNh", // yearly (test)