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 showDetailedAnalytics

Steven Tey52305c045247
diff --git a/apps/web/lib/constants/program.ts b/apps/web/lib/constants/program.ts
index 9bf4a6ae62..6210561bdb 100644
--- a/apps/web/lib/constants/program.ts
+++ b/apps/web/lib/constants/program.ts
@@ -1,8 +1,5 @@
export const PROGRAM_ONBOARDING_PARTNERS_LIMIT = 5;
-export const LARGE_PROGRAM_IDS = [
- "prog_CYCu7IMAapjkRpTnr8F1azjN",
- "prog_1K0QHV7MP3PR05CJSCF5VN93X",
-];
+export const LARGE_PROGRAM_IDS = ["prog_1K0QHV7MP3PR05CJSCF5VN93X"];
export const LARGE_PROGRAM_MIN_TOTAL_COMMISSIONS_CENTS = 500000; // $5000
export const PROGRAM_SIMILARITY_SCORE_THRESHOLD = 0.3;
diff --git a/apps/web/lib/partners/get-discoverability-requirements.ts b/apps/web/lib/partners/get-discoverability-requirements.ts
index 7e9c164e43..61d7baed51 100644
--- a/apps/web/lib/partners/get-discoverability-requirements.ts
+++ b/apps/web/lib/partners/get-discoverability-requirements.ts
@@ -1,4 +1,4 @@
-import { currencyFormatter } from "@dub/utils";
+import { ACME_PROGRAM_ID, currencyFormatter } from "@dub/utils";
import { LARGE_PROGRAM_IDS } from "../constants/program";
import { EnrolledPartnerProps, PartnerProps } from "../types";
import {
@@ -17,7 +17,7 @@ const partnerHasEarnedCommissions = (
return (
programEnrollments.filter(
(pe) =>
- !LARGE_PROGRAM_IDS.includes(pe.programId) &&
+ ![...LARGE_PROGRAM_IDS, ACME_PROGRAM_ID].includes(pe.programId) &&
pe.status === "approved" &&
pe.totalCommissions >= PARTNER_DISCOVERY_MIN_COMMISSIONS,
).length >= 1
diff --git a/apps/web/lib/swr/use-program-enrollment.ts b/apps/web/lib/swr/use-program-enrollment.ts
index dd2a9ed605..23110e030a 100644
--- a/apps/web/lib/swr/use-program-enrollment.ts
+++ b/apps/web/lib/swr/use-program-enrollment.ts
@@ -1,4 +1,7 @@
-import { LARGE_PROGRAM_MIN_TOTAL_COMMISSIONS_CENTS } from "@/lib/constants/program";
+import {
+ LARGE_PROGRAM_IDS,
+ LARGE_PROGRAM_MIN_TOTAL_COMMISSIONS_CENTS,
+} from "@/lib/constants/program";
import { fetcher } from "@dub/utils";
import { useSession } from "next-auth/react";
import { useParams } from "next/navigation";
@@ -35,10 +38,11 @@ export default function useProgramEnrollment({
return {
programEnrollment,
showDetailedAnalytics:
- programSlug !== "perplexity" ||
- (programEnrollment?.status === "approved" &&
- (programEnrollment?.totalCommissions ?? 0) >=
- LARGE_PROGRAM_MIN_TOTAL_COMMISSIONS_CENTS),
+ programEnrollment &&
+ (!LARGE_PROGRAM_IDS.includes(programEnrollment.programId) ||
+ (programEnrollment.status === "approved" &&
+ programEnrollment.totalCommissions >=
+ LARGE_PROGRAM_MIN_TOTAL_COMMISSIONS_CENTS)),
error,
loading: status === "loading" || isLoading,
};
diff --git a/apps/web/scripts/migrations/update-discoverable-partners.ts b/apps/web/scripts/migrations/update-discoverable-partners.ts
index 534ae92f30..01ef442725 100644
--- a/apps/web/scripts/migrations/update-discoverable-partners.ts
+++ b/apps/web/scripts/migrations/update-discoverable-partners.ts
@@ -1,5 +1,6 @@
import { LARGE_PROGRAM_IDS } from "@/lib/constants/program";
import { prisma } from "@dub/prisma";
+import { ACME_PROGRAM_ID } from "@dub/utils";
import "dotenv-flow/config";
async function main() {
@@ -8,7 +9,7 @@ async function main() {
programs: {
some: {
programId: {
- notIn: LARGE_PROGRAM_IDS,
+ notIn: [...LARGE_PROGRAM_IDS, ACME_PROGRAM_ID],
},
status: "approved",
totalCommissions: {