import type { RefAttributes } from "react"; import type { ComboboxElementType, ComboboxProps } from "../Combobox"; export interface AddressLookupService { search(searchTerm: string): Promise; findById(id: string): Promise; get(id: string): Promise; } export type AddressLookupProps = Omit< ComboboxProps, "options" | "asyncOptions" | "onSelected" > & RefAttributes & { addressLookupService: AddressLookupService; onAddressSelected?: (address: LoqateAddressDetailsItem) => void; onOptionsDisplayed?: () => void; onError?: (error: Error) => void; }; // Loqate API response types export type LoqateErrorItem = { Error: string; Description: string; Cause: string; Resolution: string; }; export type LoqateSearchResultItem = { Id: string; Type: string; Text: string; Highlight: string; Description: string; }; export type LoqateErrorResponse = { Items: LoqateErrorItem[] }; export type LoqateSearchResponse = { Items: LoqateSearchResultItem[] }; export type LoqateAddressDetailsItem = { Id: string; Type: string; City: string; Line1: string; Line2: string; PostalCode: string; Label: string; // US only fields SubBuilding?: string; BuildingNumber?: string; Street?: string; }; export type LoqateAddressDetailsResponse = { Items: LoqateAddressDetailsItem[]; };