The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
support custom reward descriptions
Steven Tey551f565f89dc
diff --git a/apps/web/lib/zod/schemas/rewards.ts b/apps/web/lib/zod/schemas/rewards.tsindex a618d33bf2..0ff9903230 100644--- a/apps/web/lib/zod/schemas/rewards.ts+++ b/apps/web/lib/zod/schemas/rewards.ts@@ -19,6 +19,7 @@ export const RewardSchema = z.object({id: z.string(),event: z.nativeEnum(EventType),name: z.string().nullish(),+ description: z.string().nullish(),type: z.nativeEnum(CommissionType),amount: z.number(),maxDuration: z.number().nullish(),diff --git a/apps/web/ui/partners/program-reward-description.tsx b/apps/web/ui/partners/program-reward-description.tsxindex 27afe8b77f..e865c80ad4 100644--- a/apps/web/ui/partners/program-reward-description.tsx+++ b/apps/web/ui/partners/program-reward-description.tsx@@ -11,7 +11,7 @@ export function ProgramRewardDescription({}: {reward?: Pick<RewardProps,- "amount" | "type" | "event" | "maxDuration"+ "amount" | "type" | "event" | "maxDuration" | "description"> | null;discount?: DiscountProps | null;amountClassName?: string;@@ -20,34 +20,36 @@ export function ProgramRewardDescription({}) {return (<>- {reward && (reward.amount > 0 || !hideIfZero) ? (- <>- Earn{" "}- <strong className={cn("font-semibold", amountClassName)}>- {constructRewardAmount({- amount: reward.amount,- type: reward.type,- })}{" "}- </strong>- for each {reward.event}- {reward.maxDuration === null ? (- <strong className={cn("font-semibold", periodClassName)}>- {" "}- for the customer's lifetime.- </strong>- ) : reward.maxDuration && reward.maxDuration > 1 ? (+ {reward && (reward.amount > 0 || !hideIfZero)+ ? reward.description || (<>- , and again{" "}- <strong className={cn("font-semibold", periodClassName)}>- every month for {reward.maxDuration} months+ Earn{" "}+ <strong className={cn("font-semibold", amountClassName)}>+ {constructRewardAmount({+ amount: reward.amount,+ type: reward.type,+ })}{" "}</strong>- .+ for each {reward.event}+ {reward.maxDuration === null ? (+ <strong className={cn("font-semibold", periodClassName)}>+ {" "}+ for the customer's lifetime.+ </strong>+ ) : reward.maxDuration && reward.maxDuration > 1 ? (+ <>+ , and again{" "}+ <strong className={cn("font-semibold", periodClassName)}>+ every month for {reward.maxDuration} months+ </strong>+ .+ </>+ ) : (+ "."+ )}</>- ) : (- "."- )}- </>- ) : null}+ )+ : null}{discount ? (<>diff --git a/apps/web/ui/partners/program-reward-list.tsx b/apps/web/ui/partners/program-reward-list.tsxindex d787d2fc01..e034309905 100644--- a/apps/web/ui/partners/program-reward-list.tsx+++ b/apps/web/ui/partners/program-reward-list.tsx@@ -25,16 +25,20 @@ export function ProgramRewardList({>{sortedFilteredRewards.map((reward) => (<Item key={reward.id} icon={REWARD_EVENTS[reward.event].icon}>- {constructRewardAmount({- amount: reward.amount,- type: reward.type,- })}{" "}- per {reward.event}- {reward.maxDuration === null ? (- <> for the customer's lifetime</>- ) : reward.maxDuration && reward.maxDuration > 1 ? (- <>, and again every month for {reward.maxDuration} months</>- ) : null}+ {reward.description || (+ <>+ {constructRewardAmount({+ amount: reward.amount,+ type: reward.type,+ })}{" "}+ per {reward.event}+ {reward.maxDuration === null ? (+ <> for the customer's lifetime</>+ ) : reward.maxDuration && reward.maxDuration > 1 ? (+ <>, and again every month for {reward.maxDuration} months</>+ ) : null}+ </>+ )}</Item>))}{discount && (diff --git a/packages/prisma/schema/program.prisma b/packages/prisma/schema/program.prismaindex 60979184df..c61ae1facb 100644--- a/packages/prisma/schema/program.prisma+++ b/packages/prisma/schema/program.prisma@@ -39,6 +39,7 @@ model Program {minPayoutAmount Int @default(10000) // Default minimum payout amount of $100defaultRewardId String? @unique // default reward for the programdefaultDiscountId String? @unique // default discount for the program+ embedData Json? @db.JsonlanderData Json? @db.Jsonresources Json? @db.JsontermsUrl String? @db.Textdiff --git a/packages/prisma/schema/reward.prisma b/packages/prisma/schema/reward.prismaindex cb370c7bd2..5b91f0dc4a 100644--- a/packages/prisma/schema/reward.prisma+++ b/packages/prisma/schema/reward.prisma@@ -3,6 +3,7 @@ model Reward {programId Stringname String?+ description String?event EventTypetype CommissionType @default(percentage)amount Int @default(0)