Repository navigation
Conversation
The loader shim is opt-in per sample (loaderShim flag): it replaces callback=initMap rather than extending it.
InfoWindow object form, moveCamera, AdvancedMarkerElement, <wmp-map>, and the importLibrary preload shim. Localities/multisearch/store-locator widget samples load separate SDKs, out of scope.
Rolldown-vite's oxc transform needs jsx explicitly enabled; without it every .tsx app build (react-map-*) fails.
maps-js PR #1580 lets InfoWindow.open() take an AdvancedMarkerElement anchor directly. Drops the position-snapshot workaround.
AdvancedMarkerElement content attached via map:/setMap() lands in the map's marker pane inside wmp-map's shadow root, not light DOM. Slotting only applies to markers declared as wmp-map children in markup.
maps-js's AdvancedMarkerElement content now stays in light DOM even for programmatic markers on a shadow-rooted map, so style.scss's .popover rules reach it directly again.
setOptions() only moves the camera at construction; on the already-built map every sample grabs via .innerMap, it silently did nothing.
Flat teardrop icons render natively; labeled markers drop their manual span-positioning code for glyphText.
wgsadmin
left a comment
There was a problem hiding this comment.
Found three issues in the migration.
- Blocker: The
Testworkflow fails because the checked-in type dependency does not expose the API used throughout this PR. Representative output:samples/add-map/index.ts(6,21): error TS2339: Property 'importLibrary' does not exist on type 'typeof map'.The same run reports 280 errors coveringMapElement,moveCamera,marker, and the newInfoWindow.openform. - Blocker: The loader no longer requests the
widgetsbundle, ande2efails both indoor widget samples withTypeError: woosmap.map.IndoorWidget is not a constructor. The navigation widget has the same latent load path. - Should fix: The external-layer style selector constructs a second map using
<wmp-map>itself as the container instead of updating the component's existinginnerMap.
The failing workflows are Test (run 39387030521) and e2e (run 39387030574).
|
|
||
| function initMap(): void { | ||
| async function initMap(): Promise<void> { | ||
| await woosmap.map.importLibrary("maps"); |
There was a problem hiding this comment.
Blocker: This first new API call illustrates the repo-wide type-check failure: the current @types/woosmap.map declarations do not include importLibrary, MapElement, moveCamera, the marker namespace, or the object-form InfoWindow.open. The Test workflow stops with 280 TypeScript errors, so every migrated sample currently fails the required compile check. Please make matching declarations available to tsc (for example, update/pin a released types package or add the necessary local declarations) and refresh the lockfile.
There was a problem hiding this comment.
Fixed in 97a7d80: bumped to @types/woosmap.map 1.4.28, which ships importLibrary, MapElement, moveCamera, the marker namespace and the object-form InfoWindow.open. test passes now.
| maps[L] = (name, ...args) => | ||
| libs.add(name) && load().then(() => maps[L](name, ...args)); | ||
| } | ||
| })({ key: "{{ WOOSMAP_PUBLIC_API_KEY }}" }); |
There was a problem hiding this comment.
Blocker: The shim drops the sample's existing libraries value. The three indoor widget configs still declare libraries: "widgets", but this loader is invoked with only the key and those samples request only importLibrary("maps"); widgets is not an accepted importLibrary library, so its bundle is never fetched. The e2e job confirms this with woosmap.map.IndoorWidget is not a constructor for both widget samples, and indoor-navigation-widget will reach the same missing bundle later. Please seed/merge the configured libraries into the loader URL, or keep these widget samples on the classic loader path.
There was a problem hiding this comment.
Fixed in e1f40da: the shim now starts from the sample's configured libraries (and forwards language), so the widget samples request libraries=widgets,maps and IndoorWidget is defined.
| function applyStyle(name: string) { | ||
| const styles = STYLE_PRESETS[name] ?? []; | ||
| map = new window.woosmap.map.Map( | ||
| map = new woosmap.map.Map( |
There was a problem hiding this comment.
Should fix: #map is now a <wmp-map>, which already owns its map in a shadow-root container. Constructing another Map on the custom element when the style changes leaves MapElement.innerMap pointing at the original instance and inserts the second renderer into the host's light-DOM/slot structure; the style dropdown can therefore produce an overlaid, non-interactive map rather than replacing the displayed one. Please reuse the innerMap and apply the new styles with map.setOptions(...) instead of constructing a second map.
There was a problem hiding this comment.
Fixed in 9cff871: the style switch now calls innerMap.setOptions({styles}). The layer is still reapplied afterwards since restyling reloads the base style.
Feature moved from woosmap.map.data to woosmap.map.Data in the types.
widgets is not an importLibrary() name, so the indoor widget samples never fetched their bundle.
Mostly any -> real types now that @types/woosmap.map 1.4.28 covers the API.
wgsadmin
left a comment
There was a problem hiding this comment.
Reviewed the latest head against master. The earlier typings, widget-preload, and external-layer issues are addressed.
- Should fix: the three React loaders bypass the new configurable SDK host.
- Consider: two store samples still depend on
setOptions()applying camera fields to an existinginnerMap.
A focused tsc --noEmit --skipLibCheck check passes. GitHub’s latest Test and e2e workflow runs were skipped (the triggering review was a COMMENT), so runtime e2e coverage has not been refreshed for this head.
| params.set("libraries", [...libs].join(",")); | ||
| for (const k in g) params.set(k, g[k]); | ||
| params.set("callback", "woosmap.map." + CB); | ||
| s.src = "https://sdk.woosmap.com/map/map.js?" + params; |
There was a problem hiding this comment.
WOOSMAP_SDK_HOST does not reach this loader: all three React samples still hard-code production here. A site built with the new host override will therefore exercise production for these samples (and can fail when testing an API not yet on prod), while every layout-driven sample uses the configured host. Could we pass the generated host into installLoaderShim (for example through VITE_WOOSMAP_SDK_HOST) and apply the same change in the other two React samples?
There was a problem hiding this comment.
Fixed in a8724d8: the build now emits VITE_WOOSMAP_SDK_HOST and the your-api-key transform swaps the hard-coded host in all three React samples.
| await woosmap.map.importLibrary("marker"); | ||
|
|
||
| map = (document.getElementById("map") as woosmap.map.MapElement).innerMap; | ||
| map.setOptions(mapOptions); |
There was a problem hiding this comment.
🟡 mapOptions still includes center and zoom, so this line depends on maps-js #1582 to move the existing innerMap camera—the behavior the rest of this PR explicitly avoids. With a configurable host serving a MapElement-capable build from before #1582, this sample stays at the component defaults; stores-search has the same remaining call. Could we pass only non-camera options to setOptions() and call moveCamera() with the camera fields in both samples?
There was a problem hiding this comment.
Fixed in 8578f38: center/zoom dropped from mapOptions; both stores-list-sync-map and stores-search now set the camera with moveCamera().
Brings the maps-js samples in line with the current API:
<wmp-map>,AdvancedMarkerElement/PinElement, the InfoWindow object form with a marker passed straight in as the anchor, andmoveCamera(). Samples that load other SDKs (localities, multisearch, store-locator widget) are out of scope.importLibraryloader shim (loaderShimflag), which replacescallback=initMap.setOptions()only moved the camera when the map was built, and every sample works on the existing map through.innerMap, so camera changes silently did nothing. Those calls now usemoveCamera(). maps-js #1582 also makessetOptions()move the camera on an existing map, but the samples no longer rely on it.PinElementinstead of raster images, and labelled ones useglyphTextinstead of hand-positioned spans.react-map-*builds fail.@types/woosmap.map1.4.28, which ships the new API surface.woosmap.map.data.Featureis nowwoosmap.map.Data.Feature.librariesandlanguageto the script URL.widgetsis not animportLibrary()name, so the indoor widget samples never loaded their bundle.anyfor the real types from 1.4.28.dist/is left to the release bot.