File tree Expand file tree Collapse file tree 7 files changed +46
-139
lines changed
app/(ee)/partners.dub.co/(dashboard)
programs/marketplace/[programSlug] Expand file tree Collapse file tree 7 files changed +46
-139
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ export function ProfileDetailsForm({ partner }: { partner?: PartnerProps }) {
101101 </ SettingsRow >
102102
103103 < SettingsRow
104- id = "sites "
104+ id = "platforms "
105105 heading = "Website and socials"
106106 description = "Add your website and social accounts you use to share links. Verifying as many platforms as possible helps build trust with programs."
107107 >
Original file line number Diff line number Diff line change 1- import { getPartnerProfileChecklistProgress } from "@/lib/network/get-discoverability-requirements " ;
1+ import { getPartnerProfileChecklistProgress } from "@/lib/network/get-partner-profile-checklist-progress " ;
22import usePartnerProfile from "@/lib/swr/use-partner-profile" ;
33import useProgramEnrollments from "@/lib/swr/use-program-enrollments" ;
44import { useMemo } from "react" ;
Original file line number Diff line number Diff line change 11"use client" ;
22
33import { acceptProgramInviteAction } from "@/lib/actions/partners/accept-program-invite" ;
4- import { getPartnerProfileChecklistProgress } from "@/lib/network/get-discoverability-requirements " ;
4+ import { getPartnerProfileChecklistProgress } from "@/lib/network/get-partner-profile-checklist-progress " ;
55import { mutatePrefix } from "@/lib/swr/mutate" ;
66import usePartnerProfile from "@/lib/swr/use-partner-profile" ;
77import useProgramEnrollments from "@/lib/swr/use-program-enrollments" ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { notifyPartnerApplication } from "@/lib/api/partners/notify-partner-appl
66import { getIP } from "@/lib/api/utils/get-ip" ;
77import { getSession } from "@/lib/auth" ;
88import { qstash } from "@/lib/cron" ;
9- import { getPartnerProfileChecklistProgress } from "@/lib/network/get-discoverability-requirements " ;
9+ import { getPartnerProfileChecklistProgress } from "@/lib/network/get-partner-profile-checklist-progress " ;
1010import {
1111 formatApplicationFormData ,
1212 formatWebsiteAndSocialsFields ,
Original file line number Diff line number Diff line change @@ -28,46 +28,6 @@ export const partnerIsNotBanned = (
2828 return programEnrollments . every ( ( pe ) => pe . status !== "banned" ) ;
2929} ;
3030
31- export type DiscoverabilityRequirement = {
32- label : string ;
33- href ?: string ;
34- completed : boolean ;
35- } ;
36-
37- export function getPartnerProfileChecklistProgress ( {
38- partner,
39- programEnrollments,
40- } : {
41- partner : Pick <
42- PartnerProps ,
43- | "image"
44- | "description"
45- | "monthlyTraffic"
46- | "preferredEarningStructures"
47- | "salesChannels"
48- | "platforms"
49- > ;
50- programEnrollments : Pick <
51- EnrolledPartnerProps ,
52- "programId" | "status" | "totalCommissions"
53- > [ ] ;
54- } ) {
55- const tasks = getDiscoverabilityRequirements ( {
56- partner,
57- programEnrollments,
58- } ) ;
59-
60- const completedCount = tasks . filter ( ( { completed } ) => completed ) . length ;
61- const totalCount = tasks . length ;
62-
63- return {
64- tasks,
65- completedCount,
66- totalCount,
67- isComplete : completedCount === totalCount ,
68- } ;
69- }
70-
7131export function getDiscoverabilityRequirements ( {
7232 partner,
7333 programEnrollments,
@@ -85,7 +45,11 @@ export function getDiscoverabilityRequirements({
8545 EnrolledPartnerProps ,
8646 "programId" | "status" | "totalCommissions"
8747 > [ ] ;
88- } ) : DiscoverabilityRequirement [ ] {
48+ } ) : {
49+ label : string ;
50+ href ?: string ;
51+ completed : boolean ;
52+ } [ ] {
8953 return [
9054 {
9155 label : "Upload your logo" ,
@@ -94,7 +58,7 @@ export function getDiscoverabilityRequirements({
9458 } ,
9559 {
9660 label : "Verify at least 2 social accounts/website" ,
97- href : "#sites " ,
61+ href : "#platforms " ,
9862 completed :
9963 PARTNER_PLATFORM_FIELDS . filter (
10064 ( field ) => field . data ( partner . platforms ) . verified ,
Original file line number Diff line number Diff line change 1+ import { EnrolledPartnerProps , PartnerProps } from "../types" ;
2+ import { getDiscoverabilityRequirements } from "./get-discoverability-requirements" ;
3+
4+ export function getPartnerProfileChecklistProgress ( {
5+ partner,
6+ programEnrollments,
7+ } : {
8+ partner : Pick <
9+ PartnerProps ,
10+ | "image"
11+ | "description"
12+ | "monthlyTraffic"
13+ | "preferredEarningStructures"
14+ | "salesChannels"
15+ | "platforms"
16+ > ;
17+ programEnrollments : Pick <
18+ EnrolledPartnerProps ,
19+ "programId" | "status" | "totalCommissions"
20+ > [ ] ;
21+ } ) {
22+ const tasks = getDiscoverabilityRequirements ( {
23+ partner,
24+ programEnrollments,
25+ } ) ;
26+
27+ const completedCount = tasks . filter ( ( { completed } ) => completed ) . length ;
28+ const totalCount = tasks . length ;
29+
30+ return {
31+ tasks,
32+ completedCount,
33+ totalCount,
34+ isComplete : completedCount === totalCount ,
35+ } ;
36+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments