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.

fix UpgradeToProToast

Steven Tey14117007ed5f
diff --git a/apps/web/ui/modals/add-edit-link-modal/index.tsx b/apps/web/ui/modals/add-edit-link-modal/index.tsx
index 8921c2db73..693fbacfbc 100644
--- a/apps/web/ui/modals/add-edit-link-modal/index.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/index.tsx
@@ -167,7 +167,12 @@ function AddEditLinkModal({
api: `/api/ai/completion?workspaceId=${workspaceId}`,
onError: (error) => {
if (error.message.includes("Upgrade to Pro")) {
- toast.custom(() => <UpgradeToProToast message={error.message} />);
+ toast.custom(() => (
+ <UpgradeToProToast
+ title="You've exceeded your AI usage limit"
+ message={error.message}
+ />
+ ));
} else {
toast.error(error.message);
}
@@ -433,7 +438,10 @@ function AddEditLinkModal({
if (error) {
if (error.message.includes("Upgrade to Pro")) {
toast.custom(() => (
- <UpgradeToProToast message={error.message} />
+ <UpgradeToProToast
+ title="You've discovered a Pro feature!"
+ message={error.message}
+ />
));
} else {
toast.error(error.message);
diff --git a/apps/web/ui/modals/add-edit-link-modal/og-section.tsx b/apps/web/ui/modals/add-edit-link-modal/og-section.tsx
index 65aa0e821d..fa5ea30190 100644
--- a/apps/web/ui/modals/add-edit-link-modal/og-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/og-section.tsx
@@ -47,7 +47,12 @@ export default function OGSection({
id: "metatags-title-ai",
onError: (error) => {
if (error.message.includes("Upgrade to Pro")) {
- toast.custom(() => <UpgradeToProToast message={error.message} />);
+ toast.custom(() => (
+ <UpgradeToProToast
+ title="You've exceeded your AI usage limit"
+ message={error.message}
+ />
+ ));
} else {
toast.error(error.message);
}
@@ -76,7 +81,12 @@ export default function OGSection({
id: "metatags-description-ai",
onError: (error) => {
if (error.message.includes("Upgrade to Pro")) {
- toast.custom(() => <UpgradeToProToast message={error.message} />);
+ toast.custom(() => (
+ <UpgradeToProToast
+ title="You've exceeded your AI usage limit"
+ message={error.message}
+ />
+ ));
} else {
toast.error(error.message);
}
diff --git a/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx b/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx
index c2d73cbcd1..b9fd2594e0 100644
--- a/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx
@@ -2,7 +2,6 @@ import useTags from "@/lib/swr/use-tags";
import useWorkspace from "@/lib/swr/use-workspace";
import { LinkWithTagsProps, TagProps } from "@/lib/types";
import TagBadge from "@/ui/links/tag-badge";
-import { UpgradeToProToast } from "@/ui/shared/upgrade-to-pro-toast";
import {
Badge,
LoadingCircle,
@@ -41,11 +40,7 @@ export default function TagsSection({
const { complete } = useCompletion({
api: `/api/ai/completion?workspaceId=${workspaceId}`,
onError: (error) => {
- if (error.message.includes("Upgrade to Pro")) {
- toast.custom(() => <UpgradeToProToast message={error.message} />);
- } else {
- toast.error(error.message);
- }
+ toast.error(error.message);
},
onFinish: (_, completion) => {
mutateWorkspace();
diff --git a/apps/web/ui/shared/upgrade-to-pro-toast.tsx b/apps/web/ui/shared/upgrade-to-pro-toast.tsx
index cf679b94a7..5f74b2964c 100644
--- a/apps/web/ui/shared/upgrade-to-pro-toast.tsx
+++ b/apps/web/ui/shared/upgrade-to-pro-toast.tsx
@@ -4,14 +4,20 @@ import { useRouterStuff } from "@dub/ui";
import { Crown } from "lucide-react";
import Link from "next/link";
-export const UpgradeToProToast = ({ message }: { message: string }) => {
+export const UpgradeToProToast = ({
+ title,
+ message,
+}: {
+ title: string;
+ message: string;
+}) => {
const { queryParams } = useRouterStuff();
return (
<div className="flex flex-col space-y-3 rounded-lg bg-white p-6 shadow-lg">
<div className="flex items-center space-x-1.5">
<Crown className="h-5 w-5 text-black" />{" "}
- <p className="font-semibold">You've discovered a Pro feature!</p>
+ <p className="font-semibold">{title}</p>
</div>
<p className="text-sm text-gray-600">{message}</p>
<Link
diff --git a/packages/utils/src/constants/pricing.tsx b/packages/utils/src/constants/pricing.tsx
index 1d32dac944..ea8dd795b2 100644
--- a/packages/utils/src/constants/pricing.tsx
+++ b/packages/utils/src/constants/pricing.tsx
@@ -35,7 +35,7 @@ const BUSINESS_PLAN_MODIFIER = ({
domains,
tags,
users,
- ai: 10000000,
+ ai: 1000,
},
colors: {
bg: "bg-sky-900",
@@ -149,7 +149,7 @@ export const PLANS = [
domains: 10,
tags: 25,
users: 5,
- ai: 10000000,
+ ai: 1000,
},
colors: {
bg: "bg-blue-500",