@@ -37,7 +37,6 @@ import { getEffectiveApiKey } from "../base/tomtomClient";
3737import { logger } from "../../utils/logger" ;
3838import buffer from "@turf/buffer" ;
3939import type { Polygon , Position } from "geojson" ;
40- import { TomTomConfig } from "@tomtom-org/maps-sdk/core" ;
4140import type { BBox , Language , Places , POICategory , Routes } from "@tomtom-org/maps-sdk/core" ;
4241
4342// Options shared by multiple search functions
@@ -428,11 +427,10 @@ export async function searchEVStations(params: EVSearchParams): Promise<Places>
428427 // Enrich with real-time availability if requested
429428 if ( params . includeAvailability !== false && filteredResult . features ?. length > 0 ) {
430429 try {
431- // getPlacesWithEVAvailability takes no key argument — it reads the API key
432- // from the SDK global config, which the per-call search() path never set,
433- // so the availability requests went out unauthenticated and were dropped.
434- TomTomConfig . instance . put ( { apiKey } ) ;
435- const enriched = await getPlacesWithEVAvailability ( filteredResult ) ;
430+ // Forward the API key to the per-station availability requests. Since SDK
431+ // 0.49.0 (maps-sdk-js#1888) this helper accepts common service params;
432+ // otherwise it reads the key from global config, which we never set.
433+ const enriched = await getPlacesWithEVAvailability ( filteredResult , { apiKey } ) ;
436434 logger . debug (
437435 { stationCount : enriched . features ?. length } ,
438436 "EV availability enrichment successful"
0 commit comments