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.

small fixes to manual commission

Steven Teycf97807374d2
diff --git a/apps/web/lib/actions/partners/create-manual-commission.ts b/apps/web/lib/actions/partners/create-manual-commission.ts
index 15b02dc773..600e613d1c 100644
--- a/apps/web/lib/actions/partners/create-manual-commission.ts
+++ b/apps/web/lib/actions/partners/create-manual-commission.ts
@@ -435,6 +435,30 @@ export const createManualCommissionAction = authActionClient
// Track the sale event timestamp for link stats update
saleEventTimestamp = new Date(saleEventData.timestamp);
}
+
+ const updatedCustomer = await prisma.customer.update({
+ where: {
+ id: customer.id,
+ },
+ data: {
+ linkId: link.id,
+ clickId: clickId,
+ clickedAt: new Date(clickTimestamp),
+ country: generatedClickEvent.country,
+ ...(saleAmount && {
+ sales: {
+ increment: 1,
+ },
+ saleAmount: {
+ increment: saleAmount,
+ },
+ }),
+ },
+ });
+ console.log(
+ "Updated customer to include link & sale attributes: ",
+ updatedCustomer,
+ );
}
}
diff --git a/apps/web/ui/customers/customer-details-column.tsx b/apps/web/ui/customers/customer-details-column.tsx
index a5027cee12..9f6546d5fd 100644
--- a/apps/web/ui/customers/customer-details-column.tsx
+++ b/apps/web/ui/customers/customer-details-column.tsx
@@ -179,7 +179,11 @@ export function CustomerDetailsColumn({
<div className="h-5 w-12 animate-pulse rounded-md bg-neutral-100" />
) : link ? (
<ConditionalLink
- href={`/${programSlug ? `programs/${programSlug}` : slug}/analytics?domain=${link.domain}&key=${link.key}`}
+ href={
+ programSlug
+ ? `/programs/${programSlug}/analytics?domain=${link.domain}&key=${link.key}`
+ : `/${slug}/links/${link.domain}/${link.key}`
+ }
target="_blank"
className="min-w-0 overflow-hidden truncate"
>