Skip to content

Commit 3be96ed

Browse files
fix(contacts): distinguish WhatsApp group contacts from real customer contacts (EVO-1018)
- Add 'group' to Contact type union in TypeScript types - Add include_groups param to ContactsListParams and ContactsSearchParams - Update ContactTypeBadge to render 'Group' badge with Users icon for group type - Normalize group type to person in ContactForm (groups are not editable via form) - Add type.group translation key to all 6 locales (en, pt, pt-BR, es, fr, it) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d49e39c commit 3be96ed

9 files changed

Lines changed: 29 additions & 12 deletions

File tree

src/components/contacts/ContactForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export default function ContactForm({
156156
const lastName = nameParts.slice(1).join(' ') || '';
157157

158158
setFormData({
159-
type: contact.type || 'person',
159+
type: (contact.type === 'group' ? 'person' : contact.type) || 'person',
160160
firstName,
161161
lastName,
162162
email: contact.email || '',

src/components/contacts/ContactTypeBadge.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
import { Badge } from '@evoapi/design-system';
2-
import { User, Building2 } from 'lucide-react';
2+
import { User, Building2, Users } from 'lucide-react';
33
import { useLanguage } from '@/hooks/useLanguage';
44

55
interface ContactTypeBadgeProps {
6-
type: 'person' | 'company';
6+
type: 'person' | 'company' | 'group';
77
className?: string;
88
}
99

1010
export default function ContactTypeBadge({ type, className = '' }: ContactTypeBadgeProps) {
1111
const { t } = useLanguage('contacts');
12+
13+
if (type === 'group') {
14+
return (
15+
<Badge variant="outline" className={`gap-1 ${className}`}>
16+
<Users className="h-3 w-3" />
17+
{t('type.group')}
18+
</Badge>
19+
);
20+
}
21+
1222
const isPerson = type === 'person';
1323

1424
return (

src/i18n/locales/en/contacts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@
491491
},
492492
"type": {
493493
"person": "Person",
494-
"company": "Company"
494+
"company": "Company",
495+
"group": "Group"
495496
},
496497
"filter": {
497498
"title": "Filter Contacts",

src/i18n/locales/es/contacts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@
483483
},
484484
"type": {
485485
"person": "Persona",
486-
"company": "Empresa"
486+
"company": "Empresa",
487+
"group": "Grupo"
487488
},
488489
"filter": {
489490
"title": "Filtrar Contactos",

src/i18n/locales/fr/contacts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@
483483
},
484484
"type": {
485485
"person": "Personne",
486-
"company": "Entreprise"
486+
"company": "Entreprise",
487+
"group": "Groupe"
487488
},
488489
"filter": {
489490
"title": "Filtrer les Contacts",

src/i18n/locales/it/contacts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@
483483
},
484484
"type": {
485485
"person": "Persona",
486-
"company": "Azienda"
486+
"company": "Azienda",
487+
"group": "Gruppo"
487488
},
488489
"filter": {
489490
"title": "Filtra Contatti",

src/i18n/locales/pt-BR/contacts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@
491491
},
492492
"type": {
493493
"person": "Pessoa",
494-
"company": "Empresa"
494+
"company": "Empresa",
495+
"group": "Grupo"
495496
},
496497
"filter": {
497498
"title": "Filtrar Contatos",

src/i18n/locales/pt/contacts.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@
491491
},
492492
"type": {
493493
"person": "Pessoa",
494-
"company": "Empresa"
494+
"company": "Empresa",
495+
"group": "Grupo"
495496
},
496497
"filter": {
497498
"title": "Filtrar Contatos",

src/types/contacts/contact.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export interface ContactPipelineInfo {
112112
export interface Contact {
113113
id: string;
114114
name: string;
115-
type: 'person' | 'company';
115+
type: 'person' | 'company' | 'group';
116116
email: string;
117117
phone_number: string;
118118
thumbnail: string;
@@ -210,7 +210,8 @@ export interface ContactsListParams {
210210
order?: 'asc' | 'desc';
211211
labels?: string[];
212212
q?: string;
213-
type?: 'person' | 'company';
213+
type?: 'person' | 'company' | 'group';
214+
include_groups?: boolean;
214215
company_id?: string;
215216
include_contact_inboxes?: boolean;
216217
created_after?: string;
@@ -224,7 +225,7 @@ export interface ContactsSearchParams {
224225
page?: number;
225226
per_page?: number;
226227
sort?: string;
227-
type?: 'person' | 'company';
228+
type?: 'person' | 'company' | 'group';
228229
labels?: string[];
229230
include_contact_inboxes?: boolean;
230231
}

0 commit comments

Comments
 (0)