Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,6 @@ export async function checkoutSessionCompleted(
variant: "marketing",
})),
),
// enable dub.link premium default domain for the workspace
prisma.defaultDomains.update({
where: {
projectId: workspaceId,
},
data: {
dublink: true,
},
}),
// expire tokens cache
tokenCache.expireMany({
hashedKeys: updatedWorkspace.restrictedTokens.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,6 @@ export async function customerSubscriptionDeleted(
paymentFailedAt: null,
},
}),

// disable dub.link premium default domain for the workspace
prisma.defaultDomains.update({
where: {
projectId: workspace.id,
},
data: {
dublink: false,
},
}),

// remove logo from all domains for the workspace
prisma.domain.updateMany({
where: {
Expand Down
11 changes: 0 additions & 11 deletions apps/web/app/api/domains/default/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { DubApiError } from "@/lib/api/errors";
import { withWorkspace } from "@/lib/auth";
import { getDefaultDomainsQuerySchema } from "@/lib/zod/schemas/domains";
import { prisma } from "@dub/prisma";
Expand All @@ -17,7 +16,6 @@ export const GET = withWorkspace(
},
select: {
dubsh: true,
dublink: true,
chatgpt: true,
sptifi: true,
gitnew: true,
Expand Down Expand Up @@ -60,21 +58,12 @@ export const PATCH = withWorkspace(
await req.json(),
);

if (workspace.plan === "free" && defaultDomains.includes("dub.link")) {
throw new DubApiError({
code: "forbidden",
message:
"You can only use dub.link on a Pro plan and above. Upgrade to Pro to use this domain.",
});
}

const response = await prisma.defaultDomains.update({
where: {
projectId: workspace.id,
},
data: {
dubsh: defaultDomains.includes("dub.sh"),
dublink: defaultDomains.includes("dub.link"),
chatgpt: defaultDomains.includes("chatg.pt"),
sptifi: defaultDomains.includes("spti.fi"),
gitnew: defaultDomains.includes("git.new"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useDefaultDomains from "@/lib/swr/use-default-domains";
import useWorkspace from "@/lib/swr/use-workspace";
import { DomainCardTitleColumn } from "@/ui/domains/domain-card-title-column";
import { UpgradeRequiredToast } from "@/ui/shared/upgrade-required-toast";
import { Logo, Switch, TooltipContent } from "@dub/ui";
import { Logo, Switch } from "@dub/ui";
import {
Amazon,
CalendarDays,
Expand Down Expand Up @@ -75,9 +75,7 @@ export function DefaultDomains() {
</div>

<div className="mt-2 grid grid-cols-1 gap-3">
{DUB_DOMAINS.filter(
(domain) => domain.slug !== "dub.link" || !flags?.noDubLink,
).map(({ slug, description }) => {
{DUB_DOMAINS.map(({ slug, description }) => {
return (
<div
key={slug}
Expand All @@ -91,16 +89,7 @@ export function DefaultDomains() {
/>
<Switch
disabled={submitting}
disabledTooltip={
permissionsError ||
(slug === "dub.link" && plan === "free" ? (
<TooltipContent
title="You can only use dub.link on a Pro plan and above. Upgrade to Pro to use this domain."
cta="Upgrade to Pro"
href={`/${slug}/upgrade`}
/>
) : undefined)
}
disabledTooltip={permissionsError ?? undefined}
checked={defaultDomains?.includes(slug)}
fn={() => {
const oldDefaultDomains = defaultDomains.slice();
Expand Down
1 change: 0 additions & 1 deletion apps/web/lib/edge-config/get-feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const getFeatureFlags = async ({
}

const workspaceFeatures: Record<BetaFeatures, boolean> = {
noDubLink: false,
analyticsSettingsSiteVisitTracking: false,
};

Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/edge-config/is-reserved-username.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { get } from "@vercel/edge-config";

/**
* Only for dub.sh / dub.link domains
* Only for dub.sh domain
* Check if a username is reserved – should only be available on Pro+
*/
export const isReservedUsername = async (key: string) => {
Expand Down
11 changes: 2 additions & 9 deletions apps/web/lib/swr/use-default-domains.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { fetcher } from "@dub/utils";
import { useMemo } from "react";
import useSWR from "swr";
import useWorkspace from "./use-workspace";

export default function useDefaultDomains(opts: { search?: string } = {}) {
const { id: workspaceId, flags } = useWorkspace();
const { id: workspaceId } = useWorkspace();

const { data, error, mutate } = useSWR<string[]>(
workspaceId &&
Expand All @@ -18,14 +17,8 @@ export default function useDefaultDomains(opts: { search?: string } = {}) {
},
);

const defaultDomains = useMemo(() => {
return flags?.noDubLink
? data?.filter((domain) => domain !== "dub.link")
: data;
}, [data, flags]);

return {
defaultDomains,
defaultDomains: data,
loading: !data && !error,
mutate,
error,
Expand Down
2 changes: 0 additions & 2 deletions apps/web/lib/swr/use-domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ export default function useDomains({
activeWorkspaceDomains.find(({ primary }) => primary)?.slug ||
activeWorkspaceDomains[0].slug
);
} else if (activeDefaultDomains.find(({ slug }) => slug === "dub.link")) {
return "dub.link";
}
return SHORT_DOMAIN;
}, [activeDefaultDomains, activeWorkspaceDomains]);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export type UtmTemplateWithUserProps = UtmTemplateProps & {

export type PlanProps = (typeof plans)[number];

export type BetaFeatures = "noDubLink" | "analyticsSettingsSiteVisitTracking";
export type BetaFeatures = "analyticsSettingsSiteVisitTracking";

export type PartnerBetaFeatures = "postbacks";

Expand Down
4 changes: 1 addition & 3 deletions apps/web/lib/zod/schemas/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ export const WorkspaceSchema = z
),
dotLinkClaimed: z
.boolean()
.describe(
"Whether the workspace has claimed a free .link domain. (dub.link/free)",
),
.describe("Whether the workspace has claimed a free .link domain."),
createdAt: z
.date()
.describe("The date and time when the workspace was created."),
Expand Down
6 changes: 0 additions & 6 deletions apps/web/ui/domains/domain-card-title-column.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ArrowTurnRight2, Flag2, Globe } from "@dub/ui/icons";
import { cn, getPrettyUrl, punycode } from "@dub/utils";
import { Star } from "lucide-react";

export function DomainCardTitleColumn({
domain,
Expand Down Expand Up @@ -51,11 +50,6 @@ export function DomainCardTitleColumn({
<Flag2 className="hidden h-3 w-3 sm:block" />
Primary
</span>
) : defaultDomain && domain === "dub.link" ? (
<span className="xs:px-3 xs:py-1 flex items-center gap-1 rounded-full bg-yellow-400/[.25] px-1.5 py-0.5 text-xs font-medium text-yellow-600">
<Star className="h-3 w-3" fill="currentColor" />
Premium
</span>
) : null}
</div>
{(!defaultDomain || description) && (
Expand Down
8 changes: 4 additions & 4 deletions apps/web/ui/links/use-available-domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function useAvailableDomains(
// If domain not found at all, return all active domains
return [
...sortDomains(activeWorkspaceDomains || []),
...sortDomains(activeDefaultDomains, "dub.link"),
...sortDomains(activeDefaultDomains, "dub.sh"),
];
}

Expand All @@ -71,7 +71,7 @@ export function useAvailableDomains(
return [
...sortDomains(activeWorkspaceDomains || []),
...(isDefaultDomain ? [] : [domain]),
...sortDomains(activeDefaultDomains, "dub.link"),
...sortDomains(activeDefaultDomains, "dub.sh"),
...(isDefaultDomain ? [domain] : []),
];
}
Expand All @@ -83,8 +83,8 @@ export function useAvailableDomains(
...domain,
isWorkspaceDomain: true,
})),
// Default domains next, with dub.link first, then alphabetically
...sortDomains(activeDefaultDomains, "dub.link").map((domain) => ({
// Default domains next, with dub.sh first, then alphabetically
...sortDomains(activeDefaultDomains, "dub.sh").map((domain) => ({
...domain,
isWorkspaceDomain: false,
})),
Expand Down
1 change: 0 additions & 1 deletion packages/prisma/schema/domain.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ model RegisteredDomain {

model DefaultDomains {
id String @id @default(cuid())
dublink Boolean @default(false)
dubsh Boolean @default(true)
chatgpt Boolean @default(true)
sptifi Boolean @default(true)
Expand Down
12 changes: 0 additions & 12 deletions packages/utils/src/constants/dub-domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ export const DUB_DOMAINS = [
},
...(process.env.NEXT_PUBLIC_IS_DUB
? [
{
id: "clxp3lfsb00011na8tfs7t0lx",
slug: "dub.link",
verified: true,
primary: true,
archived: false,
placeholder: "https://dub.co/help/article/dub-links",
allowedHostnames: [],
description:
"Premium short domain on Dub – only available on our Pro plan and above.",
projectId: DUB_WORKSPACE_ID,
},
{
id: "clce1z7cs00y8rbstk4xtnj0k",
slug: "chatg.pt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,18 +415,6 @@ export const PRICING_PLAN_COMPARE_FEATURES: {
{
text: () => <>SSL certificates</>,
},
{
check: {
default: true,
free: false,
},
text: () => (
<>
Premium <strong>dub.link</strong> domain
</>
),
href: "https://dub.co/help/article/default-dub-domains#premium-dublink-domain",
},
{
check: {
default: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/constants/reserved-slugs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Check if a key is reserved:
* - cannot be registered for a short link (only for dub.sh / dub.link domains)
* - cannot be registered for a short link (only for dub.sh domain)
* - cannot be used as a workspace slug
*/

Expand Down
Loading