MCPcopy
hub / github.com/dubinc/dub / transformLeadEventData

Function transformLeadEventData

apps/web/lib/webhook/transform.ts:47–66  ·  view source on GitHub ↗
(data: any)

Source from the content-addressed store, hash-verified

45};
46
47export const transformLeadEventData = (data: any) => {
48 const lead = Object.fromEntries(
49 Object.entries(data).map(([key, value]) => [toCamelCase(key), value]),
50 );
51
52 const { customer } = data;
53
54 return leadWebhookEventSchema.parse({
55 ...lead,
56 customer: transformWebhookCustomer(customer),
57 click: {
58 ...lead,
59 id: lead.clickId,
60 timestamp: new Date(lead.timestamp + "Z"),
61 },
62 // transformLink -> add shortLink, qrCode, workspaceId, etc.
63 link: transformLink(lead.link as ExpandedLink),
64 metadata: lead.metadata || null,
65 });
66};
67
68export const transformSaleEventData = (data: any) => {
69 const sale = Object.fromEntries(

Callers 6

trackLeadFunction · 0.90
_trackLeadFunction · 0.90
attributeViaDiscountCodeFunction · 0.90
createShopifyLeadFunction · 0.90
createNewCustomerFunction · 0.90

Calls 3

toCamelCaseFunction · 0.90
transformLinkFunction · 0.90
transformWebhookCustomerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…