The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
improve commissions table
Steven Teycfc3f93efa2e
diff --git a/apps/web/app/api/cron/aggregate-clicks/route.ts b/apps/web/app/api/cron/aggregate-clicks/route.tsindex 2e08eb7a11..2be62656a7 100644--- a/apps/web/app/api/cron/aggregate-clicks/route.ts+++ b/apps/web/app/api/cron/aggregate-clicks/route.ts@@ -70,7 +70,7 @@ export async function GET(req: Request) {gt: 0,},lastClicked: {- gte: start, // links that were clicked on before the start of the previous day+ gte: start, // links that were clicked on after the start date},},select: {diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/commissions/commission-table.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/commissions/commission-table.tsxindex 47b94e5dc5..51a41a935e 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/commissions/commission-table.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/commissions/commission-table.tsx@@ -25,6 +25,7 @@ import {fetcher,formatDateTime,formatDateTimeSmart,+ nFormatter,OG_AVATAR_URL,} from "@dub/utils";import Link from "next/link";@@ -136,14 +137,29 @@ const CommissionTableInner = memo(}),},},+ {+ id: "type",+ header: "Type",+ accessorKey: "type",+ cell: ({ row }) => (+ <CommissionTypeBadge type={row.original.type ?? "sale"} />+ ),+ meta: {+ filterParams: ({ row }) => ({+ type: row.original.type,+ }),+ },+ },{id: "amount",header: "Amount",accessorFn: (d) =>- currencyFormatter(d.amount / 100, {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- }),+ d.type === "sale"+ ? currencyFormatter(d.amount / 100, {+ minimumFractionDigits: 2,+ maximumFractionDigits: 2,+ })+ : nFormatter(d.quantity),},{id: "commission",@@ -154,19 +170,6 @@ const CommissionTableInner = memo(maximumFractionDigits: 2,}),},- {- id: "type",- header: "Type",- accessorKey: "type",- cell: ({ row }) => (- <CommissionTypeBadge type={row.original.type ?? "sale"} />- ),- meta: {- filterParams: ({ row }) => ({- type: row.original.type,- }),- },- },{header: "Status",cell: ({ row }) => {diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.tsindex c9c8bbf7d7..b89f87797f 100644--- a/apps/web/lib/types.ts+++ b/apps/web/lib/types.ts@@ -23,10 +23,7 @@ import {} from "./folder/constants";import { WEBHOOK_TRIGGER_DESCRIPTIONS } from "./webhook/constants";import { clickEventResponseSchema } from "./zod/schemas/clicks";-import {- CommissionResponseSchema,- CommissionSchema,-} from "./zod/schemas/commissions";+import { CommissionResponseSchema } from "./zod/schemas/commissions";import { customerActivityResponseSchema } from "./zod/schemas/customer-activity";import {CustomerEnrichedSchema,@@ -368,8 +365,6 @@ export type UsageResponse = z.infer<typeof usageResponse>;export type PartnersCount = Record<ProgramEnrollmentStatus | "all", number>;-export type SaleProps = z.infer<typeof CommissionSchema>;-export type CommissionsCount = Record<CommissionStatus | "all",{diff --git a/apps/web/lib/zod/schemas/commissions.ts b/apps/web/lib/zod/schemas/commissions.tsindex 84bf60b932..68855b90f5 100644--- a/apps/web/lib/zod/schemas/commissions.ts+++ b/apps/web/lib/zod/schemas/commissions.ts@@ -20,6 +20,7 @@ export const CommissionSchema = z.object({export const CommissionResponseSchema = CommissionSchema.merge(z.object({+ quantity: z.number(),partner: PartnerSchema,customer: CustomerSchema.nullable(), // customer can be null for click-based commissions}),