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.

Keep partner link titles and comments out of the referrals embed

Rafi524f813ac422
diff --git a/apps/web/app/(ee)/api/embed/referrals/analytics/route.ts b/apps/web/app/(ee)/api/embed/referrals/analytics/route.ts
index f714aea95d..2dea1d3212 100644
--- a/apps/web/app/(ee)/api/embed/referrals/analytics/route.ts
+++ b/apps/web/app/(ee)/api/embed/referrals/analytics/route.ts
@@ -26,7 +26,6 @@ export const GET = withReferralsEmbedToken(
...parsedQuery,
workspaceId: program.workspaceId,
linkId: parseFilterValue(links.map((link) => link.id)),
- includePartnerLinkTitle: true,
dataAvailableFrom: program.startedAt ?? program.createdAt,
});
diff --git a/apps/web/app/(ee)/api/embed/referrals/events/route.ts b/apps/web/app/(ee)/api/embed/referrals/events/route.ts
index f18314a9e3..f14b1775f9 100644
--- a/apps/web/app/(ee)/api/embed/referrals/events/route.ts
+++ b/apps/web/app/(ee)/api/embed/referrals/events/route.ts
@@ -3,8 +3,8 @@ import { obfuscateCustomerEmail } from "@/lib/api/partner-profile/obfuscate-cust
import { withReferralsEmbedToken } from "@/lib/embed/referrals/auth";
import { generateRandomName } from "@/lib/names";
import {
- parsePartnerProfileEventLink,
partnerProfileEventsQuerySchema,
+ PartnerProfileLinkSchema,
} from "@/lib/zod/schemas/partner-profile";
import { parseFilterValue } from "@dub/utils";
import { NextResponse } from "next/server";
@@ -47,9 +47,8 @@ export const GET = withReferralsEmbedToken(
return {
...eventRest,
click: clickRest,
- link: event?.link
- ? parsePartnerProfileEventLink(event.link, links)
- : null,
+ // the embed token comes from the workspace, so no private partner link details
+ link: event?.link ? PartnerProfileLinkSchema.parse(event.link) : null,
...(customer && {
customer: z
.object({
diff --git a/apps/web/lib/embed/referrals/auth.ts b/apps/web/lib/embed/referrals/auth.ts
index 6765532b78..ac142be36b 100644
--- a/apps/web/lib/embed/referrals/auth.ts
+++ b/apps/web/lib/embed/referrals/auth.ts
@@ -91,9 +91,6 @@ export const withReferralsEmbedToken = (
},
include: {
links: {
- include: {
- partnerLinkDetails: true,
- },
orderBy: [
{
saleAmount: "desc",