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.

finalize schemas, use saleType: 'new' for ConversionBlock

Steven Tey34fba9e824af
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index 2666ebf3b5..331fef5a44 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -267,48 +267,49 @@ export const EnrolledPartnerSchema = PartnerSchema.pick({
.merge(
ProgramEnrollmentSchema.omit({
program: true,
+ rewards: true,
+ discount: true,
}),
)
- .merge(PartnerOnlinePresenceSchema)
.extend({
clicks: z
.number()
.default(0)
- .describe("The total number of clicks on the partner's links."),
+ .describe(
+ "The total number of clicks on the partner's links. Defaults to 0 if `includeExpandedFields` is false.",
+ ),
leads: z
.number()
.default(0)
- .describe("The total number of leads generated by the partner's links."),
+ .describe(
+ "The total number of leads generated by the partner's links. Defaults to 0 if `includeExpandedFields` is false.",
+ ),
sales: z
.number()
.default(0)
- .describe("The total number of sales generated by the partner's links."),
+ .describe(
+ "The total number of sales generated by the partner's links. Defaults to 0 if `includeExpandedFields` is false.",
+ ),
saleAmount: z
.number()
.default(0)
.describe(
- "The total amount of sales (in cents) generated by the partner's links.",
+ "The total amount of sales (in cents) generated by the partner's links. Defaults to 0 if `includeExpandedFields` is false.",
),
totalCommissions: z
.number()
.default(0)
.describe(
- "The total commissions paid to the partner for their referrals.",
+ "The total commissions paid to the partner for their referrals. Defaults to 0 if `includeExpandedFields` is false.",
),
netRevenue: z
- .number()
- .default(0)
- .describe("The total net revenue generated by the partner."),
- earnings: z
.number()
.default(0)
.describe(
- "DEPRECATED: The total earnings/commissions accrued by the partner's links.",
- )
- .openapi({
- deprecated: true,
- }),
- });
+ "The total net revenue generated by the partner. Defaults to 0 if `includeExpandedFields` is false.",
+ ),
+ })
+ .merge(PartnerOnlinePresenceSchema);
export const LeaderboardPartnerSchema = z.object({
id: z.string(),
diff --git a/apps/web/lib/zod/schemas/programs.ts b/apps/web/lib/zod/schemas/programs.ts
index 952820c2c6..fc21510aa9 100644
--- a/apps/web/lib/zod/schemas/programs.ts
+++ b/apps/web/lib/zod/schemas/programs.ts
@@ -106,18 +106,26 @@ export const ProgramEnrollmentSchema = z.object({
clickRewardId: z.string().nullish(),
leadRewardId: z.string().nullish(),
saleRewardId: z.string().nullish(),
- discountId: z.string().nullish(),
discount: DiscountSchema.nullish(),
+ discountId: z.string().nullish(),
applicationId: z
.string()
.nullish()
.describe(
"If the partner submitted an application to join the program, this is the ID of the application.",
),
- bannedAt: z.date().nullish(),
+ bannedAt: z
+ .date()
+ .nullish()
+ .describe(
+ "If the partner was banned from the program, this is the date of the ban.",
+ ),
bannedReason: z
.enum(Object.keys(PartnerBannedReason) as [PartnerBannedReason])
- .nullish(),
+ .nullish()
+ .describe(
+ "If the partner was banned from the program, this is the reason for the ban.",
+ ),
});
export const ProgramInviteSchema = z.object({
diff --git a/apps/web/ui/partners/overview/blocks/conversion-block.tsx b/apps/web/ui/partners/overview/blocks/conversion-block.tsx
index 5a2bb164b0..2b99120b73 100644
--- a/apps/web/ui/partners/overview/blocks/conversion-block.tsx
+++ b/apps/web/ui/partners/overview/blocks/conversion-block.tsx
@@ -25,6 +25,7 @@ export function ConversionBlock() {
}>(
`/api/analytics?${editQueryString(queryString, {
event: "composite",
+ saleType: "new",
})}`,
fetcher,
{
@@ -66,7 +67,7 @@ export function ConversionBlock() {
<ProgramOverviewBlock
title="Conversion rate"
viewAllHref={`/${workspaceSlug}/program/analytics${getQueryString(
- { view: "funnel" },
+ { saleType: "new", view: "funnel" },
{
include: ["interval", "start", "end"],
},