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.

code improvements

Pedro Ladeira24c34981a721
diff --git a/apps/web/app/(ee)/api/cron/export/customers/partner/route.ts b/apps/web/app/(ee)/api/cron/export/customers/partner/route.ts
index 9a7d30e070..4b357bb3bf 100644
--- a/apps/web/app/(ee)/api/cron/export/customers/partner/route.ts
+++ b/apps/web/app/(ee)/api/cron/export/customers/partner/route.ts
@@ -99,9 +99,7 @@ export const POST = withCron(async ({ rawBody }) => {
},
},
},
- orderBy: {
- [sortBy]: sortOrder,
- },
+ orderBy: [{ [sortBy]: sortOrder }, { id: "asc" }],
skip: (page - 1) * PAGE_SIZE,
take: PAGE_SIZE,
});
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/layout.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/layout.tsx
index cf080f70a0..c5674b8110 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/layout.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/layout.tsx
@@ -54,6 +54,8 @@ export default function PartnerProgramCustomersLayout({
}
}, [leadFormDataRaw]);
+ const isLeadsTab = pathname.endsWith("/customers/leads");
+
const tabs = useMemo(() => {
if (!isEnabled) {
return [];
@@ -95,7 +97,7 @@ export default function PartnerProgramCustomersLayout({
}}
/>
)}
- <PartnerCustomersMenuPopover />
+ {!isLeadsTab && <PartnerCustomersMenuPopover />}
</>
}
>
diff --git a/apps/web/lib/customers/api/format-partner-customers-export.ts b/apps/web/lib/customers/api/format-partner-customers-export.ts
index dc3cb2fb6b..2d68ea7b3a 100644
--- a/apps/web/lib/customers/api/format-partner-customers-export.ts
+++ b/apps/web/lib/customers/api/format-partner-customers-export.ts
@@ -56,7 +56,7 @@ export function formatPartnerCustomersForExport(
? c.email
: obfuscateCustomerEmail(c.email)
: customerDataSharingEnabledAt
- ? c.name || generateRandomName()
+ ? ""
: generateRandomName();
const full: Record<string, string | number> = {
diff --git a/apps/web/tests/customers/format-customers-export.test.ts b/apps/web/tests/customers/format-customers-export.test.ts
index 4e3a8303dd..b34a18b285 100644
--- a/apps/web/tests/customers/format-customers-export.test.ts
+++ b/apps/web/tests/customers/format-customers-export.test.ts
@@ -49,6 +49,20 @@ describe("formatPartnerCustomersForExport", () => {
});
});
+ test("exports an empty email when sharing is on and email is missing", () => {
+ const [row] = formatPartnerCustomersForExport(
+ [{ ...partnerCustomer, email: null }],
+ ["id", "email", "name"],
+ { customerDataSharingEnabledAt: new Date("2026-01-01") },
+ );
+
+ expect(row).toEqual({
+ id: "cus_123",
+ email: "",
+ name: "Ada Lovelace",
+ });
+ });
+
test("does not leak the customer name into email when sharing is off and email is missing", () => {
const [row] = formatPartnerCustomersForExport(
[{ ...partnerCustomer, email: null }],
diff --git a/apps/web/ui/customers/partner-customers-menu-popover.tsx b/apps/web/ui/customers/partner-customers-menu-popover.tsx
index 5376c07d58..1ff88443d4 100644
--- a/apps/web/ui/customers/partner-customers-menu-popover.tsx
+++ b/apps/web/ui/customers/partner-customers-menu-popover.tsx
@@ -45,6 +45,7 @@ export function PartnerCustomersMenuPopover() {
variant="secondary"
className="h-8 w-auto px-1.5 sm:h-9"
icon={<ThreeDots className="h-5 w-5 text-neutral-500" />}
+ aria-label="Customer export options"
/>
</Popover>
</>
diff --git a/apps/web/ui/modals/export-partner-customers-modal.tsx b/apps/web/ui/modals/export-partner-customers-modal.tsx
index 5a6f11c7f3..12e81b26c3 100644
--- a/apps/web/ui/modals/export-partner-customers-modal.tsx
+++ b/apps/web/ui/modals/export-partner-customers-modal.tsx
@@ -82,18 +82,25 @@ function ExportPartnerCustomersModal({
return;
}
+ const visibleIds = new Set<string>(visibleColumns.map((col) => col.id));
+ const columns = data.columns.filter((column) => visibleIds.has(column));
+
+ if (columns.length === 0) {
+ toast.error("Select at least one column.");
+ return;
+ }
+
const lid = toast.loading("Exporting customers...");
try {
- const visibleIds = new Set<string>(visibleColumns.map((col) => col.id));
- const columns = data.columns.filter((column) => visibleIds.has(column));
-
const baseParams: Record<string, string> = {
- ...(columns.length ? { columns: columns.join(",") } : {}),
+ columns: columns.join(","),
};
const queryString = data.useFilters
- ? getQueryString(baseParams)
+ ? getQueryString(baseParams, {
+ include: ["search", "country", "linkId", "sortBy", "sortOrder"],
+ })
: `?${new URLSearchParams(baseParams).toString()}`;
const response = await fetch(