Fetches and manages leads data via API; exposes loading state and updates for React components.
"use client";
import { useState, useEffect, useCallback } from "react";
import { api } from "@/lib/api";
export interface Lead {
id: string;
name: string;
address: string;
lat?: number | null;
lng?: number | null;
phone: string;
website: string;
rating: string;
reviewCount?: number | null;
score: number;
priority: "HIGH" | "MEDIUM" | "LOW";
crmStatus: "new" | "contacted" | "replied" | "meeting" | "proposal" | "won" | "lost";
crmNotes?: string;
hasWebsite: boolean;
industry?: string;
category?: string;
campaignId: string;
campaign?: { id: string; name: string };
marketingContent?: {
email?: { subject: string; body: string };
whatsapp?: string;
instagram?: string;
linkedin?: { connectionNote: string };
coldCall?: { opening: string };
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key