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.

update sortBy for getPartnerCustomersQuerySchema

Steven Teyf9032094d4d8
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page-client.tsx
index 7525d2d32e..313ba5ff31 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page-client.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page-client.tsx
@@ -20,13 +20,7 @@ import {
useTable,
} from "@dub/ui";
import { User } from "@dub/ui/icons";
-import {
- COUNTRIES,
- currencyFormatter,
- formatDate,
- getApexDomain,
- getPrettyUrl,
-} from "@dub/utils";
+import { COUNTRIES, formatDate, getApexDomain, getPrettyUrl } from "@dub/utils";
import { useParams, useRouter } from "next/navigation";
import { useMemo } from "react";
import { usePartnerCustomerFilters } from "./use-partner-customer-filters";
@@ -64,7 +58,6 @@ export function ProgramCustomersPageClient() {
"customer",
"country",
"link",
- "saleAmount",
"createdAt",
"firstSaleAt",
"subscriptionCanceledAt",
@@ -73,7 +66,6 @@ export function ProgramCustomersPageClient() {
"customer",
"country",
"link",
- "saleAmount",
"createdAt",
"firstSaleAt",
"subscriptionCanceledAt",
@@ -149,25 +141,6 @@ export function ProgramCustomersPageClient() {
),
size: 250,
},
- {
- id: "saleAmount",
- header: "LTV",
- meta: {
- headerTooltip:
- "The total amount of revenue the customer has generated over time (lifetime value).",
- },
- accessorKey: "activity.saleAmount",
- cell: ({ getValue }) => (
- <div className="flex items-center gap-2">
- <span>
- {currencyFormatter(getValue() ?? 0, {
- trailingZeroDisplay: "stripIfInteger",
- })}
- </span>
- <span className="text-neutral-400">USD</span>
- </div>
- ),
- },
{
id: "createdAt",
header: "Created",
@@ -270,7 +243,7 @@ export function ProgramCustomersPageClient() {
onPaginationChange: setPagination,
columnVisibility,
onColumnVisibilityChange: setColumnVisibility,
- sortableColumns: ["saleAmount", "createdAt"],
+ sortableColumns: ["createdAt", "firstSaleAt", "subscriptionCanceledAt"],
sortBy,
sortOrder,
onSortChange: ({ sortBy, sortOrder }) =>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/partner-stats.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/partner-stats.tsx
index 42d8896c84..518b76c54c 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/partner-stats.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/partner-stats.tsx
@@ -57,7 +57,7 @@ export function PartnerStats({
? "-"
: undefined,
href: partner?.id
- ? `/${slug}/events?event=sales&partnerId=${partner.id}&interval=1y`
+ ? `/${slug}/events?event=sales&partnerId=${partner.id}&interval=1y&saleType=new`
: undefined,
},
{
diff --git a/apps/web/lib/zod/schemas/partner-profile.ts b/apps/web/lib/zod/schemas/partner-profile.ts
index 2cdd58ee61..484811cf87 100644
--- a/apps/web/lib/zod/schemas/partner-profile.ts
+++ b/apps/web/lib/zod/schemas/partner-profile.ts
@@ -247,7 +247,7 @@ export const getPartnerCustomersQuerySchema = z
"A filter on the list based on the customer's `linkId` field (the referral link ID).",
),
sortBy: z
- .enum(["createdAt", "saleAmount"])
+ .enum(["createdAt", "firstSaleAt", "subscriptionCanceledAt"])
.optional()
.default("createdAt")
.describe(