Files
fasto/types.ts
Cauê Faleiros ea8441d4be
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m32s
feat: implement advanced funnel management with multiple funnels and team assignments
- Updated DB schema to support multiple funnels (funnels table) and their stages (funnel_stages table).

- Added funnel_id to teams table to link teams to specific funnels.

- Redesigned /admin/funnels page ('Meus Funis') to allow creating multiple funnels, managing their stages, and assigning them to teams.

- Updated Dashboard, UserDetail, and AttendanceDetail to dynamically load the correct funnel based on the selected team or user's assigned team.
2026-03-13 14:19:52 -03:00

83 lines
1.6 KiB
TypeScript

export enum FunnelStage {
NO_CONTACT = 'Sem atendimento',
IDENTIFICATION = 'Identificação',
NEGOTIATION = 'Negociação',
WON = 'Ganhos',
LOST = 'Perdidos',
}
export interface FunnelStageDef {
id: string;
funnel_id: string;
name: string;
color_class: string;
order_index: number;
}
export interface FunnelDef {
id: string;
tenant_id: string;
name: string;
stages: FunnelStageDef[];
teamIds: string[];
}
export interface User {
id: string;
tenant_id: string;
name: string;
email: string;
slug?: string;
avatar_url: string;
role: 'super_admin' | 'admin' | 'manager' | 'agent';
team_id: string;
bio?: string;
status: 'active' | 'inactive';
sound_enabled?: boolean;
}
export interface Attendance {
id: string;
tenant_id: string;
user_id: string;
created_at: string; // ISO Date
summary: string;
attention_points: string[];
improvement_points: string[];
score: number; // 0-100
first_response_time_min: number;
handling_time_min: number;
funnel_stage: FunnelStage;
origin: 'WhatsApp' | 'Instagram' | 'Website' | 'LinkedIn' | 'Indicação';
product_requested: string;
product_sold?: string;
converted: boolean;
}
export interface Tenant {
id: string;
name: string;
logo_url?: string;
// Extended fields for Super Admin
slug?: string;
admin_email?: string;
status?: 'active' | 'inactive' | 'trial';
user_count?: number;
attendance_count?: number;
created_at?: string;
}
export interface DateRange {
start: Date;
end: Date;
}
export interface DashboardFilter {
dateRange: DateRange;
userId?: string;
teamId?: string;
funnelStage?: string;
origin?: string;
}