ultisuite-client/lib/contacts/types.ts
R3D347HR4Y 77f99d8d8a hehe
2026-05-19 00:48:20 +02:00

47 lines
1.1 KiB
TypeScript

import type { Contact } from "@/lib/compose-context"
export interface ContactAddress {
street?: string
city?: string
region?: string
postalCode?: string
country?: string
label: string
}
export interface FullContact {
id: string
namePrefix?: string
firstName: string
middleName?: string
lastName: string
nameSuffix?: string
phoneticFirstName?: string
phoneticLastName?: string
nicknames?: string[]
company?: string
department?: string
jobTitle?: string
emails: { value: string; label: string }[]
phones: { value: string; label: string }[]
addresses?: ContactAddress[]
birthday?: { day?: number; month?: number; year?: number }
notes?: string
labels?: string[]
avatarUrl?: string
interactionCount?: number
isOtherContact?: boolean
createdAt: number
updatedAt: number
}
export function fullContactDisplayName(c: FullContact): string {
return `${c.firstName} ${c.lastName}`.trim()
}
export function toComposeContact(c: FullContact): Contact {
const name = fullContactDisplayName(c)
const email = c.emails[0]?.value ?? ""
return { name, email }
}