Skip to content

Commit c4f38b4

Browse files
committed
revert changes for now
1 parent f727540 commit c4f38b4

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

apps/web/lib/api/conversions/track-lead.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ export const trackLead = async ({
5353
// otherwise, throw an error (this is for mode="deferred" lead tracking)
5454
if (!clickId) {
5555
if (!customer || !customer.clickId) {
56-
return trackLeadResponseSchema.parse({
57-
click: null,
58-
customer: null,
56+
throw new DubApiError({
57+
code: "bad_request",
58+
message:
59+
"The `clickId` property was not provided in the request, and no existing customer with the provided `customerExternalId` was found.",
5960
});
6061
}
6162

apps/web/lib/zod/schemas/leads.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,15 @@ export const trackLeadRequestSchema = z.object({
7373
});
7474

7575
export const trackLeadResponseSchema = z.object({
76-
click: z
77-
.object({
78-
id: z.string(),
79-
})
80-
.nullable(),
81-
customer: z
82-
.object({
83-
name: z.string().nullable(),
84-
email: z.string().nullable(),
85-
avatar: z.string().nullable(),
86-
externalId: z.string().nullable(),
87-
})
88-
.nullable(),
76+
click: z.object({
77+
id: z.string(),
78+
}),
79+
customer: z.object({
80+
name: z.string().nullable(),
81+
email: z.string().nullable(),
82+
avatar: z.string().nullable(),
83+
externalId: z.string().nullable(),
84+
}),
8985
});
9086

9187
export const leadEventSchemaTB = clickEventSchemaTB

0 commit comments

Comments
 (0)