diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/customers/[customerId]/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/customers/[customerId]/page.tsx deleted file mode 100644 index 4c9eacca0de..00000000000 --- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/customers/[customerId]/page.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { redirect } from "next/navigation"; - -// Handles old customer IDs (pre cus_ prefix) by redirecting to the sales page -export default async function ProgramCustomerPage({ - params, -}: { - params: Promise<{ slug: string; customerId: string }>; -}) { - const { slug, customerId } = await params; - if (customerId === "referrals") { - redirect(`/${slug}/program/customers/leads`); - } - - redirect(`/${slug}/program/customers/${customerId}/sales`); -} diff --git a/apps/web/lib/middleware/utils/app-redirect.ts b/apps/web/lib/middleware/utils/app-redirect.ts index 22aae74c1f8..72589fa5b71 100644 --- a/apps/web/lib/middleware/utils/app-redirect.ts +++ b/apps/web/lib/middleware/utils/app-redirect.ts @@ -99,20 +99,10 @@ export const appRedirect = async (path: string) => { "/$1/program/partners/$2/links?profile=true", ); - // Redirect "/[slug]/customers/:customerId" to "/[slug]/customers/:customerId/sales" - const customersPageRegex = /^\/([^\/]+)\/customers\/([^\/]+)$/; + // Redirect "/[slug]/[*]/customers/:customerId" to "/[slug]/[*]/customers/:customerId/sales" + const customersPageRegex = /^\/([^\/]+)\/([^\/]+)\/customers\/([^\/]+)$/; if (customersPageRegex.test(path)) - return path.replace(customersPageRegex, "/$1/customers/$2/sales"); - - // Redirect "/[slug]/program/customers/:customerId" to "/[slug]/program/customers/:customerId/sales" - // Only applies when customerId starts with "cus_" (old IDs handled by page redirect) - const programCustomersPageRegex = - /^\/([^\/]+)\/program\/customers\/(cus_[^\/]+)$/; - if (programCustomersPageRegex.test(path)) - return path.replace( - programCustomersPageRegex, - "/$1/program/customers/$2/sales", - ); + return path.replace(customersPageRegex, "/$1/$2/customers/$3/sales"); // Handle additional simpler program redirects const programRedirect = Object.keys(PROGRAM_REDIRECTS).find((redirect) => diff --git a/apps/web/ui/analytics/events/events-table.tsx b/apps/web/ui/analytics/events/events-table.tsx index a1492c4ebc2..75a4362c81e 100644 --- a/apps/web/ui/analytics/events/events-table.tsx +++ b/apps/web/ui/analytics/events/events-table.tsx @@ -276,7 +276,7 @@ export default function EventsTable({ href={ partnerPage ? `/programs/${programSlug}/customers/${getValue().id}` - : `/${slug}/customers/${getValue().id}` + : `/${slug}/links/customers/${getValue().id}` } className="px-4 py-2.5" /> diff --git a/apps/web/ui/analytics/use-analytics-filters.tsx b/apps/web/ui/analytics/use-analytics-filters.tsx index 030056c2487..e9041b57bec 100644 --- a/apps/web/ui/analytics/use-analytics-filters.tsx +++ b/apps/web/ui/analytics/use-analytics-filters.tsx @@ -856,7 +856,7 @@ export function useAnalyticsFilters({ return programPage ? `/${slug}/program/customers/${selectedCustomerId}` : slug - ? `/${slug}/customers/${selectedCustomerId}` + ? `/${slug}/links/customers/${selectedCustomerId}` : null; }, options: [], diff --git a/apps/web/ui/customers/customers-table/customers-table.tsx b/apps/web/ui/customers/customers-table/customers-table.tsx index 073a201222b..5edc1b6a557 100644 --- a/apps/web/ui/customers/customers-table/customers-table.tsx +++ b/apps/web/ui/customers/customers-table/customers-table.tsx @@ -334,7 +334,7 @@ export function CustomersTable({ const getCustomerUrl = (row: Row) => isProgramPage ? `/${workspaceSlug}/program/customers/${row.original.id}` - : `/${workspaceSlug}/customers/${row.original.id}`; + : `/${workspaceSlug}/links/customers/${row.original.id}`; const { table, ...tableProps } = useTable({ data: canManageCustomers ? customers || [] : EXAMPLE_CUSTOMER_DATA,