The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update the ui with new endpoints
Kiran Kab715214d44c
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsxindex 253aa46ecb..5f2b6203c0 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx@@ -200,7 +200,7 @@ const PartnerEarningsTable = memo(const { data: commissions, isLoading: isComissionsLoading } = useSWR<CommissionResponse[]>(- `/api/programs/${programId}/commissions?customerId=${customerId}&workspaceId=${workspaceId}&pageSize=${CUSTOMER_PAGE_EVENTS_LIMIT}`,+ `/api/commissions?customerId=${customerId}&workspaceId=${workspaceId}&programId=${programId}&pageSize=${CUSTOMER_PAGE_EVENTS_LIMIT}`,fetcher,);@@ -208,7 +208,7 @@ const PartnerEarningsTable = memo(useSWR<{ all: { count: number } }>(// Only fetch total earnings count if the earnings data is equal to the limitcommissions?.length === CUSTOMER_PAGE_EVENTS_LIMIT &&- `/api/programs/${programId}/commissions/count?customerId=${customerId}&workspaceId=${workspaceId}`,+ `/api/commissions/count?customerId=${customerId}&workspaceId=${workspaceId}&programId=${programId}`,fetcher,);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 fb1ba4e41d..ce85febccf 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@@ -63,9 +63,10 @@ const CommissionTableInner = memo(const { commissionsCount } = useCommissionsCount();const { data: commissions, error } = useSWR<CommissionResponse[]>(- `/api/programs/${programId}/commissions${getQueryString(+ `/api/commissions${getQueryString({workspaceId,+ programId,},{exclude: ["view"],diff --git a/apps/web/lib/swr/use-commissions-count.ts b/apps/web/lib/swr/use-commissions-count.tsindex c5f761d76d..5181d993d7 100644--- a/apps/web/lib/swr/use-commissions-count.ts+++ b/apps/web/lib/swr/use-commissions-count.ts@@ -11,9 +11,10 @@ export default function useCommissionsCount(opts?: Record<string, any>) {const { getQueryString } = useRouterStuff();const { data: commissionsCount, error } = useSWR<CommissionsCount>(- `/api/programs/${programId}/commissions/count${getQueryString(+ `/api/commissions/count${getQueryString({workspaceId,+ programId,},{...opts,diff --git a/apps/web/lib/swr/use-commissions-timeseries.ts b/apps/web/lib/swr/use-commissions-timeseries.tsindex 5f8d4e0ae9..87fc267760 100644--- a/apps/web/lib/swr/use-commissions-timeseries.ts+++ b/apps/web/lib/swr/use-commissions-timeseries.ts@@ -13,7 +13,7 @@ interface Commission {export default function useCommissionsTimeseries(params?: PartnerAnalyticsFilters & { enabled: boolean },) {- const { programId } = useParams();+ const { programId } = useParams<{ programId: string }>();const { id: workspaceId } = useWorkspace();const searchParams = new URLSearchParams({@@ -27,11 +27,12 @@ export default function useCommissionsTimeseries(groupBy: params?.groupBy ?? "count",timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,workspaceId: workspaceId!,+ programId,});const { data, error } = useSWR<Commission[]>(params?.enabled- ? `/api/programs/${programId}/commissions/timeseries?${searchParams.toString()}`+ ? `/api/commissions/timeseries?${searchParams.toString()}`: null,fetcher,{