The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix lead & sale webhooks
Steven Teyb887f258f5c6
diff --git a/apps/web/lib/webhook/schemas.ts b/apps/web/lib/webhook/schemas.tsindex 34c45f3aa3..ce7799799b 100644--- a/apps/web/lib/webhook/schemas.ts+++ b/apps/web/lib/webhook/schemas.ts@@ -16,24 +16,19 @@ const saleSchema = z.object({});export const clickWebhookEventSchema = z.object({- timestamp: z.coerce.string(),click: clickEventSchema,link: linkEventSchema,});export const leadWebhookEventSchema = z.object({- eventId: z.string(),eventName: z.string(),- timestamp: z.date(),- customer: customerSchema,click: clickEventSchema,link: linkEventSchema,+ customer: customerSchema,});export const saleWebhookEventSchema = z.object({- eventId: z.string(),eventName: z.string(),- timestamp: z.date(),click: clickEventSchema,link: linkEventSchema,customer: customerSchema,diff --git a/apps/web/lib/webhook/transform.ts b/apps/web/lib/webhook/transform.tsindex d043e8aa3f..2e97b8f3f7 100644--- a/apps/web/lib/webhook/transform.ts+++ b/apps/web/lib/webhook/transform.ts@@ -8,7 +8,6 @@ import { LinkWithTags, transformLink } from "../api/links/utils/transform-link";import { WebhookTrigger } from "../types";import z from "../zod";import { clickEventSchema, clickEventSchemaTB } from "../zod/schemas/clicks";-import { linkEventSchema } from "../zod/schemas/links";import { WEBHOOK_EVENT_ID_PREFIX } from "./constants";import { leadWebhookEventSchema, saleWebhookEventSchema } from "./schemas";@@ -42,7 +41,7 @@ export const transformClickEventData = (...click,click: clickEventSchema.parse({...click,- id: data.click_id,+ id: click.clickId,}),});};@@ -65,11 +64,9 @@ export const transformLeadEventData = (data: any) => {click: {...lead,id: lead.clickId,- qr: lead.qr === 1,- bot: lead.bot === 1,},// transformLink -> add shortLink, qrCode, workspaceId, etc.- link: linkEventSchema.parse(transformLink(lead.link as LinkWithTags)),+ link: transformLink(lead.link as LinkWithTags),});};@@ -99,7 +96,7 @@ export const transformSaleEventData = (data: any) => {bot: sale.bot === 1,},// transformLink -> add shortLink, qrCode, workspaceId, etc.- link: linkEventSchema.parse(transformLink(sale.link as LinkWithTags)),+ link: transformLink(sale.link as LinkWithTags),});};