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.

fix tests

Steven Tey08c12481d65e
diff --git a/apps/web/lib/partners/bulk-approve-partners.ts b/apps/web/lib/partners/bulk-approve-partners.ts
index 9a4769bd89..599cb52b97 100644
--- a/apps/web/lib/partners/bulk-approve-partners.ts
+++ b/apps/web/lib/partners/bulk-approve-partners.ts
@@ -125,9 +125,8 @@ export async function bulkApprovePartners({
workspace,
trigger: "partner.enrolled",
data: EnrolledPartnerSchema.parse({
- ...enrollment,
...partner,
- status: enrollment.status,
+ ...enrollment,
id: partner.id,
links: partnerLinks.filter(
({ partnerId }) => partnerId === partner.id,
diff --git a/apps/web/lib/webhook/sample-events/partner-enrolled.json b/apps/web/lib/webhook/sample-events/partner-enrolled.json
index ef0bd09f65..0052bda598 100644
--- a/apps/web/lib/webhook/sample-events/partner-enrolled.json
+++ b/apps/web/lib/webhook/sample-events/partner-enrolled.json
@@ -7,6 +7,7 @@
"description": "I'm a content creator who works with brands to grow their business.",
"tenantId": "64dc9a8c-5cf9-4446-b53b-cdc15199fafc",
"programId": "prog_CYCu7IMAapjkRpTnr8F1azjN",
+ "partnerId": "cm6v2l38p000zubyl5fly3i7w",
"status": "approved",
"paypalEmail": null,
"stripeConnectId": null,
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index 5829512a22..02d64a8a2c 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -153,37 +153,37 @@ export const partnerInvitesQuerySchema = getPaginationQuerySchema({
export const PartnerOnlinePresenceSchema = z.object({
website: z
.string()
- .nullable()
+ .nullish()
.describe("The partner's website URL (including the https protocol)."),
- websiteTxtRecord: z.string().nullable(),
- websiteVerifiedAt: z.date().nullable(),
+ websiteTxtRecord: z.string().nullish(),
+ websiteVerifiedAt: z.date().nullish(),
youtube: z
.string()
- .nullable()
+ .nullish()
.describe("The partner's YouTube channel username (e.g. `johndoe`)."),
- youtubeVerifiedAt: z.date().nullable(),
- youtubeSubscriberCount: z.number(),
- youtubeViewCount: z.number(),
+ youtubeVerifiedAt: z.date().nullish(),
+ youtubeSubscriberCount: z.number().nullish(),
+ youtubeViewCount: z.number().nullish(),
twitter: z
.string()
- .nullable()
+ .nullish()
.describe("The partner's Twitter username (e.g. `johndoe`)."),
- twitterVerifiedAt: z.date().nullable(),
+ twitterVerifiedAt: z.date().nullish(),
linkedin: z
.string()
- .nullable()
+ .nullish()
.describe("The partner's LinkedIn username (e.g. `johndoe`)."),
- linkedinVerifiedAt: z.date().nullable(),
+ linkedinVerifiedAt: z.date().nullish(),
instagram: z
.string()
- .nullable()
+ .nullish()
.describe("The partner's Instagram username (e.g. `johndoe`)."),
- instagramVerifiedAt: z.date().nullable(),
+ instagramVerifiedAt: z.date().nullish(),
tiktok: z
.string()
- .nullable()
+ .nullish()
.describe("The partner's TikTok username (e.g. `johndoe`)."),
- tiktokVerifiedAt: z.date().nullable(),
+ tiktokVerifiedAt: z.date().nullish(),
});
export const PartnerSchema = z
diff --git a/apps/web/tests/webhooks/index.test.ts b/apps/web/tests/webhooks/index.test.ts
index f3b2db507b..29789bbdc6 100644
--- a/apps/web/tests/webhooks/index.test.ts
+++ b/apps/web/tests/webhooks/index.test.ts
@@ -34,11 +34,8 @@ const saleWebhookEventSchemaExtended = saleWebhookEventSchema.extend({
});
const enrolledPartnerSchemaExtended = EnrolledPartnerSchema.extend({
- createdAt: z.string().transform((str) => new Date(str)),
- payoutsEnabledAt: z
- .string()
- .transform((str) => (str ? new Date(str) : null))
- .nullable(),
+ payoutsEnabledAt: z.string().nullable(),
+ createdAt: z.string(),
});
const commissionWebhookEventSchemaExtended = CommissionEnrichedSchema.extend({
diff --git a/apps/web/ui/partners/online-presence-form.tsx b/apps/web/ui/partners/online-presence-form.tsx
index a055e67d21..c04ad1e0fd 100644
--- a/apps/web/ui/partners/online-presence-form.tsx
+++ b/apps/web/ui/partners/online-presence-form.tsx
@@ -544,10 +544,10 @@ function FormRow({
const info = useMemo(() => {
if (partner && property === "youtube" && isVerified) {
return [
- partner.youtubeSubscriberCount > 0
+ partner.youtubeSubscriberCount && partner.youtubeSubscriberCount > 0
? `${nFormatter(partner.youtubeSubscriberCount)} subscribers`
: null,
- partner.youtubeViewCount > 0
+ partner.youtubeViewCount && partner.youtubeViewCount > 0
? `${nFormatter(partner.youtubeViewCount)} views`
: null,
].filter(Boolean) as string[];
diff --git a/apps/web/ui/partners/online-presence-summary.tsx b/apps/web/ui/partners/online-presence-summary.tsx
index 282fd62bb7..9794e853a7 100644
--- a/apps/web/ui/partners/online-presence-summary.tsx
+++ b/apps/web/ui/partners/online-presence-summary.tsx
@@ -16,9 +16,9 @@ const fields: {
label: string;
icon: Icon;
data: (partner: EnrolledPartnerProps) => {
- value: string | null;
+ value?: string | null;
verified: boolean;
- href: string | null;
+ href?: string | null;
info?: string[];
};
}[] = [
@@ -39,10 +39,10 @@ const fields: {
verified: !!partner.youtubeVerifiedAt,
href: `https://youtube.com/@${partner.youtube}`,
info: [
- partner.youtubeSubscriberCount > 0
+ partner.youtubeSubscriberCount && partner.youtubeSubscriberCount > 0
? `${nFormatter(partner.youtubeSubscriberCount)} subscribers`
: null,
- partner.youtubeViewCount > 0
+ partner.youtubeViewCount && partner.youtubeViewCount > 0
? `${nFormatter(partner.youtubeViewCount)} views`
: null,
].filter(Boolean),