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.

dub_id

Steven Tey2491cb449e72
diff --git a/apps/web/app/api/stripe/connect/webhook/customer-created.ts b/apps/web/app/api/stripe/connect/webhook/customer-created.ts
index 72e2d6222c..1cee940abe 100644
--- a/apps/web/app/api/stripe/connect/webhook/customer-created.ts
+++ b/apps/web/app/api/stripe/connect/webhook/customer-created.ts
@@ -14,7 +14,7 @@ export async function customerCreated(event: Stripe.Event) {
const externalId = stripeCustomer.metadata?.dubCustomerId;
const clickId = stripeCustomer.metadata?.dubClickId;
- // The client app should always send dubClickId (dubId) via metadata
+ // The client app should always send dubClickId (dub_id) via metadata
if (!clickId) {
return "Click ID not found in Stripe customer metadata, skipping...";
}
diff --git a/apps/web/lib/auth/options.ts b/apps/web/lib/auth/options.ts
index b6b4188a49..1b097211dc 100644
--- a/apps/web/lib/auth/options.ts
+++ b/apps/web/lib/auth/options.ts
@@ -454,7 +454,7 @@ export const authOptions: NextAuthOptions = {
}
const clickId =
- cookies().get("dubId")?.value || cookies().get("dclid")?.value;
+ cookies().get("dub_id")?.value || cookies().get("dclid")?.value;
if (clickId) {
// send lead event to Dub
waitUntil(
@@ -468,7 +468,7 @@ export const authOptions: NextAuthOptions = {
}),
);
// delete the clickId cookie
- cookies().delete("dubId");
+ cookies().delete("dub_id");
}
}
// lazily backup user avatar to R2
diff --git a/apps/web/lib/middleware/link.ts b/apps/web/lib/middleware/link.ts
index ed6978973c..c39b7be8d7 100644
--- a/apps/web/lib/middleware/link.ts
+++ b/apps/web/lib/middleware/link.ts
@@ -182,7 +182,7 @@ export default async function LinkMiddleware(
const cookieStore = cookies();
let clickId =
- cookieStore.get("dubId")?.value || cookieStore.get("dclid")?.value;
+ cookieStore.get("dub_id")?.value || cookieStore.get("dclid")?.value;
if (!clickId) {
clickId = nanoid(16);
}
diff --git a/apps/web/lib/middleware/utils/create-response-with-cookie.ts b/apps/web/lib/middleware/utils/create-response-with-cookie.ts
index 7ccab0417d..55e90bf495 100644
--- a/apps/web/lib/middleware/utils/create-response-with-cookie.ts
+++ b/apps/web/lib/middleware/utils/create-response-with-cookie.ts
@@ -4,7 +4,7 @@ export function createResponseWithCookie(
response: NextResponse,
{ clickId, path }: { clickId: string; path: string },
): NextResponse {
- response.cookies.set("dubId", clickId, {
+ response.cookies.set("dub_id", clickId, {
path,
maxAge: 60 * 60, // 1 hour
});
diff --git a/apps/web/lib/middleware/utils/get-final-url.ts b/apps/web/lib/middleware/utils/get-final-url.ts
index fae9184722..57c40b7f9e 100644
--- a/apps/web/lib/middleware/utils/get-final-url.ts
+++ b/apps/web/lib/middleware/utils/get-final-url.ts
@@ -22,7 +22,7 @@ export const getFinalUrl = (
if (clickId) {
// add clickId to the final url if it exists
- urlObj.searchParams.set("dubId", clickId);
+ urlObj.searchParams.set("dub_id", clickId);
}
// if there are no query params, then return the target url as is (no need to parse it)
diff --git a/apps/web/lib/zod/schemas/leads.ts b/apps/web/lib/zod/schemas/leads.ts
index c675e02025..b35a05d1f9 100644
--- a/apps/web/lib/zod/schemas/leads.ts
+++ b/apps/web/lib/zod/schemas/leads.ts
@@ -11,7 +11,7 @@ export const trackLeadRequestSchema = z.object({
.trim()
.min(1, "clickId is required")
.describe(
- "The ID of the click in th Dub. You can read this value from `dubId` cookie.",
+ "The ID of the click in th Dub. You can read this value from `dub_id` cookie.",
),
eventName: z
.string({ required_error: "eventName is required" })