/** * Google Autocomplete Hook - V2 Implementation * Compatible with V1 interface while using V2 core architecture */ declare global { interface Window { google?: { maps?: { places?: { AutocompleteService: new () => any; PlacesService: new (map: any) => any; PlacesServiceStatus: { OK: string; ZERO_RESULTS: string; }; }; Map: new (element: HTMLElement) => any; }; }; } } export interface GooglePrediction { place_id: string; description: string; structured_formatting?: { main_text: string; secondary_text: string; }; } export interface GooglePlaceDetails { place_id: string; formatted_address: string; address_components: { long_name: string; short_name: string; types: string[]; }[]; geometry?: { location: { lat: number; lng: number; }; }; } export interface ExtractedAddress { subpremise: string; streetNumber: string; route: string; locality: string; administrativeAreaLevel1: string; administrativeAreaLevel1Long: string; administrativeAreaLevel2: string; administrativeAreaLevel2Long: string; country: string; postalCode: string; fullStreetAddress: string; } export interface FormattedAddress { address1: string; city: string; country: string; state: string; postal: string; } export interface UseGoogleAutocompleteOptions { apiKey: string; libraries?: string[]; version?: string; language?: string; region?: string; /** When true, defer loading the Google Maps script until searchPlaces() is first called. Default: false (eager load). */ defer?: boolean; } export interface UseGoogleAutocompleteResult { predictions: GooglePrediction[]; isLoading: boolean; isScriptLoaded: boolean; searchPlaces: (input: string, countryRestriction?: string) => void; getPlaceDetails: (placeId: string) => Promise; extractAddressComponents: (place: GooglePlaceDetails) => ExtractedAddress; extractFormattedAddress: (place: GooglePlaceDetails) => FormattedAddress; clearPredictions: () => void; } /** * React hook for Google Places Autocomplete with automatic script injection * Automatically loads the Google Maps JavaScript API with Places library */ export declare function useGoogleAutocomplete(options: UseGoogleAutocompleteOptions): UseGoogleAutocompleteResult;