The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
add programEmbedSchema
Steven Tey6fc4e8693592
diff --git a/apps/web/app/app.dub.co/embed/referrals/faq.tsx b/apps/web/app/app.dub.co/embed/referrals/faq.tsxindex 6d4c8661c9..9cdba55394 100644--- a/apps/web/app/app.dub.co/embed/referrals/faq.tsx+++ b/apps/web/app/app.dub.co/embed/referrals/faq.tsx@@ -1,5 +1,6 @@import { constructRewardAmount } from "@/lib/api/sales/construct-reward-amount";import { RewardProps } from "@/lib/types";+import { programEmbedSchema } from "@/lib/zod/schemas/program-embed";import { BlockMarkdown } from "@/ui/partners/lander-blocks/BlockMarkdown";import { Program } from "@dub/prisma/client";import {@@ -31,7 +32,9 @@ export function ReferralsEmbedFAQ({}. There are no limits to how much you can earn.`: "";- const items = [+ const programEmbedData = programEmbedSchema.parse(program.embedData);++ const items = programEmbedData?.faq || [{title: `What is the ${program.name} Affiliate Program?`,content: `The ${program.name} Affiliate Program is a way for you to earn money by referring new customers to ${program.name}. ${rewardDescription}`,@@ -57,7 +60,7 @@ export function ReferralsEmbedFAQ({className="border-border-muted bg-bg-default rounded-lg border px-4 py-2 sm:px-8 sm:py-4"{...TAB_ITEM_ANIMATION_SETTINGS}>- <Accordion type="multiple">+ <Accordion type="single">{items.map((item, idx) => (<AccordionItem key={idx} value={idx.toString()}><AccordionTriggerdiff --git a/apps/web/lib/zod/schemas/program-embed.ts b/apps/web/lib/zod/schemas/program-embed.tsnew file mode 100644index 0000000000..8dd9234af1--- /dev/null+++ b/apps/web/lib/zod/schemas/program-embed.ts@@ -0,0 +1,8 @@+import { z } from "zod";+import { programLanderAccordionItemSchema } from "./program-lander";++export const programEmbedSchema = z+ .object({+ faq: z.array(programLanderAccordionItemSchema),+ })+ .nullish();