The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
add types
Kiran K2672b86590f7
diff --git a/apps/web/app/api/dub/webhook/lead-created.ts b/apps/web/app/api/dub/webhook/lead-created.tsindex c0d7c64038..9aa9931efa 100644--- a/apps/web/app/api/dub/webhook/lead-created.ts+++ b/apps/web/app/api/dub/webhook/lead-created.ts@@ -1,9 +1,10 @@import { prisma } from "@/lib/prisma";import { REFERRAL_SIGNUPS_MAX } from "@/lib/referrals/constants";+import { LeadCreatedEvent } from "dub/dist/commonjs/models/components";import { sendEmail } from "emails";import NewReferralSignup from "emails/new-referral-signup";-export async function leadCreated(data: any) {+export async function leadCreated(data: LeadCreatedEvent["data"]) {const { customer: referredUser, link: referralLink } = data;if (!referralLink) {@@ -60,11 +61,12 @@ export async function leadCreated(data: any) {},// If the referral link has less than the max number of signups,// update the referrer's workspace usage- ...(referralLink.leads < REFERRAL_SIGNUPS_MAX && {- usageLimit: {- increment: 500,- },- }),+ ...(referralLink.leads &&+ referralLink.leads < REFERRAL_SIGNUPS_MAX && {+ usageLimit: {+ increment: 500,+ },+ }),},}),// send notification email to workspace ownersdiff --git a/apps/web/app/api/dub/webhook/sale-created.ts b/apps/web/app/api/dub/webhook/sale-created.tsindex 163aa968d2..085e6299d2 100644--- a/apps/web/app/api/dub/webhook/sale-created.ts+++ b/apps/web/app/api/dub/webhook/sale-created.ts@@ -1,8 +1,9 @@import { prisma } from "@/lib/prisma";+import { SaleCreatedEvent } from "dub/dist/commonjs/models/components";import { sendEmail } from "emails";import NewReferralSale from "emails/new-referral-sale";-export async function saleCreated(data: any) {+export async function saleCreated(data: SaleCreatedEvent["data"]) {const { link: referralLink } = data;if (!referralLink) {