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.

Tweaks

Tim Wilson0c618e6e9b6f
diff --git a/apps/web/app/api/customers/[id]/activity/route.ts b/apps/web/app/api/customers/[id]/activity/route.ts
index 8b3a9c6e5f..0302dec5d1 100644
--- a/apps/web/app/api/customers/[id]/activity/route.ts
+++ b/apps/web/app/api/customers/[id]/activity/route.ts
@@ -32,7 +32,7 @@ export const GET = withWorkspace(async ({ workspace, params, session }) => {
let [events, link] = await Promise.all([
getCustomerEvents(
- { customerId: customer.id, clickId: customer.clickId! },
+ { customerId: customer.id, clickId: customer.clickId },
{
sortOrder: "desc",
interval: "1y",
diff --git a/apps/web/lib/analytics/get-customer-events.ts b/apps/web/lib/analytics/get-customer-events.ts
index 6747343c2d..e1bca37871 100644
--- a/apps/web/lib/analytics/get-customer-events.ts
+++ b/apps/web/lib/analytics/get-customer-events.ts
@@ -12,7 +12,7 @@ import { EventsFilters } from "./types";
import { getStartEndDates } from "./utils/get-start-end-dates";
export const getCustomerEvents = async (
- { customerId, clickId }: { customerId: string; clickId: string },
+ { customerId, clickId }: { customerId: string; clickId?: string | null },
params: Pick<
EventsFilters,
"sortOrder" | "start" | "end" | "dataAvailableFrom" | "interval"
@@ -36,7 +36,7 @@ export const getCustomerEvents = async (
const response = await pipe({
...params,
customerId,
- clickId,
+ ...(clickId ? { clickId } : {}),
order: sortOrder,
start: startDate.toISOString().replace("T", " ").replace("Z", ""),
end: endDate.toISOString().replace("T", " ").replace("Z", ""),