The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix customer.firstSaleAt fallback logic
Steven Tey4b0bf8681051
diff --git a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/[customerId]/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/[customerId]/route.tsindex fa95f850c0..a0c6efe5ec 100644--- a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/[customerId]/route.ts+++ b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/[customerId]/route.ts@@ -82,8 +82,6 @@ export const GET = withPartnerProfile(async ({ partner, params }) => {// get the first partner link that this customer interacted withconst firstLinkId = events[events.length - 1].link_id;const link = links.find((link) => link.id === firstLinkId);- const firstSaleAt =- customer.commissions[0]?.createdAt ?? customer.firstSaleAt;return NextResponse.json(PartnerProfileCustomerSchema.extend({@@ -91,7 +89,7 @@ export const GET = withPartnerProfile(async ({ partner, params }) => {}).parse({...transformCustomer({...customer,- firstSaleAt,+ firstSaleAt: customer.commissions[0]?.createdAt ?? null,email: customer.email? customerDataSharingEnabledAt? customer.emaildiff --git a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/route.tsindex 972dc2be0d..f1334044f8 100644--- a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/route.ts+++ b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/route.ts@@ -92,15 +92,12 @@ export const GET = withPartnerProfile(// Map customers with their dataconst customersWithData = customers.map((customer) => {- const firstSaleAt =- customer.commissions[0]?.createdAt ?? customer.firstSaleAt;-return PartnerProfileCustomerSchema.extend({...(customerDataSharingEnabledAt && { name: z.string().nullish() }),}).parse({...transformCustomer({...customer,- firstSaleAt,+ firstSaleAt: customer.commissions[0]?.createdAt ?? null,email: customer.email? customerDataSharingEnabledAt? customer.email