Files
fasto/types.ts
Cauê Faleiros 1d3315a1d0
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m51s
feat: implement relational lead origins with team assignments
- Dropped simple origins table in favor of origin_groups and origin_items to match the Funnels architecture.

- Added origin_group_id to teams table to assign specific origins to specific teams.

- Updated /admin/origins page to support creating origin groups, adding origin items to them, and assigning teams to groups.

- Updated Dashboard and UserDetail pages to dynamically load the exact origin items belonging to the active team/user.
2026-03-18 11:18:30 -03:00

98 lines
1.8 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 OriginItemDef {
id: string;
origin_group_id: string;
name: string;
}
export interface OriginGroupDef {
id: string;
tenant_id: string;
name: string;
items: OriginItemDef[];
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
title: string;
full_summary?: string;
attention_points: string[];
improvement_points: string[];
score: number; // 0-100
first_response_time_min: number;
handling_time_min: number;
funnel_stage: string;
origin: string;
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;
}