@minmaps-dev/mm-web-sdk 1.0.0-rc.22 → 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
  /**
@@ -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,34 @@ declare class MinuteMaps {
476
571
  * cone rendered next to the "You are here" marker.
477
572
  */
478
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;
479
602
  /**
480
603
  * Center the camera on the kiosk's "You are here" position. Use this
481
604
  * (not `resetView`) for a chrome "Recenter" button — `resetView` snaps
@@ -524,6 +647,30 @@ declare class MinuteMaps {
524
647
  accessible?: boolean;
525
648
  avoidStairs?: boolean;
526
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;
527
674
  clearRoute(): void;
528
675
  /**
529
676
  * Highlight a single POI on the map — a pulsing ring — and bring it into
@@ -575,6 +722,23 @@ declare class MinuteMaps {
575
722
  getMap(): Map | null;
576
723
  destroy(): void;
577
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;
578
742
  isReady(): boolean;
579
743
  private setFloorLayerVisibility;
580
744
  private getBoundsPadding;
@@ -603,4 +767,4 @@ declare class MinuteMaps {
603
767
  declare function createMinuteMapsSDK(config: SDKConfig): MinuteMaps;
604
768
 
605
769
  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 };
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 };