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.

add `customer` `source` condition to sale rewards

Steven Teya99e7c3a5303
diff --git a/apps/web/lib/integrations/hubspot/track-sale.ts b/apps/web/lib/integrations/hubspot/track-sale.ts
index 973fbe597e..fface9a415 100644
--- a/apps/web/lib/integrations/hubspot/track-sale.ts
+++ b/apps/web/lib/integrations/hubspot/track-sale.ts
@@ -88,7 +88,11 @@ export const trackHubSpotSaleEvent = async ({
paymentProcessor: "custom",
invoiceId: dealId,
workspace,
- metadata: null,
+ metadata: {
+ hubspotDealId: dealId,
+ hubspotContactId: contactInfo.id,
+ },
+ source: "hubspot",
commissionSource: CommissionSource.hubspot,
});
diff --git a/apps/web/lib/zod/schemas/rewards.ts b/apps/web/lib/zod/schemas/rewards.ts
index c06de3336c..7092ca0736 100644
--- a/apps/web/lib/zod/schemas/rewards.ts
+++ b/apps/web/lib/zod/schemas/rewards.ts
@@ -187,10 +187,23 @@ export const REWARD_CONDITIONS: Record<
{
id: "tracked",
label: "tracked sale",
+ description:
+ "Sales tracked via [Dub's API](https://dub.co/docs/api-reference/track/sale) or [Stripe integration](https://dub.co/docs/integrations/stripe)",
+ icon: DUB_LOGO_SQUARE,
},
{
id: "submitted",
label: "closed won deal",
+ description:
+ "Closed won deals from [partner-submitted leads](https://dub.co/help/article/submitted-leads)",
+ icon: DUB_LOGO_SQUARE,
+ },
+ {
+ id: "hubspot",
+ label: "HubSpot closed won deal",
+ description:
+ "Closed won deals via the [HubSpot integration](https://dub.co/docs/integrations/hubspot#when-a-deal-is-closed-sale-event)",
+ icon: WEBHOOK_REQUEST_ACTORS_BY_PATH["/hubspot/webhook"].image,
},
],
},