@minmaps-dev/mm-web-sdk 1.0.0-rc.20 → 1.0.0-rc.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -166,6 +166,83 @@ type ViewOptions = {
166
166
  /** SW/NE bounding box */
167
167
  type Bounds = [[number, number], [number, number]];
168
168
 
169
+ /** How to center the map after computing a route */
170
+ type WayfindCenterMode = 'none' | 'destination' | 'route';
171
+ /**
172
+ * Per-call routing preferences forwarded to the wayfinding provider.
173
+ *
174
+ * - `accessible` — prefer accessible paths; providers should drop or heavily
175
+ * penalize edges marked inaccessible (stairs by default, anything else
176
+ * the provider's data flags).
177
+ * - `avoidStairs` — hard-filter stairs from the graph.
178
+ *
179
+ * The bundled stub provider doesn't compute routes; consumers wire a real
180
+ * provider (see `mm-web-sdk-example/lib/wayfinding`) that reads these
181
+ * flags when building edge weights.
182
+ */
183
+ type RoutingOptions = {
184
+ accessible?: boolean;
185
+ avoidStairs?: boolean;
186
+ };
187
+
188
+ /**
189
+ * A single point along the rendered route. `mapId` lets the renderer
190
+ * split the polyline by floor (so other-floor segments don't paint
191
+ * through the visible floor's geometry); `waypointId` and `pathTypeId`
192
+ * let downstream layers (text-directions, step UI) classify
193
+ * transitions — e.g. "Take the elevator" vs "Walk straight". The two
194
+ * endpoint points are the kiosk and destination anchors (`isEndpoint`
195
+ * marks them so they can render endpoint pins). All fields except
196
+ * `coordinates` are optional for backward-compat with the straight-line
197
+ * fallback.
198
+ */
199
+ type RoutePoint = {
200
+ coordinates: [number, number];
201
+ /** Floor mapId this point sits on. Missing on the straight-line fallback. */
202
+ mapId?: number;
203
+ /** JACS waypoint id this point resolved to, if any. */
204
+ waypointId?: number;
205
+ /** Path type of the edge that LEADS INTO this point (i.e. the edge
206
+ * whose `toKey` is this node). Used to detect elevator / stair /
207
+ * escalator transitions. Missing on the start point and on the
208
+ * straight-line fallback. */
209
+ pathTypeId?: number;
210
+ /** True for the snapped kiosk + destination anchors. */
211
+ isEndpoint?: boolean;
212
+ };
213
+
214
+ type WayfindStep = DepartStep | TurnStep | ContinueStep | TransitionStep | ArriveStep;
215
+ type StepBase = {
216
+ /** Indices into the input `points` array that this step spans. */
217
+ pointRange: [startInclusive: number, endInclusive: number];
218
+ /** Floor this step is on. `null` for cross-floor transitions. */
219
+ floorId: number | null;
220
+ /** Localized instruction text. */
221
+ text: string;
222
+ /** Total walking distance within this step, in meters (rounded). */
223
+ distanceMeters?: number;
224
+ /** Landmark name used for anchoring, if any. */
225
+ landmark?: string;
226
+ };
227
+ type DepartStep = StepBase & {
228
+ type: 'depart';
229
+ };
230
+ type TurnStep = StepBase & {
231
+ type: 'turn-left' | 'turn-right' | 'u-turn';
232
+ };
233
+ type ContinueStep = StepBase & {
234
+ type: 'continue';
235
+ };
236
+ type TransitionStep = StepBase & {
237
+ type: 'transition';
238
+ transition: 'elevator' | 'stairs' | 'escalator';
239
+ fromFloorId: number | null;
240
+ toFloorId: number | null;
241
+ };
242
+ type ArriveStep = StepBase & {
243
+ type: 'arrive';
244
+ };
245
+
169
246
  interface MapEvent {
170
247
  floor?: Floor;
171
248
  poi?: POI;
@@ -178,6 +255,16 @@ interface MapEvent {
178
255
  /** Emitted by `localeChanged` after `setLocale()` finishes patching the
179
256
  * venue model. BCP-47 code (`'en'`, `'es'`, `'es-MX'`). */
180
257
  locale?: string;
258
+ /** Emitted by `routeReady` after a successful `navigateFromKioskToPOI`.
259
+ * Carries the raw geometry (`points`) and the human-readable
260
+ * step-by-step directions. Subscribe to drive a turn-by-turn UI. */
261
+ route?: {
262
+ points: RoutePoint[];
263
+ steps: WayfindStep[];
264
+ /** Floor mapId of each segment, in render order. `null` for
265
+ * segments emitted by the straight-line fallback. */
266
+ floorIds: Array<number | null>;
267
+ };
181
268
  }
182
269
  type EventCallback = (event: MapEvent) => void;
183
270
 
@@ -200,6 +287,19 @@ type BoundsPadding = number | {
200
287
  * custom themes.
201
288
  */
202
289
  type ThemeName = 'default' | 'high-contrast';
290
+ /**
291
+ * Style of the disc + ring rendered behind each amenity icon. The SDK
292
+ * composites this into the icon bitmap at registration time, so badge +
293
+ * icon participate in symbol collision as one unit.
294
+ */
295
+ type AmenityBadgeStyle = {
296
+ /** Fill colour of the badge disc. Default `'#fdb81e'`. */
297
+ color?: string;
298
+ /** Stroke colour of the ring around the disc. Default `'#FFFFFF'`. */
299
+ ringColor?: string;
300
+ /** Ring width in logical px. Default `2`. */
301
+ ringWidth?: number;
302
+ };
203
303
  interface SDKOptions {
204
304
  debug?: boolean;
205
305
  /**
@@ -221,18 +321,46 @@ interface SDKOptions {
221
321
  wallThickness?: number;
222
322
  boundsPadding?: BoundsPadding;
223
323
  /**
224
- * Pitch (deg) for the opening view. After the initial floor is fit to its
225
- * building footprint, the SDK tilts to this and re-fits so the kiosk opens
226
- * on a tilted building rather than a flat top-down plan. Omit for top-down.
324
+ * Pitch (deg) for the opening view, applied centred on the kiosk ("You
325
+ * are here"). Omit for top-down.
227
326
  */
228
327
  initialPitch?: number;
229
328
  /**
230
- * Clamp zoom-out relative to the initial building fit. When set, the map's
231
- * `minZoom` becomes `(initialFitZoom this)`, so visitors can nudge out by
232
- * this many zoom levels but never pull back to the empty surrounding region.
233
- * `0` locks zoom-out exactly to the fit. Omit for no clamp.
329
+ * Zoom for the opening view, centred on the kiosk. Set this above the
330
+ * theme's unit-walls breakpoint (~16.5 in the bundled hybrid theme) so the
331
+ * kiosk opens on the building's interior floor plan (its contents) rather
332
+ * than a zoomed-out 3D massing outline. Omit to keep the post-floor-fit
333
+ * zoom.
334
+ */
335
+ initialZoom?: number;
336
+ /**
337
+ * Clamp zoom-out relative to the opening view. When set, the map's
338
+ * `minZoom` becomes `(initialZoom − this)`, so visitors can nudge out by
339
+ * this many zoom levels but never pull back below the interior into the
340
+ * massing/region. `0` locks zoom-out exactly to the opening view.
234
341
  */
235
342
  minZoomBelowInitialFit?: number;
343
+ /**
344
+ * Override the colour the SDK recolours every amenity SVG to before it
345
+ * composites the badge. `none` / `transparent` fills are preserved so
346
+ * cut-outs stay. When the badge is enabled (the default), this defaults
347
+ * to navy (`#162e51`) so icons read on gold. Set explicitly for a
348
+ * different look, or set `amenityBadge: false` to disable recolouring
349
+ * altogether and keep the CMS-uploaded colours.
350
+ */
351
+ amenityIconColor?: string;
352
+ /**
353
+ * Badge composited behind each amenity icon. Pass `false` to render the
354
+ * icon alone (no badge — useful for high-contrast or 2D themes where the
355
+ * gold disc would compete with the floor). Pass an object to tune the
356
+ * disc / ring style. Defaults to a VA-gold disc with a 2px white ring.
357
+ *
358
+ * The badge is baked into the icon bitmap (canvas composite) rather than
359
+ * drawn as a separate circle layer, so badge + icon participate in symbol
360
+ * collision together — overlapping amenities hide as one unit instead of
361
+ * the icon hiding while the disc stays painted.
362
+ */
363
+ amenityBadge?: AmenityBadgeStyle | false;
236
364
  styleMode?: 'venueStyleUrl' | 'sdkTemplate';
237
365
  templateOverrideMode?: 'colorsOnly' | 'colorsAndConstants' | 'all';
238
366
  }
@@ -285,25 +413,6 @@ type SDKConfig = {
285
413
  options?: SDKOptions;
286
414
  };
287
415
 
288
- /** How to center the map after computing a route */
289
- type WayfindCenterMode = 'none' | 'destination' | 'route';
290
- /**
291
- * Per-call routing preferences forwarded to the wayfinding provider.
292
- *
293
- * - `accessible` — prefer accessible paths; providers should drop or heavily
294
- * penalize edges marked inaccessible (stairs by default, anything else
295
- * the provider's data flags).
296
- * - `avoidStairs` — hard-filter stairs from the graph.
297
- *
298
- * The bundled stub provider doesn't compute routes; consumers wire a real
299
- * provider (see `mm-web-sdk-example/lib/wayfinding`) that reads these
300
- * flags when building edge weights.
301
- */
302
- type RoutingOptions = {
303
- accessible?: boolean;
304
- avoidStairs?: boolean;
305
- };
306
-
307
416
  type LoggerFn = (...args: unknown[]) => void;
308
417
  type AmenityManagerDeps = {
309
418
  getVenue: () => any;
@@ -364,6 +473,7 @@ declare class MinuteMaps {
364
473
  private amenityManager;
365
474
  private wayfinding;
366
475
  private highlightManager;
476
+ private youAreHerePulse;
367
477
  /** Categorical POI layers in the bundled theme that `setPOIFilter`
368
478
  * toggles. Layers absent from this list — `poi-you-are-here-*`, the
369
479
  * `poi-accessibility-icons` badge, and the `poi-highlight-*` layers —
@@ -461,6 +571,34 @@ declare class MinuteMaps {
461
571
  * cone rendered next to the "You are here" marker.
462
572
  */
463
573
  getKioskHeading(): number | null;
574
+ /**
575
+ * Distance + walking time from the kiosk's anchor waypoint to a target,
576
+ * computed over the JACS path graph (the same graph the routing engine
577
+ * uses). Designed for "Closest: 30 sec walk" subtitles in the consumer
578
+ * UI — no second graph build, no second Dijkstra implementation.
579
+ *
580
+ * Accepts a raw waypoint id, an amenity / destination object (the first
581
+ * entry of its `waypoints` array is treated as the entry point), or any
582
+ * `{ id, mapId? }` shape. Returns `null` when the kiosk isn't anchored,
583
+ * the target waypoint isn't on the graph, or no path resolves.
584
+ *
585
+ * Walking speed defaults to 1.2 m/s (indoor wayfinding norm). Pass
586
+ * `walkingSpeedMps` to estimate for accessibility (e.g. 0.9).
587
+ */
588
+ getWalkTimeFromKiosk(target: number | string | {
589
+ id?: number | string;
590
+ mapId?: number;
591
+ } | {
592
+ waypoints?: Array<number | string | {
593
+ id?: number | string;
594
+ }>;
595
+ }, opts?: {
596
+ walkingSpeedMps?: number;
597
+ }): {
598
+ meters: number;
599
+ seconds: number;
600
+ pathNodeCount: number;
601
+ } | null;
464
602
  /**
465
603
  * Center the camera on the kiosk's "You are here" position. Use this
466
604
  * (not `resetView`) for a chrome "Recenter" button — `resetView` snaps
@@ -509,6 +647,30 @@ declare class MinuteMaps {
509
647
  accessible?: boolean;
510
648
  avoidStairs?: boolean;
511
649
  }): Promise<any>;
650
+ /** Build the landmark / floor-name context the directions module needs.
651
+ * Pulled out so `setLocale()` or `setActiveStep()` can rebuild it on
652
+ * demand if we ever surface a locale-aware variant. */
653
+ private buildDirectionsContext;
654
+ /**
655
+ * Drive the turn-by-turn UI. Two effects:
656
+ *
657
+ * 1. When the step's `floorId` differs from the active floor, switch
658
+ * floors so the segment for the step's leg becomes visible.
659
+ * 2. Highlight the step's slice of the route line by writing the
660
+ * point range to the `route-active-step` source; the bundled
661
+ * theme's `route-line-active` layer paints it in gold over the
662
+ * muted base route.
663
+ *
664
+ * Transition steps (cross-floor elevator / stair hops) clear the
665
+ * highlight — the overlay text carries the action, and there's no
666
+ * meaningful on-floor segment to paint.
667
+ *
668
+ * Pass `null` to clear the highlight without changing the floor or
669
+ * tearing down the route.
670
+ */
671
+ setActiveStep(step: WayfindStep | null): Promise<void>;
672
+ private writeActiveStepHighlight;
673
+ private clearActiveStepHighlight;
512
674
  clearRoute(): void;
513
675
  /**
514
676
  * Highlight a single POI on the map — a pulsing ring — and bring it into
@@ -560,6 +722,23 @@ declare class MinuteMaps {
560
722
  getMap(): Map | null;
561
723
  destroy(): void;
562
724
  setCurrentFloor(floor: Floor): Promise<void>;
725
+ /**
726
+ * Filter the route-line / route-halo layers to only render segments
727
+ * whose `floorId` matches the active floor (or features that carry no
728
+ * `floorId` at all — the straight-line fallback, which we want visible
729
+ * on every floor since it has no floor membership to filter against).
730
+ *
731
+ * Features are tagged with the JACS pixel `mapId` (that's what flows
732
+ * through the route point's `mapId`), so the filter compares against
733
+ * the active floor's `mapId`, NOT its `id` — those are two different
734
+ * JACS identifiers (`floor.id` is the building-floor record; `mapId`
735
+ * is the SVG asset). We accept the floor's `id` here for convenience
736
+ * and resolve to `mapId` via `getFloors()`.
737
+ *
738
+ * Applied imperatively rather than baked into the theme JSON so the
739
+ * filter tracks runtime floor changes without restyling the map.
740
+ */
741
+ private updateRouteFloorFilter;
563
742
  isReady(): boolean;
564
743
  private setFloorLayerVisibility;
565
744
  private getBoundsPadding;
@@ -588,4 +767,4 @@ declare class MinuteMaps {
588
767
  declare function createMinuteMapsSDK(config: SDKConfig): MinuteMaps;
589
768
 
590
769
  export { MinuteMaps, createMinuteMapsSDK };
591
- export type { Amenity, AmenityWithFloor, Bounds, BoundsPadding, CameraState, Destination, EventCallback, Floor, FloorMetadata, JMapAuth, JMapConfig, JacsAuth, JacsConfig, MapEvent, POI, POISearchResult, RoutingOptions, SDKConfig, SDKOptions, ThemeName, ViewOptions, WayfindCenterMode, Waypoint };
770
+ export type { Amenity, AmenityBadgeStyle, AmenityWithFloor, Bounds, BoundsPadding, CameraState, Destination, EventCallback, Floor, FloorMetadata, JMapAuth, JMapConfig, JacsAuth, JacsConfig, MapEvent, POI, POISearchResult, RoutePoint, RoutingOptions, SDKConfig, SDKOptions, ThemeName, ViewOptions, WayfindCenterMode, WayfindStep, Waypoint };