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.

Improve partner platforms onboarding step (#3385)

Steven Teyc7ed7f55d1b8
diff --git a/apps/web/.env.example b/apps/web/.env.example
index f9bc4d7a92..f3abb13b91 100644
--- a/apps/web/.env.example
+++ b/apps/web/.env.example
@@ -150,7 +150,7 @@ DYNADOT_API_KEY=
DYNADOT_BASE_URL=
DYNADOT_COUPON=
-# Online Presence Verification
+# Partner Platforms Verification
TWITTER_CLIENT_ID=
TWITTER_CLIENT_SECRET=
TIKTOK_CLIENT_ID=
diff --git a/apps/web/app/(ee)/api/partners/online-presence/callback/route.ts b/apps/web/app/(ee)/api/partners/platforms/callback/route.ts
similarity index 92%
rename from apps/web/app/(ee)/api/partners/online-presence/callback/route.ts
rename to apps/web/app/(ee)/api/partners/platforms/callback/route.ts
index 162139d299..0fbd7bbd25 100644
--- a/apps/web/app/(ee)/api/partners/online-presence/callback/route.ts
+++ b/apps/web/app/(ee)/api/partners/platforms/callback/route.ts
@@ -1,4 +1,4 @@
-import { ONLINE_PRESENCE_PROVIDERS } from "@/lib/api/partner-profile/online-presence-providers";
+import { PARTNER_PLATFORMS_PROVIDERS } from "@/lib/api/partner-profile/partner-platforms-providers";
import { fetchSocialProfile } from "@/lib/api/scrape-creators/fetch-social-profile";
import { getSession } from "@/lib/auth/utils";
import { redis } from "@/lib/upstash/redis";
@@ -24,7 +24,7 @@ interface State {
source: "onboarding" | "settings";
}
-// GET /api/partners/online-presence/callback
+// GET /api/partners/platforms/callback
export async function GET(req: Request) {
const { searchParams } = new URL(req.url);
@@ -64,7 +64,7 @@ export async function GET(req: Request) {
}
// Validate platform exists in providers
- const provider = ONLINE_PRESENCE_PROVIDERS[platform];
+ const provider = PARTNER_PLATFORMS_PROVIDERS[platform];
if (!provider) {
console.error(`Invalid platform: ${platform}`);
return NextResponse.redirect(PARTNERS_DOMAIN);
@@ -73,7 +73,7 @@ export async function GET(req: Request) {
// Redirect user based on source
const redirectUrl =
source === "onboarding"
- ? `${PARTNERS_DOMAIN}/onboarding/online-presence`
+ ? `${PARTNERS_DOMAIN}/onboarding/platforms`
: `${PARTNERS_DOMAIN}/profile`;
const { tokenUrl, clientId, clientSecret, verify, pkce, clientIdParam } =
@@ -87,7 +87,7 @@ export async function GET(req: Request) {
// Local development redirect since the verifier cookie won't be present on ngrok
if (pkce && !codeVerifier && process.env.NODE_ENV === "development") {
return NextResponse.redirect(
- `http://partners.localhost:8888/api/partners/online-presence/callback?${searchParams.toString()}`,
+ `http://partners.localhost:8888/api/partners/platforms/callback?${searchParams.toString()}`,
);
}
@@ -99,7 +99,7 @@ export async function GET(req: Request) {
[clientIdParam ?? "client_id"]: clientId!,
client_secret: clientSecret!,
code,
- redirect_uri: `${PARTNERS_DOMAIN_WITH_NGROK}/api/partners/online-presence/callback`,
+ redirect_uri: `${PARTNERS_DOMAIN_WITH_NGROK}/api/partners/platforms/callback`,
grant_type: "authorization_code",
...(codeVerifier && { code_verifier: codeVerifier }),
});
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx
index 1bc9f6f6ad..df57ec2aec 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx
@@ -5,9 +5,9 @@ import { PartnerProps } from "@/lib/types";
import { useConfirmModal } from "@/ui/modals/confirm-modal";
import { CountryCombobox } from "@/ui/partners/country-combobox";
import {
- OnlinePresenceForm,
- useOnlinePresenceForm,
-} from "@/ui/partners/online-presence-form";
+ PartnerPlatformsForm,
+ usePartnerPlatformsForm,
+} from "@/ui/partners/partner-platforms-form";
import { CustomToast } from "@/ui/shared/custom-toast";
import { AlertCircleFill } from "@/ui/shared/icons";
import { PartnerProfileType } from "@dub/prisma/client";
@@ -46,7 +46,7 @@ export function ProfileDetailsForm({ partner }: { partner?: PartnerProps }) {
? !hasPermission(partner.role, "partner_profile.update")
: true;
const basicInfoFormRef = useRef<HTMLFormElement>(null);
- const onlinePresenceFormRef = useRef<HTMLFormElement>(null);
+ const partnerPlatformsFormRef = useRef<HTMLFormElement>(null);
const basicInfoForm = useForm<BasicInfoFormData>({
defaultValues: {
@@ -58,7 +58,7 @@ export function ProfileDetailsForm({ partner }: { partner?: PartnerProps }) {
companyName: partner?.companyName ?? null,
},
});
- const onlinePresenceForm = useOnlinePresenceForm({ partner });
+ const partnerPlatformsForm = usePartnerPlatformsForm({ partner });
const {
setShowConfirmModal: setShowStripeConfirmModal,
@@ -70,7 +70,7 @@ export function ProfileDetailsForm({ partner }: { partner?: PartnerProps }) {
confirmText: "Continue",
onConfirm: () => {
basicInfoFormRef.current?.requestSubmit();
- onlinePresenceFormRef.current?.requestSubmit();
+ partnerPlatformsFormRef.current?.requestSubmit();
},
});
@@ -104,10 +104,10 @@ export function ProfileDetailsForm({ partner }: { partner?: PartnerProps }) {
heading="Website and socials"
description="Add your website and social accounts you use to share links. Verifying as many platforms as possible helps build trust with programs."
>
- <OnlinePresenceForm
- ref={onlinePresenceFormRef}
+ <PartnerPlatformsForm
+ ref={partnerPlatformsFormRef}
partner={partner}
- form={onlinePresenceForm}
+ form={partnerPlatformsForm}
variant="settings"
/>
</SettingsRow>
@@ -119,7 +119,7 @@ export function ProfileDetailsForm({ partner }: { partner?: PartnerProps }) {
disabled={disabled}
loading={
basicInfoForm.formState.isSubmitting ||
- onlinePresenceForm.formState.isSubmitting
+ partnerPlatformsForm.formState.isSubmitting
}
onClick={() => {
if (disabled) return;
@@ -133,7 +133,7 @@ export function ProfileDetailsForm({ partner }: { partner?: PartnerProps }) {
setShowStripeConfirmModal(true);
} else {
basicInfoFormRef.current?.requestSubmit();
- onlinePresenceFormRef.current?.requestSubmit();
+ partnerPlatformsFormRef.current?.requestSubmit();
}
}}
/>
diff --git a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
index 3d17ce6d90..38090fcf5c 100644
--- a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
@@ -93,7 +93,7 @@ export function OnboardingForm({
const { executeAsync, isPending } = useAction(onboardPartnerAction, {
onSuccess: () => {
setAccountCreated(true);
- router.push("/onboarding/online-presence");
+ router.push("/onboarding/platforms");
},
onError: ({ error, input }) => {
toast.error(error.serverError);
diff --git a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/verify/page.tsx b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/payouts/page.tsx
similarity index 100%
rename from apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/verify/page.tsx
rename to apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/payouts/page.tsx
diff --git a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/online-presence/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/platforms/page-client.tsx
similarity index 60%
rename from apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/online-presence/page-client.tsx
rename to apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/platforms/page-client.tsx
index af2745661d..bd97ecef64 100644
--- a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/online-presence/page-client.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/platforms/page-client.tsx
@@ -1,11 +1,11 @@
"use client";
import { PartnerProps } from "@/lib/types";
-import { OnlinePresenceForm } from "@/ui/partners/online-presence-form";
+import { PartnerPlatformsForm } from "@/ui/partners/partner-platforms-form";
import Link from "next/link";
import { useRouter } from "next/navigation";
-export function OnlinePresencePageClient({
+export function OnboardingPlatformsPageClient({
partner,
}: {
partner: Pick<PartnerProps, "country" | "platforms">;
@@ -14,17 +14,13 @@ export function OnlinePresencePageClient({
return (
<>
- <OnlinePresenceForm
- onSubmitSuccessful={() =>
- router.push(
- partner.country === "US" ? "/onboarding/verify" : "/programs",
- )
- }
+ <PartnerPlatformsForm
+ onSubmitSuccessful={() => router.push("/onboarding/payouts")}
partner={partner}
variant="onboarding"
/>
<Link
- href="/onboarding/verify"
+ href="/onboarding/payouts"
className="text-sm font-medium text-neutral-800 transition-colors hover:text-neutral-950"
>
I'll complete this later
diff --git a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/online-presence/page.tsx b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/platforms/page.tsx
similarity index 82%
rename from apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/online-presence/page.tsx
rename to apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/platforms/page.tsx
index eae8a64a6a..7c0619045b 100644
--- a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/online-presence/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/platforms/page.tsx
@@ -2,35 +2,35 @@ import { getSession } from "@/lib/auth";
import { buildSocialPlatformLookup } from "@/lib/social-utils";
import { PartnerPlatformProps } from "@/lib/types";
import { partnerPlatformSchema } from "@/lib/zod/schemas/partners";
-import { OnlinePresenceForm } from "@/ui/partners/online-presence-form";
+import { PartnerPlatformsForm } from "@/ui/partners/partner-platforms-form";
import { prisma } from "@dub/prisma";
import { PlatformType } from "@dub/prisma/client";
import { Suspense } from "react";
import * as z from "zod/v4";
-import { OnlinePresencePageClient } from "./page-client";
+import { OnboardingPlatformsPageClient } from "./page-client";
-export default function OnlinePresencePage() {
+export default function OnboardingPlatformsPage() {
return (
<div className="relative mx-auto w-full max-w-[416px] text-center md:mt-4">
<h1 className="animate-slide-up-fade text-lg font-medium [--offset:8px] [animation-delay:250ms] [animation-duration:1s] [animation-fill-mode:both]">
- Your online presence
+ Your social and web platforms
</h1>
<p className="animate-slide-up-fade text-content-subtle mt-1 text-sm [animation-delay:500ms] [animation-duration:1s] [animation-fill-mode:both]">
- These improve your reputation score and rank you higher. Verification is
- optional and can be done later.
+ Verifying your social and web platforms will improve your reputation
+ score and rank you higher in our partner network.
</p>
<div className="animate-slide-up-fade mt-8 grid gap-4 [animation-delay:750ms] [animation-duration:1s] [animation-fill-mode:both]">
- <Suspense fallback={<OnlinePresenceForm partner={null} />}>
- <OnlinePresenceFormRSC />
+ <Suspense fallback={<PartnerPlatformsForm partner={null} />}>
+ <OnboardingPlatformsFormRSC />
</Suspense>
</div>
</div>
);
}
-async function OnlinePresenceFormRSC() {
+async function OnboardingPlatformsFormRSC() {
const { user } = await getSession();
const [partner, application] = await Promise.all([
@@ -114,5 +114,5 @@ async function OnlinePresenceFormRSC() {
}
}
- return <OnlinePresencePageClient partner={{ ...partner, platforms }} />;
+ return <OnboardingPlatformsPageClient partner={{ ...partner, platforms }} />;
}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/page-client.tsx
index e5f951e24d..688552a0a0 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/page-client.tsx
@@ -380,7 +380,7 @@ function PartnerCard({
[partner],
);
- const onlinePresenceData = useMemo(
+ const partnerPlatformsData = useMemo(
() =>
partner
? PARTNER_PLATFORM_FIELDS.map((field) => ({
@@ -491,15 +491,15 @@ function PartnerCard({
))}
</div>
- {/* Online presence */}
+ {/* Platforms */}
<div
className={cn(
"flex flex-wrap items-center gap-1.5",
!partner && "animate-pulse",
)}
>
- {onlinePresenceData?.length
- ? onlinePresenceData.map(
+ {partnerPlatformsData?.length
+ ? partnerPlatformsData.map(
({ label, icon: Icon, verified, value, href }) => (
<Tooltip
key={label}
diff --git a/apps/web/lib/actions/partners/start-partner-platform-verification.ts b/apps/web/lib/actions/partners/start-partner-platform-verification.ts
index 9f553b4fce..c71dc4fc7c 100644
--- a/apps/web/lib/actions/partners/start-partner-platform-verification.ts
+++ b/apps/web/lib/actions/partners/start-partner-platform-verification.ts
@@ -4,7 +4,7 @@ import {
generateCodeChallengeHash,
generateCodeVerifier,
} from "@/lib/api/oauth/utils";
-import { ONLINE_PRESENCE_PROVIDERS } from "@/lib/api/partner-profile/online-presence-providers";
+import { PARTNER_PLATFORMS_PROVIDERS } from "@/lib/api/partner-profile/partner-platforms-providers";
import { upsertPartnerPlatform } from "@/lib/api/partner-profile/upsert-partner-platform";
import { generateOTP } from "@/lib/auth/utils";
import {
@@ -75,7 +75,7 @@ export const startPartnerPlatformVerificationAction = authPartnerActionClient
}
// For OAuth based verification
- const oauthProvider = ONLINE_PRESENCE_PROVIDERS[platform];
+ const oauthProvider = PARTNER_PLATFORMS_PROVIDERS[platform];
if (oauthProvider) {
return startOAuthVerification(params);
}
@@ -122,7 +122,7 @@ async function startOAuthVerification({
}: VerificationParams): Promise<
Extract<VerificationResult, { type: "oauth" }>
> {
- const oauthProvider = ONLINE_PRESENCE_PROVIDERS[platform];
+ const oauthProvider = PARTNER_PLATFORMS_PROVIDERS[platform];
if (!oauthProvider || !oauthProvider.clientId) {
throw new Error(`OAuth provider not configured for ${platform}`);
}
@@ -167,7 +167,7 @@ async function startOAuthVerification({
const searchParams = new URLSearchParams({
[oauthProvider.clientIdParam ?? "client_id"]: oauthProvider.clientId,
- redirect_uri: `${PARTNERS_DOMAIN_WITH_NGROK}/api/partners/online-presence/callback`,
+ redirect_uri: `${PARTNERS_DOMAIN_WITH_NGROK}/api/partners/platforms/callback`,
scope: oauthProvider.scopes,
response_type: "code",
state,
diff --git a/apps/web/lib/actions/partners/update-online-presence.ts b/apps/web/lib/actions/partners/update-partner-platforms.ts
similarity index 97%
rename from apps/web/lib/actions/partners/update-online-presence.ts
rename to apps/web/lib/actions/partners/update-partner-platforms.ts
index b91b54a14e..930baf5474 100644
--- a/apps/web/lib/actions/partners/update-online-presence.ts
+++ b/apps/web/lib/actions/partners/update-partner-platforms.ts
@@ -46,7 +46,7 @@ const createWebsiteSchema = () => {
);
};
-const updateOnlinePresenceSchema = z.object({
+const updatePartnerPlatformsSchema = z.object({
website: createWebsiteSchema(),
youtube: createSocialPlatformSchema("youtube"),
twitter: createSocialPlatformSchema("twitter"),
@@ -56,8 +56,8 @@ const updateOnlinePresenceSchema = z.object({
source: z.enum(["onboarding", "settings"]).default("onboarding"),
});
-export const updateOnlinePresenceAction = authPartnerActionClient
- .inputSchema(updateOnlinePresenceSchema)
+export const updatePartnerPlatformsAction = authPartnerActionClient
+ .inputSchema(updatePartnerPlatformsSchema)
.action(async ({ ctx, parsedInput }) => {
const { partner } = ctx;
diff --git a/apps/web/lib/api/network/calculate-partner-ranking.ts b/apps/web/lib/api/network/calculate-partner-ranking.ts
index d7d2a07f42..0c0b97bde2 100644
--- a/apps/web/lib/api/network/calculate-partner-ranking.ts
+++ b/apps/web/lib/api/network/calculate-partner-ranking.ts
@@ -128,7 +128,7 @@ export async function calculatePartnerRanking({
const whereClause = Prisma.join(conditions, " AND ");
- // Rank partners with no online presence lower
+ // Rank partners with no platforms lower
const hasProfileCheck = Prisma.sql`EXISTS (
SELECT 1
FROM PartnerPlatform pp
@@ -261,7 +261,7 @@ export async function calculatePartnerRanking({
-- Trusted partners (trustedAt IS NOT NULL) get 200 bonus points to rank at the top
-- Partners with profiles get 500 bonus points to ensure they rank above those without profiles
(
- -- Profile bonus: 500 points for partners with online presence (ensures they rank above those without)
+ -- Profile bonus: 500 points for partners with platforms (ensures they rank above those without)
CASE WHEN ${hasProfileCheck} THEN 500 ELSE 0 END +
-- Trusted partner bonus: 200 points for partners with trustedAt set
CASE WHEN p.trustedAt IS NOT NULL THEN 200 ELSE 0 END +
diff --git a/apps/web/lib/api/partner-profile/online-presence-providers.ts b/apps/web/lib/api/partner-profile/online-presence-providers.ts
deleted file mode 100644
index 9229745822..0000000000
--- a/apps/web/lib/api/partner-profile/online-presence-providers.ts
+++ /dev/null
@@ -1,159 +0,0 @@
-type OnlinePresenceProvider = {
- authUrl: string;
- tokenUrl: string;
- clientId: string | null;
- clientSecret: string | null;
- clientIdParam?: string;
- pkce?: boolean;
- scopes: string;
- verify: (props: { handle: string; accessToken: string }) => Promise<{
- verified: boolean;
- metadata?: Record<string, string>;
- }>;
-};
-
-export const ONLINE_PRESENCE_PROVIDERS: Record<string, OnlinePresenceProvider> =
- {
- twitter: {
- authUrl: "https://x.com/i/oauth2/authorize",
- tokenUrl: "https://api.x.com/2/oauth2/token",
- clientId: process.env.TWITTER_CLIENT_ID ?? null,
- clientSecret: process.env.TWITTER_CLIENT_SECRET ?? null,
- pkce: true,
- scopes: "users.read tweet.read",
- verify: async ({ handle, accessToken }) => {
- if (!handle) {
- return {
- verified: false,
- };
- }
-
- // Fetch user info
- const response = await fetch("https://api.twitter.com/2/users/me", {
- headers: {
- Authorization: `Bearer ${accessToken}`,
- },
- });
-
- const userResponse = await response.json();
-
- if (!response.ok) {
- console.error("Failed to verify Twitter handle", userResponse);
-
- return {
- verified: false,
- };
- }
-
- const username = userResponse?.data?.username;
-
- if (!username) {
- console.error(
- "No username found in Twitter user response",
- userResponse,
- );
-
- return {
- verified: false,
- };
- }
-
- return {
- verified: handle.toLowerCase() === username.toLowerCase(),
- };
- },
- },
-
- tiktok: {
- authUrl: "https://www.tiktok.com/v2/auth/authorize",
- tokenUrl: "https://open.tiktokapis.com/v2/oauth/token/",
- clientId: process.env.TIKTOK_CLIENT_ID ?? null,
- clientSecret: process.env.TIKTOK_CLIENT_SECRET ?? null,
- clientIdParam: "client_key",
- scopes: "user.info.basic,user.info.profile",
- verify: async ({ handle, accessToken }) => {
- if (!handle) {
- return {
- verified: false,
- };
- }
-
- // Fetch user info
- const response = await fetch(
- "https://open.tiktokapis.com/v2/user/info/?fields=username",
- {
- headers: {
- Authorization: `Bearer ${accessToken}`,
- },
- },
- );
-
- const userResponse = await response.json();
-
- if (!response.ok) {
- console.error("Failed to verify TikTok handle", userResponse);
-
- return {
- verified: false,
- };
- }
-
- const username = userResponse?.data?.user?.username;
-
- if (!username) {
- console.error(
- "No username found in TikTok user response",
- userResponse,
- );
-
- return {
- verified: false,
- };
- }
-
- return {
- verified: handle.toLowerCase() === username.toLowerCase(),
- };
- },
- },
-
- // We don't support LinkedIn verification yet
- linkedin: {
- authUrl: "https://www.linkedin.com/oauth/v2/authorization",
- tokenUrl: "https://www.linkedin.com/oauth/v2/accessToken",
- clientId: process.env.LINKEDIN_CLIENT_ID ?? null,
- clientSecret: process.env.LINKEDIN_CLIENT_SECRET ?? null,
- scopes: "openid profile",
- verify: async ({ handle, accessToken }) => {
- if (!handle) {
- return {
- verified: false,
- };
- }
-
- // Fetch user info using OpenID Connect userinfo endpoint
- const response = await fetch("https://api.linkedin.com/v2/userinfo", {
- headers: {
- Authorization: `Bearer ${accessToken}`,
- },
- });
-
- const userResponse = await response.json();
-
- if (!response.ok) {
- console.error("Failed to verify LinkedIn handle", userResponse);
-
- return {
- verified: false,
- };
- }
-
- // TODO:
- // We can't verify the handle because the LinkedIn API doesn't return the vanity name in the response
-
- return {
- verified: false,
- };
- },
- },
- };
diff --git a/apps/web/lib/api/partner-profile/partner-platforms-providers.ts b/apps/web/lib/api/partner-profile/partner-platforms-providers.ts
new file mode 100644
index 0000000000..c68983fb67
--- /dev/null
+++ b/apps/web/lib/api/partner-profile/partner-platforms-providers.ts
@@ -0,0 +1,161 @@
+type PartnerPlatformsProvider = {
+ authUrl: string;
+ tokenUrl: string;
+ clientId: string | null;
+ clientSecret: string | null;
+ clientIdParam?: string;
+ pkce?: boolean;
+ scopes: string;
+ verify: (props: { handle: string; accessToken: string }) => Promise<{
+ verified: boolean;
+ metadata?: Record<string, string>;
+ }>;
+};
+
+export const PARTNER_PLATFORMS_PROVIDERS: Record<
+ string,
+ PartnerPlatformsProvider
+> = {
+ twitter: {
+ authUrl: "https://x.com/i/oauth2/authorize",
+ tokenUrl: "https://api.x.com/2/oauth2/token",
+ clientId: process.env.TWITTER_CLIENT_ID ?? null,
+ clientSecret: process.env.TWITTER_CLIENT_SECRET ?? null,
+ pkce: true,
+ scopes: "users.read tweet.read",
+ verify: async ({ handle, accessToken }) => {
+ if (!handle) {
+ return {
+ verified: false,
+ };
+ }
+
+ // Fetch user info
+ const response = await fetch("https://api.twitter.com/2/users/me", {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ },
+ });
+
+ const userResponse = await response.json();
+
+ if (!response.ok) {
+ console.error("Failed to verify Twitter handle", userResponse);
+
+ return {
+ verified: false,
+ };
+ }
+
+ const username = userResponse?.data?.username;
+
+ if (!username) {
+ console.error(
+ "No username found in Twitter user response",
+ userResponse,
+ );
+
+ return {
+ verified: false,
+ };
+ }
+
+ return {
+ verified: handle.toLowerCase() === username.toLowerCase(),
+ };
+ },
+ },
+
+ tiktok: {
+ authUrl: "https://www.tiktok.com/v2/auth/authorize",
+ tokenUrl: "https://open.tiktokapis.com/v2/oauth/token/",
+ clientId: process.env.TIKTOK_CLIENT_ID ?? null,
+ clientSecret: process.env.TIKTOK_CLIENT_SECRET ?? null,
+ clientIdParam: "client_key",
+ scopes: "user.info.basic,user.info.profile",
+ verify: async ({ handle, accessToken }) => {
+ if (!handle) {
+ return {
+ verified: false,
+ };
+ }
+
+ // Fetch user info
+ const response = await fetch(
+ "https://open.tiktokapis.com/v2/user/info/?fields=username",
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ },
+ },
+ );
+
+ const userResponse = await response.json();
+
+ if (!response.ok) {
+ console.error("Failed to verify TikTok handle", userResponse);
+
+ return {
+ verified: false,
+ };
+ }
+
+ const username = userResponse?.data?.user?.username;
+
+ if (!username) {
+ console.error(
+ "No username found in TikTok user response",
+ userResponse,
+ );
+
+ return {
+ verified: false,
+ };
+ }
+
+ return {
+ verified: handle.toLowerCase() === username.toLowerCase(),
+ };
+ },
+ },
+
+ // We don't support LinkedIn verification yet
+ linkedin: {
+ authUrl: "https://www.linkedin.com/oauth/v2/authorization",
+ tokenUrl: "https://www.linkedin.com/oauth/v2/accessToken",
+ clientId: process.env.LINKEDIN_CLIENT_ID ?? null,
+ clientSecret: process.env.LINKEDIN_CLIENT_SECRET ?? null,
+ scopes: "openid profile",
+ verify: async ({ handle, accessToken }) => {
+ if (!handle) {
+ return {
+ verified: false,
+ };
+ }
+
+ // Fetch user info using OpenID Connect userinfo endpoint
+ const response = await fetch("https://api.linkedin.com/v2/userinfo", {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ },
+ });
+
+ const userResponse = await response.json();
+
+ if (!response.ok) {
+ console.error("Failed to verify LinkedIn handle", userResponse);
+
+ return {
+ verified: false,
+ };
+ }
+
+ // TODO:
+ // We can't verify the handle because the LinkedIn API doesn't return the vanity name in the response
+
+ return {
+ verified: false,
+ };
+ },
+ },
+};
diff --git a/apps/web/lib/email/email-templates-map.ts b/apps/web/lib/email/email-templates-map.ts
index ba965881e8..115c3eeb8c 100644
--- a/apps/web/lib/email/email-templates-map.ts
+++ b/apps/web/lib/email/email-templates-map.ts
@@ -1,11 +1,11 @@
import BountyApproved from "@dub/email/templates/bounty-approved";
+import ProgramMarketplaceAnnouncement from "@dub/email/templates/broadcasts/program-marketplace-announcement";
import ConnectPayoutReminder from "@dub/email/templates/connect-payout-reminder";
import DubPartnerRewind from "@dub/email/templates/dub-partner-rewind";
import PartnerBanned from "@dub/email/templates/partner-banned";
import PartnerDeactivated from "@dub/email/templates/partner-deactivated";
import PartnerPayoutConfirmed from "@dub/email/templates/partner-payout-confirmed";
import PartnerPayoutProcessed from "@dub/email/templates/partner-payout-processed";
-import ProgramMarketplaceAnnouncement from "@dub/email/templates/program-marketplace-announcement";
import ProgramPayoutThankYou from "@dub/email/templates/program-payout-thank-you";
import UnresolvedFraudEventsSummary from "@dub/email/templates/unresolved-fraud-events-summary";
diff --git a/apps/web/lib/middleware/utils/partners-redirect.ts b/apps/web/lib/middleware/utils/partners-redirect.ts
index f3765a3ef4..5a2d0e3124 100644
--- a/apps/web/lib/middleware/utils/partners-redirect.ts
+++ b/apps/web/lib/middleware/utils/partners-redirect.ts
@@ -6,6 +6,8 @@ const PARTNERS_REDIRECTS = {
"/profile/sites": "/profile",
"/marketplace": "/programs/marketplace",
"/rewind": "/rewind/2025",
+ "/onboarding/online-presence": "/onboarding/platforms",
+ "/onboarding/verify": "/onboarding/payouts",
};
export const partnersRedirect = (path: string) => {
diff --git a/apps/web/lib/swr/use-partner-earnings-timeseries.ts b/apps/web/lib/swr/use-partner-earnings-timeseries.ts
index 24eaefa04f..721d7cfaf3 100644
--- a/apps/web/lib/swr/use-partner-earnings-timeseries.ts
+++ b/apps/web/lib/swr/use-partner-earnings-timeseries.ts
@@ -7,17 +7,22 @@ import { DUB_PARTNERS_ANALYTICS_INTERVAL } from "../analytics/constants";
import { PartnerEarningsTimeseriesFilters } from "../analytics/types";
export function usePartnerEarningsTimeseries(
- params?: PartnerEarningsTimeseriesFilters & { programId?: string },
+ params?: PartnerEarningsTimeseriesFilters & {
+ programId?: string;
+ enabled?: boolean;
+ },
) {
const { data: session } = useSession();
const partnerId = session?.user?.["defaultPartnerId"];
const { programSlug } = useParams();
const programIdToUse = params?.programId ?? programSlug;
+ const enabled = params?.enabled !== false;
const { getQueryString } = useRouterStuff();
const { data, error } = useSWR<any>(
- partnerId &&
+ enabled &&
+ partnerId &&
programIdToUse &&
`/api/partner-profile/programs/${programIdToUse}/earnings/timeseries${getQueryString(
{
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index 84c6fbca46..8be31b7d7f 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -217,7 +217,7 @@ export const partnerPlatformSchema = z.object({
views: z.bigint().default(BigInt(0)),
});
-export const PartnerOnlinePresenceSchema = z.object({
+export const PartnerPartnerPlatformsSchema = z.object({
website: z
.string()
.nullish()
@@ -342,7 +342,7 @@ export const PartnerSchema = z
"The date when the partner received the trusted badge in the partner network.",
),
})
- .extend(PartnerOnlinePresenceSchema.shape)
+ .extend(PartnerPartnerPlatformsSchema.shape)
.extend(PartnerProfileSchema.partial().shape);
export const PartnerWithProfileSchema = PartnerSchema.extend(
@@ -457,7 +457,7 @@ export const EnrolledPartnerSchema = PartnerSchema.pick({
),
})
.extend(
- PartnerOnlinePresenceSchema.pick({
+ PartnerPartnerPlatformsSchema.pick({
website: true,
youtube: true,
twitter: true,
@@ -481,7 +481,7 @@ export const EnrolledPartnerSchemaExtended = EnrolledPartnerSchema.extend({
salesChannels: true,
}).shape,
)
- .extend(PartnerOnlinePresenceSchema.shape);
+ .extend(PartnerPartnerPlatformsSchema.shape);
export const WebhookPartnerSchema = PartnerSchema.pick({
id: true,
diff --git a/apps/web/lib/zod/schemas/program-application.ts b/apps/web/lib/zod/schemas/program-application.ts
index cdbd46af5a..c844f35905 100644
--- a/apps/web/lib/zod/schemas/program-application.ts
+++ b/apps/web/lib/zod/schemas/program-application.ts
@@ -1,5 +1,8 @@
import * as z from "zod/v4";
-import { EnrolledPartnerSchema, PartnerOnlinePresenceSchema } from "./partners";
+import {
+ EnrolledPartnerSchema,
+ PartnerPartnerPlatformsSchema,
+} from "./partners";
import { ProgramEnrollmentSchema } from "./programs";
export const partnerApplicationWebhookSchema = z.object({
@@ -21,7 +24,7 @@ export const partnerApplicationWebhookSchema = z.object({
}).shape,
)
.extend(
- PartnerOnlinePresenceSchema.pick({
+ PartnerPartnerPlatformsSchema.pick({
website: true,
youtube: true,
twitter: true,
diff --git a/apps/web/scripts/migrations/backfill-partner-platforms.ts b/apps/web/scripts/migrations/backfill-partner-platforms.ts
index f0c1f69f30..9b7fcd5032 100644
--- a/apps/web/scripts/migrations/backfill-partner-platforms.ts
+++ b/apps/web/scripts/migrations/backfill-partner-platforms.ts
@@ -1,3 +1,5 @@
+// @ts-nocheck - old migration script
+
import { prisma } from "@dub/prisma";
import { Prisma } from "@dub/prisma/client";
import "dotenv-flow/config";
diff --git a/apps/web/ui/partners/partner-about.tsx b/apps/web/ui/partners/partner-about.tsx
index 60fc419cc4..68cd277876 100644
--- a/apps/web/ui/partners/partner-about.tsx
+++ b/apps/web/ui/partners/partner-about.tsx
@@ -7,7 +7,7 @@ import {
salesChannelsMap,
} from "@/lib/partners/partner-profile";
import { EnrolledPartnerExtendedProps } from "@/lib/types";
-import { OnlinePresenceSummary } from "@/ui/partners/online-presence-summary";
+import { PartnerPlatformSummary } from "@/ui/partners/partner-platform-summary";
import { Icon, InfoTooltip } from "@dub/ui";
export function PartnerAbout({
@@ -44,7 +44,7 @@ export function PartnerAbout({
<h3 className="text-content-emphasis text-sm font-semibold">
Website and socials
</h3>
- <OnlinePresenceSummary
+ <PartnerPlatformSummary
platforms={partner.platforms}
showLabels={false}
className="gap-y-2"
diff --git a/apps/web/ui/partners/online-presence-card.tsx b/apps/web/ui/partners/partner-platform-card.tsx
similarity index 98%
rename from apps/web/ui/partners/online-presence-card.tsx
rename to apps/web/ui/partners/partner-platform-card.tsx
index 7717e8090a..df80e244ae 100644
--- a/apps/web/ui/partners/online-presence-card.tsx
+++ b/apps/web/ui/partners/partner-platform-card.tsx
@@ -9,7 +9,7 @@ import {
import { cn } from "@dub/utils";
import { PropsWithChildren } from "react";
-export function OnlinePresenceCard({
+export function PartnerPlatformCard({
icon: Icon,
prefix,
value,
diff --git a/apps/web/ui/partners/online-presence-summary.tsx b/apps/web/ui/partners/partner-platform-summary.tsx
similarity index 90%
rename from apps/web/ui/partners/online-presence-summary.tsx
rename to apps/web/ui/partners/partner-platform-summary.tsx
index f065352fcf..af0d09a86d 100644
--- a/apps/web/ui/partners/online-presence-summary.tsx
+++ b/apps/web/ui/partners/partner-platform-summary.tsx
@@ -2,9 +2,9 @@ import { PARTNER_PLATFORM_FIELDS } from "@/lib/partners/partner-platforms";
import { PartnerPlatformProps } from "@/lib/types";
import { cn } from "@dub/utils";
import { Fragment } from "react";
-import { OnlinePresenceCard } from "./online-presence-card";
+import { PartnerPlatformCard } from "./partner-platform-card";
-export function OnlinePresenceSummary({
+export function PartnerPlatformSummary({
platforms,
showLabels = true,
className,
@@ -24,7 +24,7 @@ export function OnlinePresenceSummary({
emptyClassName,
)}
>
- No online presence provided
+ No platforms connected
</div>
);
}
@@ -50,7 +50,7 @@ export function OnlinePresenceSummary({
<span className="text-content-default font-medium">{label}</span>
)}
<div>
- <OnlinePresenceCard
+ <PartnerPlatformCard
icon={Icon}
value={value ?? ""}
verified={verified}
diff --git a/apps/web/ui/partners/online-presence-form.tsx b/apps/web/ui/partners/partner-platforms-form.tsx
similarity index 94%
rename from apps/web/ui/partners/online-presence-form.tsx
rename to apps/web/ui/partners/partner-platforms-form.tsx
index 2496c627d4..af10532de9 100644
--- a/apps/web/ui/partners/online-presence-form.tsx
+++ b/apps/web/ui/partners/partner-platforms-form.tsx
@@ -2,7 +2,7 @@
import { parseActionError } from "@/lib/actions/parse-action-errors";
import { startPartnerPlatformVerificationAction } from "@/lib/actions/partners/start-partner-platform-verification";
-import { updateOnlinePresenceAction } from "@/lib/actions/partners/update-online-presence";
+import { updatePartnerPlatformsAction } from "@/lib/actions/partners/update-partner-platforms";
import { hasPermission } from "@/lib/auth/partner-users/partner-user-permissions";
import { sanitizeSocialHandle, sanitizeWebsite } from "@/lib/social-utils";
import usePartnerProfile from "@/lib/swr/use-partner-profile";
@@ -36,7 +36,7 @@ import {
import { toast } from "sonner";
import { mutate } from "swr";
import * as z from "zod/v4";
-import { OnlinePresenceCard } from "./online-presence-card";
+import { PartnerPlatformCard } from "./partner-platform-card";
const onlinePresenceSchema = z.object({
website: parseUrlSchemaAllowEmpty().nullish(),
@@ -47,9 +47,9 @@ const onlinePresenceSchema = z.object({
tiktok: z.string().nullish(),
});
-type OnlinePresenceFormData = z.infer<typeof onlinePresenceSchema>;
+type PartnerPlatformsFormData = z.infer<typeof onlinePresenceSchema>;
-interface OnlinePresenceFormProps {
+interface PartnerPlatformsFormProps {
variant?: "onboarding" | "settings";
partner?: Pick<PartnerProps, "platforms"> | null;
onSubmitSuccessful?: () => void;
@@ -65,7 +65,7 @@ function getPlatformData(
// Helper function to get identifier from platforms array
function getPlatformIdentifier(
- partner: OnlinePresenceFormProps["partner"],
+ partner: PartnerPlatformsFormProps["partner"],
platform: PlatformType,
): string | undefined {
return getPlatformData(partner?.platforms, platform)?.identifier;
@@ -75,10 +75,10 @@ function getPlatformIdentifier(
* Separate optional hook to allow for form management outside of the main component.
* If used, the returned form object should be passed to the main component as a prop.
*/
-export function useOnlinePresenceForm({
+export function usePartnerPlatformsForm({
partner,
-}: Pick<OnlinePresenceFormProps, "partner">) {
- return useForm<OnlinePresenceFormData>({
+}: Pick<PartnerPlatformsFormProps, "partner">) {
+ return useForm<PartnerPlatformsFormData>({
defaultValues: {
website: getPlatformIdentifier(partner, "website")
? getPrettyUrl(getPlatformIdentifier(partner, "website")!)
@@ -92,13 +92,13 @@ export function useOnlinePresenceForm({
});
}
-type OnlinePresenceFormWithFormProps = OnlinePresenceFormProps & {
- form?: ReturnType<typeof useOnlinePresenceForm>;
+type PartnerPlatformsFormWithFormProps = PartnerPlatformsFormProps & {
+ form?: ReturnType<typeof usePartnerPlatformsForm>;
};
-export const OnlinePresenceForm = forwardRef<
+export const PartnerPlatformsForm = forwardRef<
HTMLFormElement,
- OnlinePresenceFormWithFormProps
+ PartnerPlatformsFormWithFormProps
>(
(
{
@@ -106,10 +106,11 @@ export const OnlinePresenceForm = forwardRef<
variant = "onboarding",
partner,
onSubmitSuccessful,
- }: OnlinePresenceFormWithFormProps,
+ }: PartnerPlatformsFormWithFormProps,
ref,
) => {
- const form = formProp ?? useOnlinePresenceForm({ partner });
+ const defaultForm = usePartnerPlatformsForm({ partner });
+ const form = formProp ?? defaultForm;
const { partner: currentPartner } = usePartnerProfile();
const disabled = currentPartner
@@ -125,13 +126,13 @@ export const OnlinePresenceForm = forwardRef<
formState: { errors, isSubmitting, isSubmitSuccessful },
} = form;
- const { executeAsync } = useAction(updateOnlinePresenceAction, {
+ const { executeAsync } = useAction(updatePartnerPlatformsAction, {
onSuccess: async () => {
await mutate("/api/partner-profile");
},
onError: ({ error }) => {
toast.error(
- parseActionError(error, "Failed to update online presence"),
+ parseActionError(error, "Failed to update partner platforms"),
);
reset(form.getValues(), { keepErrors: true });
@@ -384,18 +385,17 @@ export const OnlinePresenceForm = forwardRef<
/>
<FormRow
- label="LinkedIn"
- property="linkedin"
- prefix="in/"
- icon={LinkedIn}
+ label="Instagram"
+ property="instagram"
+ prefix="@"
+ icon={Instagram}
disabled={disabled}
- verifyDisabledTooltip="LinkedIn verification is coming soon."
onVerifyClick={async () => {
- const handle = getValues("linkedin");
+ const handle = getValues("instagram");
if (handle) {
await startSocialVerification({
- platform: "linkedin",
+ platform: "instagram",
handle,
source: variant,
});
@@ -406,7 +406,7 @@ export const OnlinePresenceForm = forwardRef<
input={
<div className="flex rounded-md">
<span className="inline-flex items-center rounded-l-md border border-r-0 border-neutral-300 bg-neutral-50 px-3 text-neutral-500 sm:text-sm">
- linkedin.com/in
+ instagram.com
</span>
<input
type="text"
@@ -415,13 +415,13 @@ export const OnlinePresenceForm = forwardRef<
"block w-full rounded-none rounded-r-md focus:outline-none sm:text-sm",
disabled &&
"cursor-not-allowed bg-neutral-50 text-neutral-400",
- errors.linkedin
+ errors.instagram
? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"
: "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",
)}
placeholder="handle"
- onPaste={(e) => onPasteSocial(e, "linkedin")}
- {...register("linkedin")}
+ onPaste={(e) => onPasteSocial(e, "instagram")}
+ {...register("instagram")}
/>
</div>
}
@@ -429,17 +429,17 @@ export const OnlinePresenceForm = forwardRef<
/>
<FormRow
- label="Instagram"
- property="instagram"
+ label="TikTok"
+ property="tiktok"
prefix="@"
- icon={Instagram}
+ icon={TikTok}
disabled={disabled}
onVerifyClick={async () => {
- const handle = getValues("instagram");
+ const handle = getValues("tiktok");
if (handle) {
await startSocialVerification({
- platform: "instagram",
+ platform: "tiktok",
handle,
source: variant,
});
@@ -450,22 +450,25 @@ export const OnlinePresenceForm = forwardRef<
input={
<div className="flex rounded-md">
<span className="inline-flex items-center rounded-l-md border border-r-0 border-neutral-300 bg-neutral-50 px-3 text-neutral-500 sm:text-sm">
- instagram.com
+ tiktok.com
+ </span>
+ <span className="absolute inset-y-0 left-[5.7rem] flex items-center pl-3 text-sm text-neutral-400">
+ @
</span>
<input
type="text"
disabled={disabled}
className={cn(
- "block w-full rounded-none rounded-r-md focus:outline-none sm:text-sm",
+ "block w-full rounded-none rounded-r-md pl-7 focus:outline-none sm:text-sm",
disabled &&
"cursor-not-allowed bg-neutral-50 text-neutral-400",
- errors.instagram
+ errors.tiktok
? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"
: "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",
)}
placeholder="handle"
- onPaste={(e) => onPasteSocial(e, "instagram")}
- {...register("instagram")}
+ onPaste={(e) => onPasteSocial(e, "tiktok")}
+ {...register("tiktok")}
/>
</div>
}
@@ -473,17 +476,18 @@ export const OnlinePresenceForm = forwardRef<
/>
<FormRow
- label="TikTok"
- property="tiktok"
- prefix="@"
- icon={TikTok}
+ label="LinkedIn"
+ property="linkedin"
+ prefix="in/"
+ icon={LinkedIn}
disabled={disabled}
+ verifyDisabledTooltip="LinkedIn verification is coming soon."
onVerifyClick={async () => {
- const handle = getValues("tiktok");
+ const handle = getValues("linkedin");
if (handle) {
await startSocialVerification({
- platform: "tiktok",
+ platform: "linkedin",
handle,
source: variant,
});
@@ -494,25 +498,22 @@ export const OnlinePresenceForm = forwardRef<
input={
<div className="flex rounded-md">
<span className="inline-flex items-center rounded-l-md border border-r-0 border-neutral-300 bg-neutral-50 px-3 text-neutral-500 sm:text-sm">
- tiktok.com
- </span>
- <span className="absolute inset-y-0 left-[5.7rem] flex items-center pl-3 text-sm text-neutral-400">
- @
+ linkedin.com/in
</span>
<input
type="text"
disabled={disabled}
className={cn(
- "block w-full rounded-none rounded-r-md pl-7 focus:outline-none sm:text-sm",
+ "block w-full rounded-none rounded-r-md focus:outline-none sm:text-sm",
disabled &&
"cursor-not-allowed bg-neutral-50 text-neutral-400",
- errors.tiktok
+ errors.linkedin
? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"
: "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",
)}
placeholder="handle"
- onPaste={(e) => onPasteSocial(e, "tiktok")}
- {...register("tiktok")}
+ onPaste={(e) => onPasteSocial(e, "linkedin")}
+ {...register("linkedin")}
/>
</div>
}
@@ -539,11 +540,11 @@ export const OnlinePresenceForm = forwardRef<
function useVerifiedState({
property,
}: {
- property: keyof OnlinePresenceFormData;
+ property: keyof PartnerPlatformsFormData;
}) {
const { partner: partnerProfile } = usePartnerProfile();
- const { watch, getFieldState } = useFormContext<OnlinePresenceFormData>();
+ const { watch, getFieldState } = useFormContext<PartnerPlatformsFormData>();
const value = watch(property);
const isValid = !!value && !getFieldState(property).invalid;
@@ -551,7 +552,7 @@ function useVerifiedState({
const loading = !partnerProfile && isValid;
// Map form property to PlatformType enum
- const platformMap: Record<keyof OnlinePresenceFormData, PlatformType> = {
+ const platformMap: Record<keyof PartnerPlatformsFormData, PlatformType> = {
website: "website",
youtube: "youtube",
twitter: "twitter",
@@ -584,13 +585,13 @@ function VerifyButton({
disabledTooltip,
disabled: formDisabled = false,
}: {
- property: keyof OnlinePresenceFormData;
+ property: keyof PartnerPlatformsFormData;
icon: Icon;
onClick: () => Promise<boolean>;
disabledTooltip?: string;
disabled?: boolean;
}) {
- const { control, getFieldState } = useFormContext<OnlinePresenceFormData>();
+ const { control, getFieldState } = useFormContext<PartnerPlatformsFormData>();
const value = useWatch({ control, name: property });
const { isVerified, loading } = useVerifiedState({
@@ -646,7 +647,7 @@ function FormRow({
label: string;
input: ReactNode;
- property: keyof OnlinePresenceFormData;
+ property: keyof PartnerPlatformsFormData;
prefix?: string;
icon: Icon;
onVerifyClick: () => Promise<boolean>;
@@ -655,7 +656,7 @@ function FormRow({
disabled?: boolean;
}) {
const { partner } = usePartnerProfile();
- const { control, setValue } = useFormContext<OnlinePresenceFormData>();
+ const { control, setValue } = useFormContext<PartnerPlatformsFormData>();
const value = useWatch({ control, name: property });
const { isVerified } = useVerifiedState({ property });
@@ -752,7 +753,7 @@ function FormRow({
>
{label}
</span>
- <OnlinePresenceCard
+ <PartnerPlatformCard
icon={Icon}
prefix={prefix}
value={value ?? ""}
diff --git a/apps/web/ui/partners/program-card.tsx b/apps/web/ui/partners/program-card.tsx
index 0c310462e1..c47ef6496f 100644
--- a/apps/web/ui/partners/program-card.tsx
+++ b/apps/web/ui/partners/program-card.tsx
@@ -91,19 +91,40 @@ function ProgramCardEarnings({
programEnrollment: ProgramEnrollmentProps;
}) {
const { program, totalCommissions } = programEnrollment;
+
const { data: timeseries } = usePartnerEarningsTimeseries({
programId: program.id,
interval: "1y",
- });
+ enabled: totalCommissions > 0,
+ } as Parameters<typeof usePartnerEarningsTimeseries>[0]);
+
+ const chartData = useMemo(() => {
+ if (totalCommissions === 0) {
+ // Generate dummy data (straight line at 0) for the past year
+ const now = new Date();
+ const oneYearAgo = new Date(now);
+ oneYearAgo.setFullYear(now.getFullYear() - 1);
- const chartData = useMemo(
- () =>
+ // Generate 12 data points (monthly)
+ const dummyData: { date: Date; value: number }[] = [];
+ for (let i = 0; i < 12; i++) {
+ const date = new Date(oneYearAgo);
+ date.setMonth(oneYearAgo.getMonth() + i);
+ dummyData.push({
+ date,
+ value: 0,
+ });
+ }
+ return dummyData;
+ }
+
+ return (
timeseries?.map((d) => ({
date: new Date(d.start),
value: d.earnings,
- })),
- [timeseries],
- );
+ })) ?? []
+ );
+ }, [timeseries, totalCommissions]);
return (
<div className="mt-4 grid grid-cols-[min-content,minmax(0,1fr)] gap-4 rounded-md border border-neutral-200 bg-neutral-50">
diff --git a/packages/email/src/templates/dub-wrapped.tsx b/packages/email/src/templates/broadcasts/dub-wrapped.tsx
similarity index 99%
rename from packages/email/src/templates/dub-wrapped.tsx
rename to packages/email/src/templates/broadcasts/dub-wrapped.tsx
index fdda43dac0..f45cd74a6b 100644
--- a/packages/email/src/templates/dub-wrapped.tsx
+++ b/packages/email/src/templates/broadcasts/dub-wrapped.tsx
@@ -16,7 +16,7 @@ import {
Tailwind,
Text,
} from "@react-email/components";
-import { Footer } from "../components/footer";
+import { Footer } from "../../components/footer";
export default function DubWrapped({
email = "[email protected]",
diff --git a/packages/email/src/templates/program-marketplace-announcement.tsx b/packages/email/src/templates/broadcasts/program-marketplace-announcement.tsx
similarity index 99%
rename from packages/email/src/templates/program-marketplace-announcement.tsx
rename to packages/email/src/templates/broadcasts/program-marketplace-announcement.tsx
index f8803a3470..47be361b61 100644
--- a/packages/email/src/templates/program-marketplace-announcement.tsx
+++ b/packages/email/src/templates/broadcasts/program-marketplace-announcement.tsx
@@ -13,7 +13,7 @@ import {
Tailwind,
Text,
} from "@react-email/components";
-import { Footer } from "../components/footer";
+import { Footer } from "../../components/footer";
export default function ProgramMarketplaceAnnouncement({
email = "[email protected]",
diff --git a/packages/prisma/schema/partner.prisma b/packages/prisma/schema/partner.prisma
index 0d43ad86c2..6471ef04a0 100644
--- a/packages/prisma/schema/partner.prisma
+++ b/packages/prisma/schema/partner.prisma
@@ -39,25 +39,6 @@ model Partner {
discoverableAt DateTime?
trustedAt DateTime?
- // online presence fields
- website String?
- websiteTxtRecord String?
- websiteVerifiedAt DateTime?
- youtube String?
- youtubeChannelId String?
- youtubeVerifiedAt DateTime?
- youtubeSubscriberCount Int @default(0)
- youtubeVideoCount Int @default(0)
- youtubeViewCount Int @default(0)
- twitter String?
- twitterVerifiedAt DateTime?
- linkedin String?
- linkedinVerifiedAt DateTime?
- instagram String?
- instagramVerifiedAt DateTime?
- tiktok String?
- tiktokVerifiedAt DateTime?
-
// miscellaneous fields
invoiceSettings Json?
changeHistoryLog Json?