The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix get available bounties for an enrolled program
Kiran Kae07c6eace80
diff --git a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/bounties/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/bounties/route.tsindex d54735d6cd..4136ba6910 100644--- a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/bounties/route.ts+++ b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/bounties/route.ts@@ -71,20 +71,15 @@ export const GET = withPartnerProfile(async ({ partner, params }) => {return NextResponse.json(z.array(PartnerBountySchema).parse(- bounties.map((bounty) => {- const triggerConditions = Array.isArray(- bounty.workflow?.triggerConditions,- )- ? bounty.workflow?.triggerConditions- : [];-- return {- ...bounty,- performanceCondition:- triggerConditions.length > 0 ? triggerConditions[0] : null,- partner: aggregatePartnerLinksStats(links),- };- }),+ bounties.map((bounty) => ({+ ...bounty,+ submission: bounty.submissions?.[0] || null,+ performanceCondition: bounty.workflow?.triggerConditions?.[0] || null,+ partner: {+ ...aggregatePartnerLinksStats(links),+ totalCommissions,+ },+ })),),);});diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsxindex cc02aeee8d..b95221a97e 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx@@ -7,7 +7,7 @@ import { Calendar6 } from "@dub/ui/icons";import { formatDate } from "@dub/utils";export function PartnerBountyCard({ bounty }: { bounty: PartnerBountyProps }) {- const submission = bounty.submissions?.[0];+ const { submission } = bounty;const { claimBountyModal, setShowClaimBountyModal } = useClaimBountyModal({bounty,diff --git a/apps/web/lib/zod/schemas/partner-profile.ts b/apps/web/lib/zod/schemas/partner-profile.tsindex 41dd42eae9..e548f78220 100644--- a/apps/web/lib/zod/schemas/partner-profile.ts+++ b/apps/web/lib/zod/schemas/partner-profile.ts@@ -135,7 +135,7 @@ export const partnerNotificationTypes = z.enum([]);export const PartnerBountySchema = BountySchema.extend({- submissions: z.array(BountySubmissionSchema).nullable(),+ submission: BountySubmissionSchema.nullable(),performanceCondition: workflowConditionSchema.nullable().default(null),partner: z.object({totalClicks: z.number(),