The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fixed everything else
Steven Teydd6570807a1e
diff --git a/apps/web/app/app.dub.co/(redirects)/analytics/page.tsx b/apps/web/app/app.dub.co/(redirects)/analytics/page.tsxindex 85e2c8523b..c7f13c0774 100644--- a/apps/web/app/app.dub.co/(redirects)/analytics/page.tsx+++ b/apps/web/app/app.dub.co/(redirects)/analytics/page.tsx@@ -6,8 +6,8 @@ export default async function OldLinksAnalytics({}: {searchParams: { [key: string]: string };}) {- const projects = await getWorkspaces();- if (!projects || projects.length === 0) {+ const workspaces = await getWorkspaces();+ if (!workspaces || workspaces.length === 0) {redirect("/");}@@ -21,6 +21,6 @@ export default async function OldLinksAnalytics({const queryString = newParams.toString();redirect(- `/${projects[0].slug}/analytics${queryString ? `?${queryString}` : ""}`,+ `/${workspaces[0].slug}/analytics${queryString ? `?${queryString}` : ""}`,);}diff --git a/apps/web/app/app.dub.co/(redirects)/links/[key]/page.tsx b/apps/web/app/app.dub.co/(redirects)/links/[key]/page.tsxindex 1a27630ac7..043bd13791 100644--- a/apps/web/app/app.dub.co/(redirects)/links/[key]/page.tsx+++ b/apps/web/app/app.dub.co/(redirects)/links/[key]/page.tsx@@ -8,9 +8,9 @@ export default async function OldLinksStatsPage({key: string;};}) {- const projects = await getWorkspaces();- if (!projects || projects.length === 0) {+ const workspaces = await getWorkspaces();+ if (!workspaces || workspaces.length === 0) {redirect("/");}- redirect(`/${projects[0].slug}/analytics?domain=dub.sh&key=${params.key}`);+ redirect(`/${workspaces[0].slug}/analytics?domain=dub.sh&key=${params.key}`);}diff --git a/apps/web/app/app.dub.co/(redirects)/links/page.tsx b/apps/web/app/app.dub.co/(redirects)/links/page.tsxindex f9bd963fff..6ab4e51114 100644--- a/apps/web/app/app.dub.co/(redirects)/links/page.tsx+++ b/apps/web/app/app.dub.co/(redirects)/links/page.tsx@@ -2,9 +2,9 @@ import { getWorkspaces } from "@/lib/fetchers";import { redirect } from "next/navigation";export default async function OldLinksPage() {- const projects = await getWorkspaces();- if (!projects || projects.length === 0) {+ const workspaces = await getWorkspaces();+ if (!workspaces || workspaces.length === 0) {redirect("/");}- redirect(`/${projects[0].slug}`);+ redirect(`/${workspaces[0].slug}`);}diff --git a/apps/web/emails/clicks-summary.tsx b/apps/web/emails/clicks-summary.tsxindex 34c6f0886d..e3552ddeae 100644--- a/apps/web/emails/clicks-summary.tsx+++ b/apps/web/emails/clicks-summary.tsx@@ -83,7 +83,7 @@ export default function ClicksSummary({Your 30-day {appName} summary for {workspaceName}</Heading><Text className="text-sm leading-6 text-black">- In the last 30 days, your {appName} project,{" "}+ In the last 30 days, your {appName} workspace,{" "}<strong>{workspaceName}</strong> received{" "}<strong>{nFormatter(totalClicks)} link clicks</strong>. You alsocreated <strong>{createdLinks} new links</strong> during thatdiff --git a/apps/web/emails/welcome-email.tsx b/apps/web/emails/welcome-email.tsxindex 8c6ac13a9a..b242ff81aa 100644--- a/apps/web/emails/welcome-email.tsx+++ b/apps/web/emails/welcome-email.tsx@@ -58,10 +58,10 @@ export default function WelcomeEmail({<Text className="ml-1 text-sm leading-4 text-black">◆ Create a{" "}<Link- href="https://app.dub.co"+ href="https://app.dub.co?newWorkspace=true"className="font-medium text-blue-600 no-underline">- new project+ new workspace</Link>{" "}and{" "}<Linkdiff --git a/apps/web/lib/auth/options.ts b/apps/web/lib/auth/options.tsindex c90ef57d89..330fe5b013 100644--- a/apps/web/lib/auth/options.ts+++ b/apps/web/lib/auth/options.ts@@ -240,24 +240,24 @@ export const authOptions: NextAuthOptions = {if (!samlProfile?.requested?.tenant) {return false;}- const project = await prisma.project.findUnique({+ const workspace = await prisma.project.findUnique({where: {id: samlProfile.requested.tenant,},});- if (project) {+ if (workspace) {await Promise.allSettled([- // add user to project+ // add user to workspaceprisma.projectUsers.upsert({where: {userId_projectId: {- projectId: project.id,+ projectId: workspace.id,userId: user.id,},},update: {},create: {- projectId: project.id,+ projectId: workspace.id,userId: user.id,},}),@@ -266,7 +266,7 @@ export const authOptions: NextAuthOptions = {where: {email_projectId: {email: user.email,- projectId: project.id,+ projectId: workspace.id,},},}),diff --git a/apps/web/ui/analytics/index.tsx b/apps/web/ui/analytics/index.tsxindex 208ba41504..45bfcee2ac 100644--- a/apps/web/ui/analytics/index.tsx+++ b/apps/web/ui/analytics/index.tsx@@ -1,11 +1,8 @@"use client";/*- This Stats component lives in 3 different places:- 1. Project link page, e.g. app.dub.co/dub/d.to/github- 2. Generic Dub.co link page, e.g. app.dub.co/links/steven- 3. Public stats page, e.g. dub.co/stats/github, stey.me/stats/weathergpt-- We use the `useEndpoint()` hook to get the correct layout+ This Analytics component lives in 2 different places:+ 1. Workspace analytics page, e.g. app.dub.co/dub/analytics+ 2. Public stats page, e.g. dub.co/stats/github, stey.me/stats/weathergpt*/import { VALID_ANALYTICS_FILTERS } from "@/lib/analytics";@@ -61,7 +58,7 @@ export default function Analytics({const tagId = searchParams?.get("tagId") ?? undefined;const { basePath, domain, baseApiPath } = useMemo(() => {- // Project link analytics page, e.g. app.dub.co/dub/analytics?domain=dub.sh&key=github+ // Workspace analytics page, e.g. app.dub.co/dub/analytics?domain=dub.sh&key=githubif (slug) {return {basePath: `/${slug}/analytics`,diff --git a/apps/web/ui/layout/upgrade-banner.tsx b/apps/web/ui/layout/upgrade-banner.tsxindex a95bff81a3..5671e69367 100644--- a/apps/web/ui/layout/upgrade-banner.tsx+++ b/apps/web/ui/layout/upgrade-banner.tsx@@ -25,8 +25,8 @@ export default function UpgradeBanner() {});/* show pro banner if:- free plan- - not hidden by user for this project- - project is created more than 24 hours ago+ - not hidden by user for this workspace+ - workspace is created more than 24 hours ago*/if (plan === "free" &&diff --git a/apps/web/ui/links/link-filters.tsx b/apps/web/ui/links/link-filters.tsxindex ff5a9fdc65..1e60387363 100644--- a/apps/web/ui/links/link-filters.tsx+++ b/apps/web/ui/links/link-filters.tsx@@ -299,7 +299,7 @@ const DomainPopover = ({const toastWithUndo = useToastWithUndo();- const archiveProjectDomain = (archive: boolean) => {+ const archiveDomain = (archive: boolean) => {return fetch(`/api/domains/${domain.slug}?workspaceId=${id}`, {method: "PUT",headers: {@@ -354,14 +354,14 @@ const DomainPopover = ({toast.error(error.message);}} else {- const res = await archiveProjectDomain(true);+ const res = await archiveDomain(true);if (res.ok) {await mutateDomains();toastWithUndo({id: "domain-archive-undo-toast",message: `Successfully archived domain!`,undo: async () => {- toast.promise(archiveProjectDomain(false), {+ toast.promise(archiveDomain(false), {loading: "Undo in progress...",error: "Failed to roll back changes. An error occurred.",success: async () => {@@ -520,7 +520,7 @@ const TagsFilter = ({className="mt-4 grid gap-2"{...SWIPE_REVEAL_ANIMATION_SETTINGS}>- {tags?.length === 0 ? ( // if the project has no tags+ {tags?.length === 0 ? ( // if the workspace has no tags<p className="text-center text-sm text-gray-500">No tags yet.</p>) : (<>diff --git a/apps/web/ui/modals/edit-role-modal.tsx b/apps/web/ui/modals/edit-role-modal.tsxindex ac2aa17c19..c96ff449d0 100644--- a/apps/web/ui/modals/edit-role-modal.tsx+++ b/apps/web/ui/modals/edit-role-modal.tsx@@ -23,7 +23,7 @@ function EditRoleModal({role: "owner" | "member";}) {const [editing, setEditing] = useState(false);- const { id, name: projectName, logo } = useWorkspace();+ const { id, name: workspaceName, logo } = useWorkspace();const { id: userId, name, email } = user;return (@@ -43,7 +43,7 @@ function EditRoleModal({<h3 className="text-lg font-medium">Change Teammate Role</h3><p className="text-center text-sm text-gray-500">This will change <b className="text-gray-800">{name || email}</b>'s- role in <b className="text-gray-800">{projectName}</b> to{" "}+ role in <b className="text-gray-800">{workspaceName}</b> to{" "}<b className="text-gray-800">{role}</b>. Are you sure you want tocontinue?</p>diff --git a/apps/web/ui/modals/remove-teammate-modal.tsx b/apps/web/ui/modals/remove-teammate-modal.tsxindex 5a650e0d5d..2945116fd2 100644--- a/apps/web/ui/modals/remove-teammate-modal.tsx+++ b/apps/web/ui/modals/remove-teammate-modal.tsx@@ -26,7 +26,7 @@ function RemoveTeammateModal({}) {const router = useRouter();const [removing, setRemoving] = useState(false);- const { id: workspaceId, slug, name: projectName, logo } = useWorkspace();+ const { id: workspaceId, name: workspaceName, logo } = useWorkspace();const { data: session } = useSession();const { id, name, email } = user;const { isMobile } = useMediaQuery();@@ -62,7 +62,7 @@ function RemoveTeammateModal({? "You're about to leave ": "This will remove "}<span className="font-semibold text-black">- {session?.user?.email === email ? projectName : name || email}+ {session?.user?.email === email ? workspaceName : name || email}</span>{invite? "'s invitation to join your workspace. "diff --git a/apps/web/ui/welcome/interim.tsx b/apps/web/ui/welcome/interim.tsxindex 3a5b19aab9..e0545afd46 100644--- a/apps/web/ui/welcome/interim.tsx+++ b/apps/web/ui/welcome/interim.tsx@@ -54,7 +54,7 @@ export default function Interim() {className="grid w-full grid-cols-1 divide-y divide-gray-100 overflow-hidden rounded-md border border-gray-200 bg-white md:grid-cols-2 md:divide-x"><button- onClick={() => router.push("/welcome?type=project")}+ onClick={() => router.push("/welcome?type=workspace")}className="flex flex-col items-center justify-center overflow-hidden p-5 transition-colors hover:bg-gray-50 md:p-10"><img@@ -68,7 +68,7 @@ export default function Interim() {</button><buttononClick={() =>- router.push("/welcome?type=project&useDefaultDomain=true")+ router.push("/welcome?type=workspace&useDefaultDomain=true")}className="flex flex-col items-center justify-center overflow-hidden p-5 transition-colors hover:bg-gray-50 md:p-10">diff --git a/apps/web/ui/workspaces/workspace-card.tsx b/apps/web/ui/workspaces/workspace-card.tsxindex e0c38ef07e..a67a150dd1 100644--- a/apps/web/ui/workspaces/workspace-card.tsx+++ b/apps/web/ui/workspaces/workspace-card.tsx@@ -53,14 +53,14 @@ export default function WorkspaceCard({);const { data: user } = useSWRImmutable<- Session["user"] & { migratedProject: string | null }+ Session["user"] & { migratedWorkspace: string | null }>(`/api/user`, fetcher);- const isMigratedProject = user?.migratedProject === id;+ const isMigratedWorkspace = user?.migratedWorkspace === id;return (<div className="group relative">- {isMigratedProject && (+ {isMigratedWorkspace && (<><div className="absolute -inset-1 rounded-lg bg-gradient-to-r from-red-600 to-violet-600 opacity-25 blur-lg transition duration-1000 group-hover:opacity-75 group-hover:duration-200" /><WorkspaceArrow className="absolute -bottom-20 right-56 z-10 text-violet-600 lg:right-0" />@@ -85,7 +85,7 @@ export default function WorkspaceCard({className={cn("relative flex flex-col justify-between space-y-10 rounded-lg border border-gray-100 bg-white p-6 shadow transition-all hover:shadow-lg",{- "border-violet-600": isMigratedProject,+ "border-violet-600": isMigratedWorkspace,},)}>