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.

revert changes for now

Steven Teyc4f38b48ee46
diff --git a/apps/web/lib/api/conversions/track-lead.ts b/apps/web/lib/api/conversions/track-lead.ts
index fe15d151a2..f408c62e7c 100644
--- a/apps/web/lib/api/conversions/track-lead.ts
+++ b/apps/web/lib/api/conversions/track-lead.ts
@@ -53,9 +53,10 @@ export const trackLead = async ({
// otherwise, throw an error (this is for mode="deferred" lead tracking)
if (!clickId) {
if (!customer || !customer.clickId) {
- return trackLeadResponseSchema.parse({
- click: null,
- customer: null,
+ throw new DubApiError({
+ code: "bad_request",
+ message:
+ "The `clickId` property was not provided in the request, and no existing customer with the provided `customerExternalId` was found.",
});
}
diff --git a/apps/web/lib/zod/schemas/leads.ts b/apps/web/lib/zod/schemas/leads.ts
index 1e836f3564..0d8d9f9ffd 100644
--- a/apps/web/lib/zod/schemas/leads.ts
+++ b/apps/web/lib/zod/schemas/leads.ts
@@ -73,19 +73,15 @@ export const trackLeadRequestSchema = z.object({
});
export const trackLeadResponseSchema = z.object({
- click: z
- .object({
- id: z.string(),
- })
- .nullable(),
- customer: z
- .object({
- name: z.string().nullable(),
- email: z.string().nullable(),
- avatar: z.string().nullable(),
- externalId: z.string().nullable(),
- })
- .nullable(),
+ click: z.object({
+ id: z.string(),
+ }),
+ customer: z.object({
+ name: z.string().nullable(),
+ email: z.string().nullable(),
+ avatar: z.string().nullable(),
+ externalId: z.string().nullable(),
+ }),
});
export const leadEventSchemaTB = clickEventSchemaTB