@minmaps-dev/mm-web-sdk 1.0.0-rc.22 → 1.0.0-rc.24

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
  /**
@@ -241,13 +341,26 @@ interface SDKOptions {
241
341
  */
242
342
  minZoomBelowInitialFit?: number;
243
343
  /**
244
- * If set, the SDK recolours every amenity SVG to this colour as it
245
- * registers the icon (visible fills + strokes; `none` / `transparent` are
246
- * preserved). Pair with a theme circle badge layer so amenities read as
247
- * polished icon-on-badge — e.g. `#ffffff` icons on the gold `poi-amenity-
248
- * badge` layer in the bundled hybrid theme. Omit to keep the CMS colours.
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.
249
350
  */
250
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;
251
364
  styleMode?: 'venueStyleUrl' | 'sdkTemplate';
252
365
  templateOverrideMode?: 'colorsOnly' | 'colorsAndConstants' | 'all';
253
366
  }
@@ -300,25 +413,6 @@ type SDKConfig = {
300
413
  options?: SDKOptions;
301
414
  };
302
415
 
303
- /** How to center the map after computing a route */
304
- type WayfindCenterMode = 'none' | 'destination' | 'route';
305
- /**
306
- * Per-call routing preferences forwarded to the wayfinding provider.
307
- *
308
- * - `accessible` — prefer accessible paths; providers should drop or heavily
309
- * penalize edges marked inaccessible (stairs by default, anything else
310
- * the provider's data flags).
311
- * - `avoidStairs` — hard-filter stairs from the graph.
312
- *
313
- * The bundled stub provider doesn't compute routes; consumers wire a real
314
- * provider (see `mm-web-sdk-example/lib/wayfinding`) that reads these
315
- * flags when building edge weights.
316
- */
317
- type RoutingOptions = {
318
- accessible?: boolean;
319
- avoidStairs?: boolean;
320
- };
321
-
322
416
  type LoggerFn = (...args: unknown[]) => void;
323
417
  type AmenityManagerDeps = {
324
418
  getVenue: () => any;
@@ -379,6 +473,7 @@ declare class MinuteMaps {
379
473
  private amenityManager;
380
474
  private wayfinding;
381
475
  private highlightManager;
476
+ private youAreHerePulse;
382
477
  /** Categorical POI layers in the bundled theme that `setPOIFilter`
383
478
  * toggles. Layers absent from this list — `poi-you-are-here-*`, the
384
479
  * `poi-accessibility-icons` badge, and the `poi-highlight-*` layers —
@@ -476,6 +571,45 @@ declare class MinuteMaps {
476
571
  * cone rendered next to the "You are here" marker.
477
572
  */
478
573
  getKioskHeading(): number | null;
574
+ /**
575
+ * Display name of the JACS device the kiosk is anchored to (e.g.
576
+ * "Main Lobby Kiosk", "Information Desk Kiosk"). `null` when the venue
577
+ * has no kiosk anchor or the device record carries no `name`.
578
+ *
579
+ * Distinct from `getYouAreHerePOI()?.name`, which is always the
580
+ * literal "You are here" label rendered on the map. Use this for chrome
581
+ * that needs the kiosk's identity — e.g. the directions overlay's
582
+ * "From <kiosk>" header.
583
+ */
584
+ getKioskName(): string | null;
585
+ /**
586
+ * Distance + walking time from the kiosk's anchor waypoint to a target,
587
+ * computed over the JACS path graph (the same graph the routing engine
588
+ * uses). Designed for "Closest: 30 sec walk" subtitles in the consumer
589
+ * UI — no second graph build, no second Dijkstra implementation.
590
+ *
591
+ * Accepts a raw waypoint id, an amenity / destination object (the first
592
+ * entry of its `waypoints` array is treated as the entry point), or any
593
+ * `{ id, mapId? }` shape. Returns `null` when the kiosk isn't anchored,
594
+ * the target waypoint isn't on the graph, or no path resolves.
595
+ *
596
+ * Walking speed defaults to 1.2 m/s (indoor wayfinding norm). Pass
597
+ * `walkingSpeedMps` to estimate for accessibility (e.g. 0.9).
598
+ */
599
+ getWalkTimeFromKiosk(target: number | string | {
600
+ id?: number | string;
601
+ mapId?: number;
602
+ } | {
603
+ waypoints?: Array<number | string | {
604
+ id?: number | string;
605
+ }>;
606
+ }, opts?: {
607
+ walkingSpeedMps?: number;
608
+ }): {
609
+ meters: number;
610
+ seconds: number;
611
+ pathNodeCount: number;
612
+ } | null;
479
613
  /**
480
614
  * Center the camera on the kiosk's "You are here" position. Use this
481
615
  * (not `resetView`) for a chrome "Recenter" button — `resetView` snaps
@@ -524,6 +658,30 @@ declare class MinuteMaps {
524
658
  accessible?: boolean;
525
659
  avoidStairs?: boolean;
526
660
  }): Promise<any>;
661
+ /** Build the landmark / floor-name context the directions module needs.
662
+ * Pulled out so `setLocale()` or `setActiveStep()` can rebuild it on
663
+ * demand if we ever surface a locale-aware variant. */
664
+ private buildDirectionsContext;
665
+ /**
666
+ * Drive the turn-by-turn UI. Two effects:
667
+ *
668
+ * 1. When the step's `floorId` differs from the active floor, switch
669
+ * floors so the segment for the step's leg becomes visible.
670
+ * 2. Highlight the step's slice of the route line by writing the
671
+ * point range to the `route-active-step` source; the bundled
672
+ * theme's `route-line-active` layer paints it in gold over the
673
+ * muted base route.
674
+ *
675
+ * Transition steps (cross-floor elevator / stair hops) clear the
676
+ * highlight — the overlay text carries the action, and there's no
677
+ * meaningful on-floor segment to paint.
678
+ *
679
+ * Pass `null` to clear the highlight without changing the floor or
680
+ * tearing down the route.
681
+ */
682
+ setActiveStep(step: WayfindStep | null): Promise<void>;
683
+ private writeActiveStepHighlight;
684
+ private clearActiveStepHighlight;
527
685
  clearRoute(): void;
528
686
  /**
529
687
  * Highlight a single POI on the map — a pulsing ring — and bring it into
@@ -555,6 +713,28 @@ declare class MinuteMaps {
555
713
  * single-venue scale, and avoids a turf dependency on the hot path.
556
714
  */
557
715
  findClosestWaypoint(waypoints: Waypoint[], from?: [number, number]): Waypoint | null;
716
+ /**
717
+ * Route from the kiosk to the closest physical instance of an amenity.
718
+ * Resolves the amenity venue-wide, picks the instance with the smallest
719
+ * path-graph walk time from the kiosk (falling back to planar Euclidean
720
+ * when the walk-time graph can't resolve any waypoint), switches the
721
+ * active floor if needed, and routes via the same plumbing as
722
+ * `navigateFromKioskToPOI` — so step-by-step directions, the
723
+ * `routeReady` event, and the active-floor camera fit all "just work."
724
+ *
725
+ * Pass `accessible` / `avoidStairs` to weight the *route* (the SDK's
726
+ * routing engine reads these per call). Note: closest-instance picking
727
+ * itself is currently distance-based and does not yet honor those
728
+ * weights — the underlying walk-time graph applies pixel-length only.
729
+ * In practice this matters when an amenity has multiple instances and
730
+ * the geometrically closest is reachable only via stairs; the picked
731
+ * instance won't change today, but the *route* to it will avoid stairs
732
+ * (or fail gracefully) if `accessible`/`avoidStairs` is set.
733
+ */
734
+ navigateFromKioskToClosestAmenity(amenityId: string | number, options?: {
735
+ accessible?: boolean;
736
+ avoidStairs?: boolean;
737
+ }): Promise<any>;
558
738
  /**
559
739
  * Highlight + center on the closest physical instance of an amenity.
560
740
  * The amenity is resolved against `amenities.getDistinct()` (venue-wide,
@@ -575,6 +755,23 @@ declare class MinuteMaps {
575
755
  getMap(): Map | null;
576
756
  destroy(): void;
577
757
  setCurrentFloor(floor: Floor): Promise<void>;
758
+ /**
759
+ * Filter the route-line / route-halo layers to only render segments
760
+ * whose `floorId` matches the active floor (or features that carry no
761
+ * `floorId` at all — the straight-line fallback, which we want visible
762
+ * on every floor since it has no floor membership to filter against).
763
+ *
764
+ * Features are tagged with the JACS pixel `mapId` (that's what flows
765
+ * through the route point's `mapId`), so the filter compares against
766
+ * the active floor's `mapId`, NOT its `id` — those are two different
767
+ * JACS identifiers (`floor.id` is the building-floor record; `mapId`
768
+ * is the SVG asset). We accept the floor's `id` here for convenience
769
+ * and resolve to `mapId` via `getFloors()`.
770
+ *
771
+ * Applied imperatively rather than baked into the theme JSON so the
772
+ * filter tracks runtime floor changes without restyling the map.
773
+ */
774
+ private updateRouteFloorFilter;
578
775
  isReady(): boolean;
579
776
  private setFloorLayerVisibility;
580
777
  private getBoundsPadding;
@@ -603,4 +800,4 @@ declare class MinuteMaps {
603
800
  declare function createMinuteMapsSDK(config: SDKConfig): MinuteMaps;
604
801
 
605
802
  export { MinuteMaps, createMinuteMapsSDK };
606
- 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 };
803
+ 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 };