geo/frontend/types/onboarding.ts

129 lines
3.1 KiB
TypeScript

/**
* 新用户引导向导相关类型定义
*/
// 健康等级
export type HealthLevel = "excellent" | "good" | "fair" | "danger";
// 健康等级配置
export interface HealthLevelConfig {
label: string;
color: string;
bgColor: string;
borderColor: string;
minScore: number;
maxScore: number;
}
// 健康等级定义
export const HEALTH_LEVELS: Record<HealthLevel, HealthLevelConfig> = {
excellent: {
label: "优秀",
color: "text-emerald-600",
bgColor: "bg-emerald-50",
borderColor: "border-emerald-200",
minScore: 80,
maxScore: 100,
},
good: {
label: "良好",
color: "text-yellow-600",
bgColor: "bg-yellow-50",
borderColor: "border-yellow-200",
minScore: 60,
maxScore: 79,
},
fair: {
label: "及格",
color: "text-orange-600",
bgColor: "bg-orange-50",
borderColor: "border-orange-200",
minScore: 40,
maxScore: 59,
},
danger: {
label: "危险",
color: "text-red-600",
bgColor: "bg-red-50",
borderColor: "border-red-200",
minScore: 0,
maxScore: 39,
},
};
// 获取健康等级
export function getHealthLevel(score: number): HealthLevel {
if (score >= 80) return "excellent";
if (score >= 60) return "good";
if (score >= 40) return "fair";
return "danger";
}
// 引导流程状态
export interface OnboardingState {
currentStep: number;
brandName: string;
competitors: string[];
platforms: string[];
frequency: "daily" | "weekly" | "monthly";
healthScore: number | null;
isCompleted: boolean;
isSkipped: boolean;
}
// 竞品推荐响应
export interface CompetitorRecommendation {
id: string;
name: string;
reason: string;
}
// 品牌健康报告
export interface BrandHealthReport {
brand_id: string;
brand_name: string;
overall_score: number;
platform_scores: Record<string, number>;
competitor_scores: Array<{
name: string;
score: number;
is_leading: boolean;
}>;
strengths: string[];
weaknesses: string[];
}
// 行动建议
export interface ActionSuggestion {
id: string;
title: string;
description: string;
priority: "high" | "medium" | "low";
action_type: "improve_platform" | "add_competitor" | "optimize_content" | "increase_frequency";
}
// 创建品牌请求(引导流程用)
export interface OnboardingCreateBrandRequest {
name: string;
aliases?: string[];
competitors?: string[];
platforms: string[];
frequency: "daily" | "weekly" | "monthly";
}
// 引导流程步骤定义
export interface OnboardingStep {
id: number;
title: string;
description: string;
isSkippable: boolean;
}
export const ONBOARDING_STEPS: OnboardingStep[] = [
{ id: 1, title: "输入品牌名称", description: "输入您要监控的品牌名称", isSkippable: false },
{ id: 2, title: "确认竞品", description: "选择与您品牌竞争的对手", isSkippable: true },
{ id: 3, title: "选择平台", description: "选择要监控的AI搜索平台", isSkippable: true },
{ id: 4, title: "健康报告", description: "查看您的品牌健康报告", isSkippable: false },
{ id: 5, title: "行动建议", description: "获取提升品牌曝光的建议", isSkippable: true },
];