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.

final fixes, address CR feedback

Steven Teye5dea0ea9c84
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/application-referral-source-icon.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/application-referral-source-icon.tsx
index 6f22b3226a..e5e58a49b4 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/application-referral-source-icon.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/applications/application-referral-source-icon.tsx
@@ -1,5 +1,5 @@
import { ReferrerIcon } from "@/ui/analytics/referrer-icon";
-import { Globe, Shop } from "@dub/ui/icons";
+import { Globe, Shop, UserArrowRight } from "@dub/ui/icons";
export function ApplicationReferralSourceIcon({
referralSource,
@@ -11,6 +11,8 @@ export function ApplicationReferralSourceIcon({
return <Shop />;
case "direct":
return <Globe />;
+ case "manual":
+ return <UserArrowRight />;
default:
return <ReferrerIcon display={referralSource} />;
}
diff --git a/apps/web/lib/application-events/utils.ts b/apps/web/lib/application-events/utils.ts
index b88a7aff6d..e5f57ead8b 100644
--- a/apps/web/lib/application-events/utils.ts
+++ b/apps/web/lib/application-events/utils.ts
@@ -18,5 +18,6 @@ export const STAGE_VALUE_KEY: Record<
export const getReferralSourceDisplayValue = (referralSource: string) => {
if (referralSource === "marketplace") return "Dub Program Marketplace";
if (referralSource === "direct") return "Direct application";
+ if (referralSource === "manual") return "Manual attribution";
return referralSource;
};
diff --git a/apps/web/lib/partner-referrals/attribute-referring-partner.ts b/apps/web/lib/partner-referrals/attribute-referring-partner.ts
index a5eedad9ea..7864958b2b 100644
--- a/apps/web/lib/partner-referrals/attribute-referring-partner.ts
+++ b/apps/web/lib/partner-referrals/attribute-referring-partner.ts
@@ -30,7 +30,8 @@ export const attributeReferringPartnerAction = authActionClient
if (referredByPartnerId === partnerId) {
throw new DubApiError({
code: "bad_request",
- message: "A partner cannot refer themselves.",
+ message:
+ "A partner cannot be attributed to themselves as a referring partner.",
});
}
@@ -75,14 +76,15 @@ export const attributeReferringPartnerAction = authActionClient
if (referringProgramEnrollment.status !== "approved") {
throw new DubApiError({
code: "bad_request",
- message: "The referring partner is not approved.",
+ message: "The referring partner is not enrolled in the program.",
});
}
if (programEnrollment.applicationEvent?.referredByPartnerId) {
throw new DubApiError({
code: "bad_request",
- message: "This partner already has a referring partner.",
+ message:
+ "This partner has already been attributed to another referring partner.",
});
}
diff --git a/apps/web/lib/partner-referrals/components/attribute-referring-partner-modal.tsx b/apps/web/lib/partner-referrals/components/attribute-referring-partner-modal.tsx
index 83ed94fe0b..540a24ea37 100644
--- a/apps/web/lib/partner-referrals/components/attribute-referring-partner-modal.tsx
+++ b/apps/web/lib/partner-referrals/components/attribute-referring-partner-modal.tsx
@@ -78,9 +78,7 @@ function AttributeReferringPartnerModal({
? "Please select a referring partner first."
: partner.id === referredByPartner?.id
? "You cannot attribute a partner to themselves."
- : partner.totalCommissions === 0
- ? "This partner has no eligible commissions."
- : undefined;
+ : undefined;
return (
<Modal showModal={showModal} setShowModal={setShowModal}>
diff --git a/apps/web/ui/activity-logs/commission-activity.tsx b/apps/web/ui/activity-logs/commission-activity.tsx
index 55a98f86e3..12d2b8d88a 100644
--- a/apps/web/ui/activity-logs/commission-activity.tsx
+++ b/apps/web/ui/activity-logs/commission-activity.tsx
@@ -122,15 +122,20 @@ export function CommissionActivity({
icon: CommissionStatusBadges["pending"].icon,
timestamp: commission.createdAt,
note: (() => {
- const text = commission.reward
- ? `Earn ${
- commission.reward.type === "percentage"
- ? `${commission.reward.amountInPercentage ?? 0}%`
- : currencyFormatter(commission.reward.amountInCents ?? 0, {
- trailingZeroDisplay: "stripIfInteger",
- })
- } per ${commission.reward.event}`
- : commission.description ?? null;
+ const text =
+ commission.description ||
+ (commission.reward
+ ? `Earn ${
+ commission.reward.type === "percentage"
+ ? `${commission.reward.amountInPercentage ?? 0}%`
+ : currencyFormatter(
+ commission.reward.amountInCents ?? 0,
+ {
+ trailingZeroDisplay: "stripIfInteger",
+ },
+ )
+ } per ${commission.reward.event}`
+ : null);
if (!text) return undefined;