/* eslint-disable no-unused-vars */ declare module '@mappingfactory/sdk-js' { import type { Map } from 'maplibre-gl'; import type MapLibreGL from 'maplibre-gl'; /** * ! ------------------------------------------------------- * ! -------------------- SDK ------------------------------ * ! ------------------------------------------------------- */ export type SDKConstructorOptions = { apiKey: string; locale?: string; uri?: string; }; export class MichelinSDKClient { static Languages: Record; static Defaults: { URI: string; }; constructor(options: SDKConstructorOptions); Roadsheet: RoadSheetWrapper; Direction: DirectionWrapper; Search: Search; MapLibre: MapLibreWrapper; getOptions(key?: string): SDKConstructorOptions | SDKConstructorOptions[keyof SDKConstructorOptions]; updateOptions(options: SDKConstructorOptions): void; loadRoadsheetLibrary(options?: RoadsheetOptions): Promise; loadDirectionLibrary(options?: DirectionOptions): Promise; loadSearchLibrary(options?: SearchConstructorOptions): Promise; loadMapLibreLibrary(): Promise; // Add type information for other methods and properties here } /** * ! ------------------------------------------------------- * ! ------------------ ROADSHEET -------------------------- * ! ------------------------------------------------------- */ export type RoadsheetOptions = { icons?: { mapIcon?: { content: string; }; maneuver?: { [maneuverType: string]: { innerText: boolean; content: string; }; }; mention?: { [mentionType: string]: { content: string; }; }; }; unit?: 'metric' | 'imperial'; customClass?: string; language?: string | keyof typeof MichelinSDKClient.Languages; languageMessages?: { [lang: string]: { [key: string]: string; }; }; startDate?: Date; disabledManeuvers?: string[]; disabledMentions?: (string | 'all')[]; primaryMentions?: string[]; maxSecondaryMentions?: number; }; export class RoadSheetWrapper { constructor(); client: { getHtml: (route?: unknown, waypoints?: unknown, language?: string) => Promise; }; utils: unknown; setFormData(options: RoadsheetOptions): void; } /** * ! ------------------------------------------------------- * ! ------------------ DIRECTION -------------------------- * ! ------------------------------------------------------- */ export type DirectionConstructorOptions = { apiKey: string; uri?: string; map?: Map; }; export type DirectionOptions = { currency: string; unit: string; vehicleType: string; annotations: string; vehicleCommercial: string; url: string; http_request_method: string; alternatives: boolean; avoid: string; car_type: string; coordinates: [Location, Location]; electricity_consumptions_per_hundred_km: string; electricity_cost: number; fuel_consumptions_per_hundred_km: string; fuel_cost: number; fuel_type: string; geometries: string; language: string; mentions: string; mode: string; motorization: string; overview: string; pois_corridor_options: string; steps: boolean; traffic: string; type: string; vehicle_adr_tunnel_restriction_code: string; vehicle_axle_weight: string; vehicle_commercial: string; vehicle_height: string; vehicle_length: string; vehicle_load_type: string; vehicle_max_speed: string; vehicle_type: string; vehicle_weight: string; vehicle_width: string; waypoints: number[]; }; export type DirectionWithLayerId = { layerId: string; }; export type DirectionSetTraceWidth = { width: number; } & Partial; export type DirectionSetTraceColor = { color: string; } & Partial; export type DirectionShowTrace = { visible: boolean; route?: Record; } & Partial; export interface DirectionSearchResponse { routes: DirectionSearchResponseRoute[]; waypoints: DirectionSearchResponseWaypoint[]; code: string; uuid: string; } export interface DirectionSearchResponseRoute { duration: number; distance: number; weight: number; weight_name: string; geometry: DirectionSearchResponseGeometry; legs: DirectionSearchResponseLeg[]; summary: string; traffic_impact_duration: number; highway_duration: number; highway_traffic_impact_duration: number; highway_distance: number; type: string; mentions: DirectionSearchResponseMention[]; route_identifier: string; toll_cost: DirectionSearchResponseTollCost[]; unit: string; total_toll_cost: number; adaptations: Record; } export interface DirectionSearchResponseGeometry { coordinates: number[][]; type: string; } export interface DirectionSearchResponseLeg { duration: number; traffic_impact_duration: number; highway_duration: number; highway_traffic_impact_duration: number; distance: number; highway_distance: number; weight: number; summary: string; steps: any[]; annotation: Record; admins: any[]; } export interface DirectionSearchResponseMention { type: string; odometer_distance: number; odometer_time: number; location: number[]; length: number; message: string; restriction_type?: number; url?: string; url_name?: string; toll_ticket?: string; cost?: number; name?: string; tolls?: DirectionSearchResponseToll[]; unit?: string; } export interface DirectionSearchResponseToll { category: number; unit: string; value: number; } export interface DirectionSearchResponseTollCost { category: number; unit: string; value: number; } export interface DirectionSearchResponseWaypoint { name: string; town: string; country: string; location: number[]; distance: number; } export class DirectionWrapper { constructor(options: DirectionConstructorOptions); client: { formData: DirectionOptions; opts: DirectionConstructorOptions; search: () => Promise; setCoordinates: (arrival: Location, departure: Location) => void; }; loadMappingDirections(options: DirectionOptions): Promise; setFormData(options: Partial): void; setHttpRequestMethod(method: string): void; setApiUrl(url: string): void; setApiKey(key: string): void; setMap(map: Map): void; setTraceWidth(options: DirectionSetTraceWidth): void; setTraceColor(options: DirectionSetTraceColor): void; showTrace(options: DirectionShowTrace): void; getTraceVisibility(layerId: Partial['layerId']): boolean; removeTrace(layerId: Partial['layerId']): void; } /** * ! ------------------------------------------------------- * ! ------------------ SEARCH ----------------------------- * ! ------------------------------------------------------- */ export type SearchConstructorOptions = { apiKey: string; uri?: string; fetch?: Function; language?: string; }; export type SearchGeocodingOptions = { address: string; filter?: string; language?: string; countries?: string[]; limit?: string | number; bounds?: Bounds; proximity?: Location; }; export type Bounds = { southwest: Location; northeast: Location; }; export type Location = { latitude: number; longitude: number; }; export type SearchGeocodingResponseAddress = { formatted_address: string; street_number?: string; street_name?: string; city?: string; city_subdivisions?: { name: string }[]; postal_code?: string; country_subdivisions?: { name: string; code?: string }[]; country?: { name: string; code?: string; }; }; export type SearchGeocodingResponseViewport = { northeast: Location; southwest: Location; }; export type SearchGeocodingAddressResult = { score: number; address: SearchGeocodingResponseAddress; geometry: { location: Location; viewport?: SearchGeocodingResponseViewport; }; types: string[]; category?: { name: string; }; }; export type SearchGeocodingResponse = { status: number; results: SearchGeocodingAddressResult[]; }; export type SearchAutocompleteInputOptions = { id?: string; class?: string; classNames?: string; placeholder?: string; autoComplete?: boolean; rtl?: boolean; }; export type SearchAutocompleteDropdownOptions = { tag?: string; id?: string; class?: string; classNames?: string; position?: 'bottom' | 'top' | 'right' | 'left'; noResultsOpen?: boolean; }; export type SearchAutocompleteDropdownItemOptions = { tag?: string; id?: string; class?: string; classNames?: string; highlight?: boolean; highlightClass?: string; truncateDetails?: boolean; }; export type SearchAutocompleteOptions = { // AutocompleteBehavior allowTab?: boolean; debounce?: number; threshold?: number; // AutocompleteSearchOptions countries?: string[]; include_poi?: boolean; language?: string; limit?: string | number; bounds?: Bounds | null; proximity?: Location | null; // AutocompleteDropdown dropdown?: SearchAutocompleteDropdownOptions; dropdownItem?: SearchAutocompleteDropdownItemOptions; input?: SearchAutocompleteInputOptions; }; export type SearchAutocompleteEvents = | 'selected' | 'opened' | 'closed' | 'search' | 'selected' | 'noResults' | 'error' | 'success' | 'clear'; export type SearchAutocompleteManager = { _on: (event: SearchAutocompleteEvents, callback: Function) => void; }; export class Search { static Languages: Record; constructor(options: SearchConstructorOptions); _options: SearchConstructorOptions; _autocompleteInstances: SearchAutocompleteManager[]; _client: { fetchImpl: Function; }; getOptions(key?: string): SearchConstructorOptions | SearchConstructorOptions[keyof SearchConstructorOptions]; updateOptions(options: SearchConstructorOptions): void; geocoding(options: SearchGeocodingOptions): Promise; autocomplete(element: HTMLElement, options?: SearchAutocompleteOptions): Promise; } /** * ! ------------------------------------------------------- * ! ------------------ MAPLIBRE --------------------------- * ! ------------------------------------------------------- */ export class MapLibreWrapper { constructor(); _client: typeof MapLibreGL; } }