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.

Discoverability toggling

Tim Wilson306c697e2265
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/auth.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/auth.tsx
index 1de2a4ce38..a9e1642787 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/auth.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/auth.tsx
@@ -20,7 +20,7 @@ const ERROR_CODES = {
export function PartnerProfileAuth({ children }: { children: ReactNode }) {
const searchParams = useSearchParams();
const { loading: sessionLoading } = useRefreshSession("defaultPartnerId");
- const { loading: partnerLoading, error } = usePartnerProfile();
+ const { partner, error } = usePartnerProfile();
useEffect(() => {
const error = searchParams?.get("error");
@@ -30,7 +30,7 @@ export function PartnerProfileAuth({ children }: { children: ReactNode }) {
}
}, [searchParams]);
- const loading = sessionLoading || partnerLoading;
+ const loading = sessionLoading || (!partner && !error);
if (loading) {
return <LayoutLoader />;
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/about-you-form.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/about-you-form.tsx
index bc1dcb231f..2fa57e9a8d 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/about-you-form.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/about-you-form.tsx
@@ -3,6 +3,7 @@ import {
industryInterests,
monthlyTrafficAmounts,
} from "@/lib/partners/partner-profile";
+import { mutatePrefix } from "@/lib/swr/mutate";
import { PartnerProps } from "@/lib/types";
import { MAX_PARTNER_DESCRIPTION_LENGTH } from "@/lib/zod/schemas/partners";
import { MaxCharactersCounter } from "@/ui/shared/max-characters-counter";
@@ -51,6 +52,7 @@ export function AboutYouForm({ partner }: { partner?: PartnerProps }) {
const { executeAsync } = useAction(updatePartnerProfileAction, {
onSuccess: () => {
toast.success("Your profile has been updated.");
+ mutatePrefix("/api/partner-profile");
},
onError({ error }) {
setError("root.serverError", {
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/how-you-work-form.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/how-you-work-form.tsx
index 59cf4174e1..9ff5dbb49b 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/how-you-work-form.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/how-you-work-form.tsx
@@ -11,6 +11,7 @@ import {
preferredEarningStructures,
salesChannels,
} from "@/lib/partners/partner-profile";
+import { mutatePrefix } from "@/lib/swr/mutate";
import { PreferredEarningStructure, SalesChannel } from "@dub/prisma/client";
import { cn } from "@dub/utils";
@@ -43,6 +44,7 @@ export function HowYouWorkForm({ partner }: { partner?: PartnerProps }) {
const { executeAsync } = useAction(updatePartnerProfileAction, {
onSuccess: () => {
toast.success("Your profile has been updated.");
+ mutatePrefix("/api/partner-profile");
},
onError({ error }) {
setError("root.serverError", {
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx
index d9114fa8f4..af7bde0167 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/page-client.tsx
@@ -1,19 +1,31 @@
"use client";
+import { updatePartnerProfileAction } from "@/lib/actions/partners/update-partner-profile";
import usePartnerProfile from "@/lib/swr/use-partner-profile";
-import useProgramEnrollments from "@/lib/swr/use-program-enrollments";
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
import { useMergePartnerAccountsModal } from "@/ui/partners/merge-accounts/merge-partner-accounts-modal";
-import { Button } from "@dub/ui";
+import { ThreeDots } from "@/ui/shared/icons";
+import { Button, Popover, Switch, Tooltip, Users2, UserSearch } from "@dub/ui";
+import { cn } from "@dub/utils/src";
+import { useAction } from "next-safe-action/hooks";
+import { useMemo, useState } from "react";
+import { toast } from "sonner";
import { AboutYouForm } from "./about-you-form";
import { HowYouWorkForm } from "./how-you-work-form";
import { ProfileDetailsForm } from "./profile-details-form";
import { ProfileDiscoveryGuide } from "./profile-discovery-guide";
+import { usePartnerDiscoveryRequirements } from "./use-partner-discovery-requirements";
export function ProfileSettingsPageClient() {
const { partner } = usePartnerProfile();
- const { programEnrollments } = useProgramEnrollments();
+
+ const tasks = usePartnerDiscoveryRequirements();
+
+ const allTasksCompleted = useMemo(
+ () => tasks?.every(({ completed }) => completed) ?? false,
+ [tasks],
+ );
return (
<PageContent
@@ -23,14 +35,17 @@ export function ProfileSettingsPageClient() {
"Build a stronger partner profile and increase trust by adding and verifying your website and social accounts.",
href: "https://dub.co/help/article/partner-profile",
}}
- controls={<Controls />}
+ controls={
+ <Controls
+ showDiscoverableToggle={Boolean(
+ allTasksCompleted || partner?.discoverableAt,
+ )}
+ />
+ }
>
<PageWidthWrapper className="mb-20 flex flex-col gap-6">
- {partner && programEnrollments && (
- <ProfileDiscoveryGuide
- partner={partner}
- programEnrollments={programEnrollments}
- />
+ {partner && !allTasksCompleted && (
+ <ProfileDiscoveryGuide partner={partner} />
)}
<ProfileDetailsForm partner={partner} />
<AboutYouForm partner={partner} />
@@ -40,19 +55,107 @@ export function ProfileSettingsPageClient() {
);
}
-function Controls() {
+function Controls({
+ showDiscoverableToggle,
+}: {
+ showDiscoverableToggle: boolean;
+}) {
+ const { partner, mutate } = usePartnerProfile();
+
+ const [isOpen, setIsOpen] = useState(false);
+
const { MergePartnerAccountsModal, setShowMergePartnerAccountsModal } =
useMergePartnerAccountsModal();
+ const { executeAsync } = useAction(updatePartnerProfileAction, {
+ onError({ error }) {
+ toast.error(error.serverError);
+ },
+ });
+
return (
<>
+ {showDiscoverableToggle && partner && (
+ <Tooltip
+ content={
+ <p className="text-content-default max-w-xs p-3 text-xs">
+ <strong className="font-semibold">
+ Discoverable is {partner.discoverableAt ? "on" : "off"}
+ </strong>{" "}
+ - Programs {partner.discoverableAt ? "will" : "won't"} be able to
+ discover your profile and send invites.
+ </p>
+ }
+ >
+ <label
+ className={cn(
+ "bg-bg-subtle text-content-default border-border-subtle flex h-9 cursor-pointer items-center gap-2 rounded-lg border px-3",
+ "transition-colors duration-100 ease-out",
+ !!partner.discoverableAt &&
+ "bg-bg-inverted text-content-inverted border-bg-inverted",
+ )}
+ >
+ <UserSearch className="size-4 shrink-0" />
+ <span className="text-sm font-medium">Discoverable</span>
+ <Switch
+ checked={!!partner.discoverableAt}
+ fn={(checked) =>
+ mutate(
+ async () => {
+ const result = await executeAsync({
+ discoverable: checked,
+ });
+
+ if (result?.serverError || result?.validationErrors)
+ throw new Error("Failed to update profile");
+
+ return {
+ ...partner,
+ discoverableAt: checked ? new Date() : null,
+ };
+ },
+ {
+ optimisticData: () => ({
+ ...partner,
+ discoverableAt: checked ? new Date() : null,
+ }),
+ },
+ )
+ }
+ trackDimensions="radix-state-checked:bg-neutral-600 focus-visible:ring-black/20"
+ />
+ </label>
+ </Tooltip>
+ )}
<MergePartnerAccountsModal />
- <Button
- text="Merge accounts"
- variant="secondary"
- className="h-8 w-fit px-2.5"
- onClick={() => setShowMergePartnerAccountsModal(true)}
- />
+ <Popover
+ openPopover={isOpen}
+ setOpenPopover={setIsOpen}
+ content={
+ <div className="w-full p-2 md:w-56">
+ <button
+ onClick={() => {
+ setShowMergePartnerAccountsModal(true);
+ setIsOpen(false);
+ }}
+ className="w-full rounded-md p-2 hover:bg-neutral-100 active:bg-neutral-200"
+ >
+ <div className="flex items-center gap-2 text-left">
+ <Users2 className="size-4 shrink-0" />
+ <span className="text-sm font-medium">Merge accounts</span>
+ </div>
+ </button>
+ </div>
+ }
+ align="end"
+ >
+ <Button
+ type="button"
+ className="h-9 whitespace-nowrap px-2"
+ variant="secondary"
+ icon={<ThreeDots className="size-4 shrink-0" />}
+ />
+ </Popover>
</>
);
}
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 1befde3571..d30c1aa3f8 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
@@ -1,4 +1,5 @@
import { updatePartnerProfileAction } from "@/lib/actions/partners/update-partner-profile";
+import { mutatePrefix } from "@/lib/swr/mutate";
import usePartnerPayoutsCount from "@/lib/swr/use-partner-payouts-count";
import { PartnerProps, PayoutsCount } from "@/lib/types";
import { useConfirmModal } from "@/ui/modals/confirm-modal";
@@ -175,6 +176,7 @@ function BasicInfoForm({
} else {
toast.success("Your profile has been updated.");
}
+ mutatePrefix("/api/partner-profile");
},
onError({ error }) {
setError("root.serverError", {
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-discovery-guide.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-discovery-guide.tsx
index a08f7e21b5..24fa170ea6 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-discovery-guide.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-discovery-guide.tsx
@@ -1,5 +1,5 @@
+import { PARTNER_DISCOVERY_MIN_COMMISSIONS } from "@/lib/partners/discoverability";
import { ONLINE_PRESENCE_FIELDS } from "@/lib/partners/online-presence";
-import { PARTNER_DISCOVERY_MIN_COMMISSIONS } from "@/lib/partners/partner-profile";
import { PartnerProps, ProgramEnrollmentProps } from "@/lib/types";
import {
Button,
@@ -12,59 +12,17 @@ import {
import { cn, isClickOnInteractiveChild } from "@dub/utils";
import { motion } from "motion/react";
import Link from "next/link";
-import { HTMLProps, useMemo, useState } from "react";
+import { HTMLProps, useState } from "react";
+import { usePartnerDiscoveryRequirements } from "./use-partner-discovery-requirements";
-export function ProfileDiscoveryGuide({
- partner,
- programEnrollments,
-}: {
- partner: PartnerProps;
- programEnrollments: ProgramEnrollmentProps[];
-}) {
+export function ProfileDiscoveryGuide({ partner }: { partner: PartnerProps }) {
if (partner.discoverableAt) return null;
const [isExpanded, setIsExpanded] = useState(false);
- const tasks = useMemo(
- () => [
- {
- label: "Add basic profile info",
- completed: true,
- },
- {
- label: "Verify your website or social account",
- href: "#sites",
- completed: ONLINE_PRESENCE_FIELDS.some(
- (field) => field.data(partner).verified,
- ),
- },
- {
- label: "Write your bio",
- href: "#about",
- completed: !!partner.description,
- },
- {
- label: "Select your industry interests",
- href: "#interests",
- completed: Boolean(partner.industryInterests?.length),
- },
- {
- label: "Choose your sales channels",
- href: "#channels",
- completed: Boolean(partner.salesChannels?.length),
- },
- {
- label: "Earn $100 in commissions",
- completed:
- programEnrollments.reduce(
- (acc, programEnrollment) =>
- acc + programEnrollment.totalCommissions,
- 0,
- ) >= PARTNER_DISCOVERY_MIN_COMMISSIONS,
- },
- ],
- [partner, programEnrollments],
- );
+ const tasks = usePartnerDiscoveryRequirements();
+
+ if (!tasks) return null;
const completedTasks = tasks.filter(({ completed }) => completed);
@@ -177,3 +135,48 @@ function ConditionalLink({
<div className={className}>{children}</div>
);
}
+
+export function getDiscoveryGuideTasks({
+ partner,
+ programEnrollments,
+}: {
+ partner: PartnerProps;
+ programEnrollments: ProgramEnrollmentProps[];
+}) {
+ return [
+ {
+ label: "Add basic profile info",
+ completed: true,
+ },
+ {
+ label: "Verify your website or social account",
+ href: "#sites",
+ completed: ONLINE_PRESENCE_FIELDS.some(
+ (field) => field.data(partner).verified,
+ ),
+ },
+ {
+ label: "Write your bio",
+ href: "#about",
+ completed: !!partner.description,
+ },
+ {
+ label: "Select your industry interests",
+ href: "#interests",
+ completed: Boolean(partner.industryInterests?.length),
+ },
+ {
+ label: "Choose your sales channels",
+ href: "#channels",
+ completed: Boolean(partner.salesChannels?.length),
+ },
+ {
+ label: "Earn $100 in commissions",
+ completed:
+ programEnrollments.reduce(
+ (acc, programEnrollment) => acc + programEnrollment.totalCommissions,
+ 0,
+ ) >= PARTNER_DISCOVERY_MIN_COMMISSIONS,
+ },
+ ];
+}
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/use-partner-discovery-requirements.ts b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/use-partner-discovery-requirements.ts
new file mode 100644
index 0000000000..acb5ada731
--- /dev/null
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/use-partner-discovery-requirements.ts
@@ -0,0 +1,27 @@
+import { getPartnerDiscoveryRequirements } from "@/lib/partners/discoverability";
+import usePartnerProfile from "@/lib/swr/use-partner-profile";
+import useProgramEnrollments from "@/lib/swr/use-program-enrollments";
+import { ACME_PROGRAM_ID } from "@dub/utils";
+import { useMemo } from "react";
+
+export function usePartnerDiscoveryRequirements() {
+ const { partner } = usePartnerProfile();
+ const { programEnrollments } = useProgramEnrollments();
+
+ return useMemo(
+ () =>
+ partner && programEnrollments
+ ? getPartnerDiscoveryRequirements({
+ partner,
+ totalCommissions: programEnrollments
+ .filter((pe) => pe.programId !== ACME_PROGRAM_ID)
+ .reduce(
+ (acc, programEnrollment) =>
+ acc + programEnrollment.totalCommissions,
+ 0,
+ ),
+ })
+ : undefined,
+ [partner, programEnrollments],
+ );
+}
diff --git a/apps/web/lib/actions/partners/update-partner-profile.ts b/apps/web/lib/actions/partners/update-partner-profile.ts
index 3849a04334..d83f6edd5c 100644
--- a/apps/web/lib/actions/partners/update-partner-profile.ts
+++ b/apps/web/lib/actions/partners/update-partner-profile.ts
@@ -2,6 +2,7 @@
import { confirmEmailChange } from "@/lib/auth/confirm-email-change";
import { qstash } from "@/lib/cron";
+import { getPartnerDiscoveryRequirements } from "@/lib/partners/discoverability";
import { storage } from "@/lib/storage";
import {
MAX_PARTNER_DESCRIPTION_LENGTH,
@@ -9,6 +10,7 @@ import {
} from "@/lib/zod/schemas/partners";
import { prisma } from "@dub/prisma";
import {
+ ACME_PROGRAM_ID,
APP_DOMAIN_WITH_NGROK,
COUNTRIES,
deepEqual,
@@ -31,6 +33,7 @@ const updatePartnerProfileSchema = z
country: z.enum(Object.keys(COUNTRIES) as [string, ...string[]]).nullish(),
profileType: z.nativeEnum(PartnerProfileType).optional(),
companyName: z.string().nullish(),
+ discoverable: z.boolean().optional(),
})
.merge(PartnerProfileSchema.partial())
.transform((data) => ({
@@ -55,6 +58,7 @@ export const updatePartnerProfileAction = authPartnerActionClient
industryInterests,
preferredEarningStructures,
salesChannels,
+ discoverable,
} = parsedInput;
if (
@@ -73,6 +77,10 @@ export const updatePartnerProfileAction = authPartnerActionClient
let needsEmailVerification = false;
const emailChanged = newEmail !== undefined && partner.email !== newEmail;
+ const discoverableChanged =
+ discoverable !== undefined &&
+ discoverable !== Boolean(partner.discoverableAt);
+
// Upload the new image
if (image) {
const path = `partners/${partner.id}/image_${nanoid(7)}`;
@@ -81,7 +89,7 @@ export const updatePartnerProfileAction = authPartnerActionClient
}
try {
- const updatedPartner = await prisma.partner.update({
+ let updatedPartner = await prisma.partner.update({
where: {
id: partner.id,
},
@@ -123,6 +131,26 @@ export const updatePartnerProfileAction = authPartnerActionClient
},
});
+ // Update `discoverable` separately so we can check eligibility post-update
+ if (discoverableChanged) {
+ if (
+ discoverable &&
+ !(await isPartnerProfileEligibleForDiscovery({
+ partnerId: partner.id,
+ }))
+ )
+ throw new Error("Profile is not eligible for discovery");
+
+ updatedPartner = await prisma.partner.update({
+ where: {
+ id: partner.id,
+ },
+ data: {
+ discoverableAt: discoverable ? new Date() : null,
+ },
+ });
+ }
+
// If the email is being changed, we need to verify the new email address
if (emailChanged) {
const partnerWithEmail = await prisma.partner.findUnique({
@@ -149,29 +177,51 @@ export const updatePartnerProfileAction = authPartnerActionClient
}
waitUntil(
- (async () => {
- const shouldExpireCache = !deepEqual(
- {
- name: partner.name,
- image: partner.image,
- },
- {
- name: updatedPartner.name,
- image: updatedPartner.image,
- },
- );
+ Promise.allSettled([
+ (async () => {
+ const shouldExpireCache = !deepEqual(
+ {
+ name: partner.name,
+ image: partner.image,
+ },
+ {
+ name: updatedPartner.name,
+ image: updatedPartner.image,
+ },
+ );
- if (!shouldExpireCache) {
- return;
- }
+ if (!shouldExpireCache) {
+ return;
+ }
- qstash.publishJSON({
- url: `${APP_DOMAIN_WITH_NGROK}/api/cron/links/invalidate-for-partners`,
- body: {
- partnerId: partner.id,
- },
- });
- })(),
+ qstash.publishJSON({
+ url: `${APP_DOMAIN_WITH_NGROK}/api/cron/links/invalidate-for-partners`,
+ body: {
+ partnerId: partner.id,
+ },
+ });
+ })(),
+
+ // Reset discoverable status if no longer eligible
+ (async () => {
+ if (
+ !discoverableChanged &&
+ updatedPartner.discoverableAt &&
+ !(await isPartnerProfileEligibleForDiscovery({
+ partnerId: partner.id,
+ }))
+ ) {
+ await prisma.partner.update({
+ where: {
+ id: partner.id,
+ },
+ data: {
+ discoverableAt: null,
+ },
+ });
+ }
+ })(),
+ ]),
);
return {
@@ -244,3 +294,37 @@ const deleteStripeAccountIfRequired = async ({
}
}
};
+
+async function isPartnerProfileEligibleForDiscovery({
+ partnerId,
+}: {
+ partnerId: string;
+}) {
+ const partner = await prisma.partner.findUniqueOrThrow({
+ where: {
+ id: partnerId,
+ },
+ include: {
+ industryInterests: true,
+ salesChannels: true,
+ programs: true,
+ },
+ });
+
+ const requirements = getPartnerDiscoveryRequirements({
+ partner: {
+ ...partner,
+ industryInterests: partner.industryInterests?.map(
+ ({ industryInterest }) => industryInterest,
+ ),
+ salesChannels: partner.salesChannels?.map(
+ ({ salesChannel }) => salesChannel,
+ ),
+ },
+ totalCommissions: partner.programs
+ .filter((program) => program.programId !== ACME_PROGRAM_ID)
+ .reduce((acc, program) => acc + program.totalCommissions, 0),
+ });
+
+ return requirements.every(({ completed }) => completed);
+}
diff --git a/apps/web/lib/partners/discoverability.ts b/apps/web/lib/partners/discoverability.ts
new file mode 100644
index 0000000000..45bfcbc02a
--- /dev/null
+++ b/apps/web/lib/partners/discoverability.ts
@@ -0,0 +1,54 @@
+import { PartnerProps } from "../types";
+import {
+ ONLINE_PRESENCE_FIELDS,
+ PartnerOnlinePresenceFields,
+} from "./online-presence";
+
+export const PARTNER_DISCOVERY_MIN_COMMISSIONS = 100_00;
+
+export function getPartnerDiscoveryRequirements({
+ partner,
+ totalCommissions,
+}: {
+ partner: Pick<
+ PartnerProps,
+ | PartnerOnlinePresenceFields
+ | "description"
+ | "industryInterests"
+ | "salesChannels"
+ >;
+ totalCommissions: number;
+}) {
+ return [
+ {
+ label: "Add basic profile info",
+ completed: true,
+ },
+ {
+ label: "Verify your website or social account",
+ href: "#sites",
+ completed: ONLINE_PRESENCE_FIELDS.some(
+ (field) => field.data(partner).verified,
+ ),
+ },
+ {
+ label: "Write your bio",
+ href: "#about",
+ completed: !!partner.description,
+ },
+ {
+ label: "Select your industry interests",
+ href: "#interests",
+ completed: Boolean(partner.industryInterests?.length),
+ },
+ {
+ label: "Choose your sales channels",
+ href: "#channels",
+ completed: Boolean(partner.salesChannels?.length),
+ },
+ {
+ label: "Earn $100 in commissions",
+ completed: totalCommissions >= PARTNER_DISCOVERY_MIN_COMMISSIONS,
+ },
+ ];
+}
diff --git a/apps/web/lib/partners/online-presence.ts b/apps/web/lib/partners/online-presence.ts
index 1ddfa46bde..fb979aecc1 100644
--- a/apps/web/lib/partners/online-presence.ts
+++ b/apps/web/lib/partners/online-presence.ts
@@ -10,27 +10,27 @@ import {
import { getPrettyUrl, nFormatter } from "@dub/utils";
import { EnrolledPartnerExtendedProps } from "../types";
+export type PartnerOnlinePresenceFields =
+ | "website"
+ | "websiteVerifiedAt"
+ | "youtube"
+ | "youtubeSubscriberCount"
+ | "youtubeVerifiedAt"
+ | "youtubeViewCount"
+ | "twitter"
+ | "twitterVerifiedAt"
+ | "linkedin"
+ | "linkedinVerifiedAt"
+ | "instagram"
+ | "instagramVerifiedAt"
+ | "tiktok"
+ | "tiktokVerifiedAt";
+
export const ONLINE_PRESENCE_FIELDS: {
label: string;
icon: Icon;
data: (
- partner: Pick<
- EnrolledPartnerExtendedProps,
- | "website"
- | "websiteVerifiedAt"
- | "youtube"
- | "youtubeSubscriberCount"
- | "youtubeVerifiedAt"
- | "youtubeViewCount"
- | "twitter"
- | "twitterVerifiedAt"
- | "linkedin"
- | "linkedinVerifiedAt"
- | "instagram"
- | "instagramVerifiedAt"
- | "tiktok"
- | "tiktokVerifiedAt"
- >,
+ partner: Pick<EnrolledPartnerExtendedProps, PartnerOnlinePresenceFields>,
) => {
value?: string | null;
verified: boolean;
diff --git a/apps/web/lib/partners/partner-profile.ts b/apps/web/lib/partners/partner-profile.ts
index f8e533ee44..68b3f9682f 100644
--- a/apps/web/lib/partners/partner-profile.ts
+++ b/apps/web/lib/partners/partner-profile.ts
@@ -32,8 +32,6 @@ import {
UsersSettings,
} from "@dub/ui/icons";
-export const PARTNER_DISCOVERY_MIN_COMMISSIONS = 100_00;
-
export const industryInterests: {
id: IndustryInterest;
icon: Icon;
diff --git a/apps/web/lib/swr/use-partner-profile.ts b/apps/web/lib/swr/use-partner-profile.ts
index bd06fd223b..87f848e94f 100644
--- a/apps/web/lib/swr/use-partner-profile.ts
+++ b/apps/web/lib/swr/use-partner-profile.ts
@@ -17,6 +17,7 @@ export default function usePartnerProfile() {
fetcher,
{
dedupingInterval: 60000,
+ keepPreviousData: true,
},
);
diff --git a/apps/web/ui/partners/online-presence-summary.tsx b/apps/web/ui/partners/online-presence-summary.tsx
index f205fd244d..51e9b08f25 100644
--- a/apps/web/ui/partners/online-presence-summary.tsx
+++ b/apps/web/ui/partners/online-presence-summary.tsx
@@ -1,4 +1,7 @@
-import { ONLINE_PRESENCE_FIELDS } from "@/lib/partners/online-presence";
+import {
+ ONLINE_PRESENCE_FIELDS,
+ PartnerOnlinePresenceFields,
+} from "@/lib/partners/online-presence";
import { EnrolledPartnerExtendedProps } from "@/lib/types";
import { cn } from "@dub/utils";
import { Fragment } from "react";
@@ -10,23 +13,7 @@ export function OnlinePresenceSummary({
className,
emptyClassName,
}: {
- partner: Pick<
- EnrolledPartnerExtendedProps,
- | "website"
- | "websiteVerifiedAt"
- | "youtube"
- | "youtubeSubscriberCount"
- | "youtubeVerifiedAt"
- | "youtubeViewCount"
- | "twitter"
- | "twitterVerifiedAt"
- | "linkedin"
- | "linkedinVerifiedAt"
- | "instagram"
- | "instagramVerifiedAt"
- | "tiktok"
- | "tiktokVerifiedAt"
- >;
+ partner: Pick<EnrolledPartnerExtendedProps, PartnerOnlinePresenceFields>;
showLabels?: boolean;
className?: string;
emptyClassName?: string;
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 1b9eb054f1..de59db3a00 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -224,6 +224,7 @@ export * from "./user-delete";
export * from "./user-focus";
export * from "./user-minus";
export * from "./user-plus";
+export * from "./user-search";
export * from "./user-xmark";
export * from "./users";
export * from "./users-fill";
diff --git a/packages/ui/src/icons/nucleo/user-search.tsx b/packages/ui/src/icons/nucleo/user-search.tsx
new file mode 100644
index 0000000000..77007eb71e
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/user-search.tsx
@@ -0,0 +1,55 @@
+import { SVGProps } from "react";
+
+export function UserSearch(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <circle
+ cx="9"
+ cy="4.5"
+ fill="none"
+ r="2.75"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <circle
+ cx="13"
+ cy="13"
+ fill="none"
+ r="2.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M9.522,9.789c-.174-.015-.345-.039-.522-.039-2.551,0-4.739,1.53-5.709,3.72-.365,.825,.087,1.774,.947,2.045,1.225,.386,2.846,.734,4.762,.734,.186,0,.355-.017,.535-.023"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="14.59"
+ x2="16.25"
+ y1="14.59"
+ y2="16.25"
+ />
+ </g>
+ </svg>
+ );
+}