Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Include totalSaleAmount in commission webhook

Steven Tey0ae8e1d77652
diff --git a/apps/web/lib/webhook/sample-events/commission-created.json b/apps/web/lib/webhook/sample-events/commission-created.json
index 18911f8f14..f1beb606bb 100644
--- a/apps/web/lib/webhook/sample-events/commission-created.json
+++ b/apps/web/lib/webhook/sample-events/commission-created.json
@@ -22,6 +22,7 @@
"totalLeads": 15,
"totalConversions": 10,
"totalSales": 10,
+ "totalSaleAmount": 100000,
"totalCommissions": 50000
},
"customer": {
diff --git a/apps/web/lib/zod/schemas/commissions.ts b/apps/web/lib/zod/schemas/commissions.ts
index cda3362fa0..ab7653d58f 100644
--- a/apps/web/lib/zod/schemas/commissions.ts
+++ b/apps/web/lib/zod/schemas/commissions.ts
@@ -57,6 +57,7 @@ export const CommissionWebhookSchema = CommissionSchema.merge(
totalLeads: z.number(),
totalConversions: z.number(),
totalSales: z.number(),
+ totalSaleAmount: z.number(),
totalCommissions: z.number(),
}),
),
diff --git a/apps/web/ui/customers/customer-partner-earnings-table.tsx b/apps/web/ui/customers/customer-partner-earnings-table.tsx
index 337447a4ab..b974f60122 100644
--- a/apps/web/ui/customers/customer-partner-earnings-table.tsx
+++ b/apps/web/ui/customers/customer-partner-earnings-table.tsx
@@ -1,6 +1,6 @@
import { CommissionResponse } from "@/lib/types";
import { StatusBadge } from "@dub/ui";
-import { currencyFormatter, formatDateTimeSmart } from "@dub/utils";
+import { currencyFormatter, formatDateTimeSmart, nFormatter } from "@dub/utils";
import {
flexRender,
getCoreRowModel,
@@ -124,7 +124,9 @@ export function CustomerPartnerEarningsTable({
href={viewAllHref ?? "#"}
className="flex items-center gap-1.5 font-medium text-neutral-700 hover:text-neutral-900"
>
- {totalCommissions ?? (
+ {totalCommissions ? (
+ nFormatter(totalCommissions, { full: true })
+ ) : (
<div className="size-3 animate-pulse rounded-md bg-neutral-100" />
)}{" "}
results
diff --git a/apps/web/ui/customers/customer-sales-table.tsx b/apps/web/ui/customers/customer-sales-table.tsx
index 71af32542a..61e2b26205 100644
--- a/apps/web/ui/customers/customer-sales-table.tsx
+++ b/apps/web/ui/customers/customer-sales-table.tsx
@@ -1,6 +1,6 @@
import { CommissionResponse, SaleEvent } from "@/lib/types";
import { StatusBadge } from "@dub/ui";
-import { currencyFormatter, formatDateTimeSmart } from "@dub/utils";
+import { currencyFormatter, formatDateTimeSmart, nFormatter } from "@dub/utils";
import {
flexRender,
getCoreRowModel,
@@ -143,7 +143,9 @@ export function CustomerSalesTable({
href={viewAllHref ?? "#"}
className="flex items-center gap-1.5 font-medium text-neutral-700 hover:text-neutral-900"
>
- {totalSales ?? (
+ {totalSales ? (
+ nFormatter(totalSales, { full: true })
+ ) : (
<div className="size-3 animate-pulse rounded-md bg-neutral-100" />
)}{" "}
results