38 lines
952 B
TypeScript
38 lines
952 B
TypeScript
import { fetchWithAuth } from "./client";
|
|
|
|
export interface HealthScoreDimension {
|
|
name: string;
|
|
score: number;
|
|
max_score: number;
|
|
percentage: number;
|
|
status: string;
|
|
}
|
|
|
|
export interface HealthScoreRecommendation {
|
|
priority: string;
|
|
dimension: string;
|
|
title: string;
|
|
description: string;
|
|
}
|
|
|
|
export interface HealthScoreResponse {
|
|
brand_name: string;
|
|
overall_score: number;
|
|
health_level: string;
|
|
health_level_label: string;
|
|
dimensions: HealthScoreDimension[];
|
|
recommendations: HealthScoreRecommendation[];
|
|
is_full_report: boolean;
|
|
cached: boolean;
|
|
}
|
|
|
|
export const healthScoreApi = {
|
|
getHealthScore: async (brand: string, competitors?: string[]): Promise<HealthScoreResponse> => {
|
|
const params = new URLSearchParams({ brand });
|
|
if (competitors && competitors.length > 0) {
|
|
params.set("competitors", competitors.join(","));
|
|
}
|
|
return fetchWithAuth(`/api/v1/public/health-score?${params}`);
|
|
},
|
|
};
|