diff --git a/app/api/agentkit/get/route.ts b/app/api/agentkit/get/route.ts deleted file mode 100644 index 885c9018b..000000000 --- a/app/api/agentkit/get/route.ts +++ /dev/null @@ -1,54 +0,0 @@ -import getPostComments from "@/lib/getPostComments"; -import supabase from "@/lib/supabase/serverClient"; -import { NextRequest, NextResponse } from "next/server"; - -export async function GET(req: NextRequest) { - const agentId = req.nextUrl.searchParams.get("agentId"); - try { - const { data } = await supabase - .from("agents") - .select( - ` - *, - agent_status ( - *, - social:socials ( - *, - social_posts ( - *, - posts ( - * - ) - ), - social_spotify_tracks ( - *, - spotify_tracks ( - * - ) - ), - social_spotify_albums ( - *, - spotify_albums ( - * - ) - ) - ) - ) - `, - ) - .eq("id", agentId) - .single(); - const comments = await getPostComments(data.agent_status); - return NextResponse.json({ - data, - comments, - }); - } catch (error) { - console.error("Error:", error); - return NextResponse.json({ error: "Failed to fetch" }, { status: 500 }); - } -} - -export const dynamic = "force-dynamic"; -export const fetchCache = "force-no-store"; -export const revalidate = 0; diff --git a/app/api/apify/route.ts b/app/api/apify/route.ts deleted file mode 100644 index 154deda94..000000000 --- a/app/api/apify/route.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { NextRequest } from "next/server"; -import handleApifyWebhook from "@/lib/apify/handleApifyWebhook"; -import apifyPayloadSchema from "@/lib/apify/apifyPayloadSchema"; - -/** - * API endpoint for Apify webhooks. - * Accepts a POST request with a JSON payload, optionally fetches a dataset, and always responds with 200. - */ -export async function POST(req: NextRequest) { - try { - const body = await req.json(); - // Optionally validate the payload shape - const parsed = apifyPayloadSchema.safeParse(body); - console.log("Received Apify webhook:", parsed); - - if (!parsed.success) { - return new Response(JSON.stringify({ message: "Invalid payload" }), { - status: 400, - headers: { "Content-Type": "application/json" }, - }); - } - const result = await handleApifyWebhook(parsed.data); - console.log("handleApifyWebhook result:", result); - - return new Response(JSON.stringify(result), { - status: 200, - headers: { "Content-Type": "application/json" }, - }); - } catch { - // Always respond with 200, even if parsing fails - return new Response( - JSON.stringify({ message: "Apify webhook received (invalid JSON)" }), - { status: 200, headers: { "Content-Type": "application/json" } } - ); - } -} - -export const dynamic = "force-dynamic"; -export const fetchCache = "force-no-store"; -export const revalidate = 0; diff --git a/app/api/funnel_analysis/route.ts b/app/api/funnel_analysis/route.ts deleted file mode 100644 index 52eb0d8bc..000000000 --- a/app/api/funnel_analysis/route.ts +++ /dev/null @@ -1,19 +0,0 @@ -import getFunnelAnalysis from "@/lib/chat/getFunnelAnalysis"; -import { NextRequest } from "next/server"; - -export async function GET(req: NextRequest) { - const pilotId = req.nextUrl.searchParams.get("pilotId"); - - try { - const data = await getFunnelAnalysis(pilotId as string); - return Response.json({ data }, { status: 200 }); - } catch (error) { - console.error(error); - const message = error instanceof Error ? error.message : "failed"; - return Response.json({ message }, { status: 400 }); - } -} - -export const dynamic = "force-dynamic"; -export const fetchCache = "force-no-store"; -export const revalidate = 0; diff --git a/app/api/get_artists_by_socials/route.tsx b/app/api/get_artists_by_socials/route.tsx deleted file mode 100644 index 35396bbc7..000000000 --- a/app/api/get_artists_by_socials/route.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import supabase from "@/lib/supabase/serverClient"; -import { NextRequest } from "next/server"; - -export async function POST(req: NextRequest) { - const body = await req.json(); - const socialIds = body.socialIds; - - try { - const { data: account_socials } = await supabase - .from("account_socials") - .select("*, account:accounts(*)") - .in("social_id", socialIds); - if (!account_socials) throw new Error("failed"); - - const accountIds = account_socials.map( - (account_social) => account_social.account.id, - ); - const artistIds = [...new Set(accountIds)]; - - return Response.json({ artistIds }, { status: 200 }); - } catch (error) { - console.error(error); - const message = error instanceof Error ? error.message : "failed"; - return Response.json({ message }, { status: 400 }); - } -} - -export const dynamic = "force-dynamic"; -export const fetchCache = "force-no-store"; -export const revalidate = 0; diff --git a/app/api/get_running_agent/route.ts b/app/api/get_running_agent/route.ts deleted file mode 100644 index 313671738..000000000 --- a/app/api/get_running_agent/route.ts +++ /dev/null @@ -1,44 +0,0 @@ -import supabase from "@/lib/supabase/serverClient"; -import { STEP_OF_AGENT } from "@/types/Funnel"; -import { NextRequest } from "next/server"; - -export async function GET(req: NextRequest) { - const artistId = req.nextUrl.searchParams.get("artistId"); - try { - const { data: account } = await supabase - .from("accounts") - .select("*, account_socials(*)") - .eq("id", artistId) - .single(); - - if (!account) return Response.json({ agent: null }, { status: 200 }); - - const social_ids = account.account_socials.map( - // eslint-disable-next-line - (account_social: any) => account_social.social_id, - ); - - const { data: agent_status } = await supabase - .from("agent_status") - .select("*, social:socials(*), agent:agents(*)") - .in("social_id", social_ids) - .neq("status", STEP_OF_AGENT.FINISHED) - .neq("status", STEP_OF_AGENT.ERROR) - .neq("status", STEP_OF_AGENT.UNKNOWN_PROFILE) - .neq("status", STEP_OF_AGENT.RATE_LIMIT_EXCEEDED) - .neq("status", STEP_OF_AGENT.MISSING_POSTS) - .order("updated_at", { ascending: false }) - .limit(1) - .single(); - - return Response.json({ agent: agent_status }, { status: 200 }); - } catch (error) { - console.error(error); - const message = error instanceof Error ? error.message : "failed"; - return Response.json({ message }, { status: 400 }); - } -} - -export const dynamic = "force-dynamic"; -export const fetchCache = "force-no-store"; -export const revalidate = 0; diff --git a/app/api/ipfs/route.tsx b/app/api/ipfs/route.tsx deleted file mode 100644 index 43e80414a..000000000 --- a/app/api/ipfs/route.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import saveFile from "@/lib/ipfs/saveFile"; -import { NextRequest } from "next/server"; - -export async function POST(request: NextRequest) { - const data = await request.formData(); - const file: File | null = data.get("file") as unknown as File; - data.append("file", file); - data.append("pinataMetadata", JSON.stringify({ name: "File to upload" })); - const cid = await saveFile(data); - return Response.json({ cid }, { status: 200 }); -} diff --git a/app/api/stripe/session/checked/route.ts b/app/api/stripe/session/checked/route.ts deleted file mode 100644 index f8b69d19c..000000000 --- a/app/api/stripe/session/checked/route.ts +++ /dev/null @@ -1,30 +0,0 @@ -import stripeClient from "@/lib/stripe/client"; -import { NextRequest } from "next/server"; - -export async function GET(req: NextRequest) { - const sessionId = req.nextUrl.searchParams.get("sessionId"); - const accountId = req.nextUrl.searchParams.get("accountId"); - - if (!sessionId) { - return Response.json({ message: "sessionId is required" }, { status: 400 }); - } - - try { - const session = await stripeClient.checkout.sessions.update(sessionId, { - metadata: { - credit_updated: "credit_updated", - accountId, - }, - }); - - return Response.json({ data: session }, { status: 200 }); - } catch (error) { - console.error(error); - const message = error instanceof Error ? error.message : "failed"; - return Response.json({ message }, { status: 400 }); - } -} - -export const dynamic = "force-dynamic"; -export const fetchCache = "force-no-store"; -export const revalidate = 0; diff --git a/app/api/stripe/session/list/route.ts b/app/api/stripe/session/list/route.ts deleted file mode 100644 index 4ea241fa2..000000000 --- a/app/api/stripe/session/list/route.ts +++ /dev/null @@ -1,27 +0,0 @@ -import stripeClient from "@/lib/stripe/client"; -import { NextRequest } from "next/server"; - -export async function GET(req: NextRequest) { - const referenceId = req.nextUrl.searchParams.get("referenceId"); - - try { - const sessions = await stripeClient.checkout.sessions.list({ - limit: 100, - }); - - const session = sessions.data.find( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (item: any) => item.client_reference_id === referenceId, - ); - - return Response.json({ data: session }, { status: 200 }); - } catch (error) { - console.error(error); - const message = error instanceof Error ? error.message : "failed"; - return Response.json({ message }, { status: 400 }); - } -} - -export const dynamic = "force-dynamic"; -export const fetchCache = "force-no-store"; -export const revalidate = 0; diff --git a/app/api/upload/pfp/route.tsx b/app/api/upload/pfp/route.tsx deleted file mode 100644 index 77c1378d6..000000000 --- a/app/api/upload/pfp/route.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import uploadPfpToIpfs from "@/lib/uploadPfpToIpfs"; -import { NextRequest } from "next/server"; - -export async function POST(req: NextRequest) { - const body = await req.json(); - const url = body.image; - try { - const pfp = await uploadPfpToIpfs(url); - return Response.json({ success: true, image: pfp }, { status: 200 }); - } catch (error) { - console.error(error); - return Response.json({ image: null, success: false }, { status: 500 }); - } -} - -export const dynamic = "force-dynamic"; -export const fetchCache = "force-no-store"; -export const revalidate = 0; diff --git a/app/api/workspace/create/route.ts b/app/api/workspace/create/route.ts deleted file mode 100644 index ea7f599fb..000000000 --- a/app/api/workspace/create/route.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { NextRequest } from "next/server"; -import { NEW_API_BASE_URL } from "@/lib/consts"; - -/** - * @deprecated This endpoint is deprecated. Use recoup-api directly at POST /api/workspaces - * - * Create a blank workspace for an account. - * This route now proxies to recoup-api for workspace creation. - */ -export async function POST(req: NextRequest) { - const sunsetDate = new Date("2026-03-01"); - const deprecationHeaders = { - Deprecation: "true", - Sunset: sunsetDate.toUTCString(), - Link: `<${NEW_API_BASE_URL}/api/workspaces>; rel="deprecation"`, - }; - - try { - const body = await req.text(); - - // Forward auth headers to recoup-api - const headers = new Headers(); - const authHeader = req.headers.get("authorization"); - const apiKeyHeader = req.headers.get("x-api-key"); - - if (authHeader) { - headers.set("authorization", authHeader); - } - if (apiKeyHeader) { - headers.set("x-api-key", apiKeyHeader); - } - headers.set("Content-Type", "application/json"); - - const response = await fetch(`${NEW_API_BASE_URL}/api/workspaces`, { - method: "POST", - headers, - body, - }); - - const responseData = await response.json(); - - return Response.json(responseData, { - status: response.status, - headers: deprecationHeaders, - }); - } catch (error) { - console.error("Error proxying workspace creation:", error); - const message = error instanceof Error ? error.message : "Failed to create workspace"; - return Response.json( - { status: "error", error: message }, - { status: 500, headers: deprecationHeaders } - ); - } -} - -export const dynamic = "force-dynamic"; -export const fetchCache = "force-no-store"; -export const revalidate = 0; diff --git a/components/SocialSharing/SocialSharing.tsx b/components/SocialSharing/SocialSharing.tsx deleted file mode 100644 index 68c3ff272..000000000 --- a/components/SocialSharing/SocialSharing.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import React, { useState } from "react"; -import HeatMap from "@uiw/react-heat-map"; -import useActivities from "@/hooks/useActivities"; -import { Twitter, Download } from "lucide-react"; -import { ONE_DAY_MILLISECONDS } from "@/lib/consts"; -import useShareHeatMap from "@/hooks/useShareHeatMap"; - -const SocialSharing = () => { - const today = new Date(); - const { activities } = useActivities(); - const { heatmap, download, tweets, loading } = useShareHeatMap(); - const [x, setX] = useState(0); - const [y, setY] = useState(0); - const [tooltipActive, setTooltipActive] = useState(false); - const [tooltipContent, setTooltipContent] = useState(""); - - return ( -