master - part 2
This commit is contained in:
@@ -852,6 +852,35 @@ export async function bulkUpdateClustersStatus(ids: number[], status: string): P
|
||||
});
|
||||
}
|
||||
|
||||
export interface ClustersSummary {
|
||||
total_clusters: number;
|
||||
total_keywords: number;
|
||||
total_volume: number;
|
||||
}
|
||||
|
||||
export async function fetchClustersSummary(sectorId?: number): Promise<ClustersSummary> {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
// Auto-add site filter
|
||||
const activeSiteId = getActiveSiteId();
|
||||
if (activeSiteId) {
|
||||
params.append('site_id', activeSiteId.toString());
|
||||
}
|
||||
|
||||
// Add sector filter if provided or get active
|
||||
if (sectorId !== undefined) {
|
||||
params.append('sector_id', sectorId.toString());
|
||||
} else {
|
||||
const activeSectorId = getActiveSectorId();
|
||||
if (activeSectorId !== null && activeSectorId !== undefined) {
|
||||
params.append('sector_id', activeSectorId.toString());
|
||||
}
|
||||
}
|
||||
|
||||
const queryString = params.toString();
|
||||
return fetchAPI(`/v1/planner/clusters/summary/${queryString ? `?${queryString}` : ''}`);
|
||||
}
|
||||
|
||||
export async function autoClusterKeywords(keywordIds: number[], sectorId?: number): Promise<{ success: boolean; task_id?: string; clusters_created?: number; keywords_updated?: number; message?: string; error?: string }> {
|
||||
const endpoint = `/v1/planner/keywords/auto_cluster/`;
|
||||
const requestBody = { ids: keywordIds, sector_id: sectorId };
|
||||
|
||||
Reference in New Issue
Block a user