@minmaps-dev/mm-web-sdk 1.0.0-rc.5 → 1.0.0-rc.50

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/react.d.ts CHANGED
@@ -1,14 +1,336 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
+ interface POI {
4
+ /** Unique identifier */
5
+ id: string | number;
6
+ /** POI type */
7
+ type: 'amenity' | 'destination' | 'kiosk';
8
+ /** Display name */
9
+ name: string;
10
+ /** Geographic coordinates [longitude, latitude] */
11
+ coordinates: [number, number];
12
+ /** Icon identifier for rendering */
13
+ iconId?: string;
14
+ /** Whether this POI should render its label */
15
+ showLabel?: boolean;
16
+ /** Floor this POI belongs to */
17
+ floorId: string | number;
18
+ /** Category/type of amenity (e.g., 'restroom', 'elevator') */
19
+ amenityType?: string;
20
+ /** Locale-stable classification text (name + type + keywords, frozen at
21
+ * load before any locale patch can translate them). Copied from the
22
+ * source `Amenity.classifyText`; used by `amenityCategoryFor`/rank
23
+ * instead of the live, possibly-translated fields. See `Amenity.classifyText`. */
24
+ classifyText?: string;
25
+ /** Which amenity icon layer this POI renders in — `'connector'`,
26
+ * `'entrance'`, `'parking'`, `'bus'`, `'information'` or `'other'`.
27
+ * Derived from the amenity's connector flag, name, type and keywords;
28
+ * emitted as the `amenityCategory` feature property the theme filters on.
29
+ * Amenities only. See `amenityCategoryFor`. */
30
+ amenityCategory?: 'connector' | 'entrance' | 'parking' | 'bus' | 'information' | 'other';
31
+ /** Search keywords */
32
+ keywords?: string[];
33
+ /** Additional properties */
34
+ properties?: Record<string, unknown>;
35
+ /** JMap waypoint ID that this POI instance is bound to */
36
+ waypointId?: string | number;
37
+ /** Full waypoint object for this POI instance */
38
+ waypoint?: Waypoint;
39
+ /** Marks this POI as the "You are here" kiosk */
40
+ isYouAreHere?: boolean;
41
+ /** For kiosk POIs only: compass heading the device physically faces, in
42
+ * degrees clockwise from north. Sourced from JACS `Device.heading`. */
43
+ heading?: number | null;
44
+ /** Per-instance name for this specific placement of an amenity (e.g.
45
+ * "Parking Lot A" for a "Parking" amenity), resolved from the waypoint's
46
+ * `amenityAssociations`. Distinct from `name`, which is the amenity's
47
+ * type-level name shared by every instance — see `Amenity.name`. Amenities
48
+ * only, and only set when JACS actually returned an instance name. */
49
+ instanceName?: string;
50
+ }
51
+ /**
52
+ * Waypoint - a specific point location
53
+ */
54
+ interface Waypoint {
55
+ /** Geographic coordinates [longitude, latitude] */
56
+ coordinates: number[];
57
+ /** Associated map ID */
58
+ mapId: string | number;
59
+ /** Associated floor ID */
60
+ floorId?: string | number;
61
+ /** Whether this is the primary/default waypoint */
62
+ isPrimary?: boolean;
63
+ /** CMS zone (department) this waypoint belongs to, if any. The only backend
64
+ * link between a location and its department — read at runtime across the
65
+ * data provider (see the package CLAUDE.md zone landmine). */
66
+ zoneId?: string | number;
67
+ /** Per-instance names JACS attaches to this waypoint's amenities (e.g. a
68
+ * "Parking" amenity placed twice as "Parking Lot A" / "Parking Lot B").
69
+ * `id` matches an `Amenity.id`, not this waypoint — a waypoint can carry
70
+ * more than one amenity, so a consumer must find the entry for the
71
+ * specific amenity it's rendering rather than assuming index 0. */
72
+ amenityAssociations?: Array<{
73
+ id: string | number;
74
+ name: string;
75
+ }>;
76
+ }
77
+
78
+ /** SW/NE bounding box */
79
+ type Bounds = [[number, number], [number, number]];
80
+
81
+ /**
82
+ * Padding kept clear inside the viewport when the SDK frames bounds —
83
+ * the initial venue/floor fit and the wayfinding route fit. A plain
84
+ * number pads all sides equally; the object form lets a kiosk reserve
85
+ * space for fixed UI overlays (header, dock, side rails) so framed
86
+ * content is never hidden behind them.
87
+ */
88
+ type BoundsPadding = number | {
89
+ top: number;
90
+ bottom: number;
91
+ left: number;
92
+ right: number;
93
+ };
94
+ /**
95
+ * Built-in theme names accepted by `MinuteMaps.setTheme()` and the
96
+ * `options.theme` init option. Pass a `StyleSpecification` directly for
97
+ * custom themes.
98
+ */
99
+ type ThemeName = 'default' | 'high-contrast' | 'color-blind';
100
+ /**
101
+ * Style of the disc + ring rendered behind each amenity icon. The SDK
102
+ * composites this into the icon bitmap at registration time, so badge +
103
+ * icon participate in symbol collision as one unit.
104
+ */
105
+ type AmenityBadgeStyle = {
106
+ /** Fill colour of the badge disc. Default `'#fdb81e'`. */
107
+ color?: string;
108
+ /** Stroke colour of the ring around the disc. Default `'#FFFFFF'`. */
109
+ ringColor?: string;
110
+ /** Ring width in logical px. Default `2`. */
111
+ ringWidth?: number;
112
+ /** Extra inset between the icon and the badge's inner edge, in logical px
113
+ * (applied on all sides). Default `0` — the icon fills ~85% of the disc
114
+ * as before. Raise this if an icon's own artwork reaches close to its
115
+ * viewBox edges and ends up touching the ring. */
116
+ padding?: number;
117
+ };
3
118
  interface SDKOptions {
4
119
  debug?: boolean;
5
- theme?: 'light' | 'dark' | 'hybrid' | any;
120
+ /**
121
+ * `window` key the SDK instance is published under while `debug` is on, so
122
+ * a running kiosk can be driven from devtools (`mm.debug.hide('labels')`,
123
+ * `mm.getMap()`). Defaults to `'mm'`. Pass another name to avoid a clash,
124
+ * or `false` to publish nothing even in debug mode. Ignored entirely when
125
+ * `debug` is off.
126
+ */
127
+ debugGlobal?: string | false;
128
+ /**
129
+ * Initial theme. `'default'` uses the bundled hybrid 3D theme.
130
+ * `'high-contrast'` uses the WCAG-AA tuned theme. `'color-blind'` keeps the
131
+ * default look but swaps the colors that red-green and blue-yellow color
132
+ * blindness merge (the route, room categories and department zones,
133
+ * restrooms, parks). Pass a
134
+ * `StyleSpecification` for fully custom styling.
135
+ */
136
+ theme?: ThemeName | any;
137
+ /**
138
+ * When true, the SDK skips animations on imperative camera calls
139
+ * (wayfinding fits, `setView`, idle re-frames). Consumers should
140
+ * mirror their app's `prefers-reduced-motion` state into this.
141
+ */
142
+ reducedMotion?: boolean;
143
+ /**
144
+ * Whether a freshly computed route auto-highlights its first step's
145
+ * segment (the brighter `route-line-active` overlay). Defaults to
146
+ * `true`, preserving the turn-by-turn segment highlight that
147
+ * `setActiveStep` drives.
148
+ *
149
+ * Set `false` for kiosk-style "show the whole route at once" UIs:
150
+ * the entire route line is shown without singling out one segment,
151
+ * which reads more clearly at a glance and avoids implying the visitor
152
+ * must step through the route. `setActiveStep` still works when called
153
+ * explicitly (e.g. a paginated QR-handoff / mobile flow) — this only
154
+ * controls the automatic highlight on `routeReady`.
155
+ */
156
+ routeStepHighlight?: boolean;
157
+ /**
158
+ * Whether restroom pins that are too close together to draw individually
159
+ * collapse into a single Material `wc` badge. Defaults to `true`.
160
+ *
161
+ * Venues author men's and women's restrooms as two amenities a few metres
162
+ * apart. Both are wayfinding-critical (rank 0) and both draw on a layer that
163
+ * doesn't allow icon overlap, so without this MapLibre resolves the collision
164
+ * by hiding one of them outright until the camera is very close in. Grouping
165
+ * shows one badge in their place and hands back *all* the members when it's
166
+ * tapped, so the consumer can offer directions to each.
167
+ *
168
+ * Set `false` to opt out and get the raw collision behaviour back.
169
+ */
170
+ groupRestroomIcons?: boolean;
6
171
  initialFloor?: string | number;
7
172
  enableInteractions?: boolean;
8
173
  customSprite?: string;
9
174
  minIndoorZoom?: number;
175
+ /**
176
+ * How far, in **metres** (default `0.3`, ≈1 ft), extruded interior polygons
177
+ * (restrooms, back-of-house, obstacles, connectors) are inset so their edges
178
+ * don't z-fight the neighbouring room block. A polygon too thin to survive
179
+ * the inset (it would keep under half its area, e.g. a ~0.3 m back-of-house
180
+ * perimeter band) is left at its original size rather than erased. Metres to match the theme's
181
+ * `fill-extrusion-height` values, which MapLibre defines in metres — unlike
182
+ * the distances shown to visitors, which are in feet. Was feet before this
183
+ * option changed units; a value of `1` is now ~3.3× thicker.
184
+ */
10
185
  wallThickness?: number;
11
- boundsPadding?: number;
186
+ /**
187
+ * How much costlier a candidate on a **different floor** from the kiosk is
188
+ * treated when choosing the closest instance of an amenity (default `1.5`).
189
+ * Used by `findClosestByWalkTime`, and so by `navigateFromKioskToClosestAmenity`
190
+ * and `highlightAmenity`.
191
+ *
192
+ * A multiplier on the trip's effort — walk time plus the elevator wait — not
193
+ * a distance: `1.5` means another floor's instance has to be a third cheaper
194
+ * to beat one on the kiosk's floor. It is a *preference* for not making the
195
+ * visitor change floors, layered on top of the physical cost of doing so
196
+ * (which is already in the effort). `1` turns it off and ranks by effort
197
+ * alone; a value below `1` is treated as `1`. It only affects which instance
198
+ * is chosen — never a route.
199
+ *
200
+ * For scale: at the Las Vegas VA the nearest other-floor Lactation Pod costs
201
+ * ~400 ft-equivalent against ~530 for the one on the kiosk's floor, so it
202
+ * takes a value above ~1.32 to keep the visitor on their floor.
203
+ */
204
+ otherFloorPenalty?: number;
205
+ boundsPadding?: BoundsPadding;
206
+ /**
207
+ * Caps how far a visitor can pan/zoom out. By default the SDK derives this
208
+ * from the venue's own bounds, scaled to 3x its width/height around the
209
+ * same center — enough room to pan around the building without drifting
210
+ * into an empty, un-tiled region. The default box is never smaller than
211
+ * ~3.7 km a side, so a small venue isn't forced to zoom in tighter than a
212
+ * large one. Pass a number to use a different
213
+ * multiplier (e.g. `1.5` for a tighter leash), explicit `[[west, south],
214
+ * [east, north]]` bounds to override entirely, or `false` to disable
215
+ * max-bounds clamping.
216
+ */
217
+ maxBounds?: Bounds | number | false;
218
+ /**
219
+ * Hides basemap points of interest (civic and marine icons, park names) that
220
+ * fall within this many metres of the venue's bounds, so an OSM library or
221
+ * chapel on the campus isn't drawn underneath the venue's own map. Defaults
222
+ * to `50`. Street labels, road shields and water labels are never hidden.
223
+ * Pass `false` to show every basemap POI.
224
+ */
225
+ hideBasemapPoisNearVenue?: number | false;
226
+ /**
227
+ * Whether the venue's kiosk anchors a "You are here" marker, and the opening
228
+ * view / default route origin. Defaults to `true`. Set `false` for non-kiosk
229
+ * consumers (e.g. a browser map): no device is resolved, even via the
230
+ * "first placed device" fallback, so the marker is never drawn.
231
+ */
232
+ kiosk?: boolean;
233
+ /**
234
+ * Pitch (deg) for the opening view, applied centred on the kiosk ("You
235
+ * are here"). Omit for top-down.
236
+ */
237
+ initialPitch?: number;
238
+ /**
239
+ * Zoom for the opening view, centred on the kiosk. Set this above the
240
+ * theme's unit-walls breakpoint (~16.5 in the bundled hybrid theme) so the
241
+ * kiosk opens on the building's interior floor plan (its contents) rather
242
+ * than a zoomed-out 3D massing outline. Omit to keep the post-floor-fit
243
+ * zoom.
244
+ */
245
+ initialZoom?: number;
246
+ /**
247
+ * Zoom floor for selecting a place — a map tap or `selectPOI` (default
248
+ * `19.25`, one level into the Kiosk view). A selection made from further out
249
+ * zooms in to this; a closer zoom is kept. At the Kiosk view's edge (18.25)
250
+ * the selected dot and name are drawn but still lose collision to their
251
+ * neighbours, and in the Building view (a room tapped from 16.5 up) they
252
+ * aren't drawn at all — either way the visitor selects a place they can't
253
+ * see. `0` keeps the current zoom on every selection.
254
+ */
255
+ selectionZoom?: number;
256
+ /**
257
+ * Clamp zoom-out relative to the opening view. When set, the map's
258
+ * `minZoom` becomes `(initialZoom − this)`, so visitors can nudge out by
259
+ * this many zoom levels but never pull back below the interior into the
260
+ * massing/region. `0` locks zoom-out exactly to the opening view.
261
+ */
262
+ minZoomBelowInitialFit?: number;
263
+ /**
264
+ * Zoom-out floor expressed as ground scale: the most metres one CSS pixel
265
+ * may span. The SDK converts it to a `minZoom` at the venue's latitude, so
266
+ * every venue shows the same amount of surrounding map when fully zoomed
267
+ * out — a plain zoom number doesn't, because Web Mercator shows less ground
268
+ * per zoom level the further a venue is from the equator. Takes precedence
269
+ * over `minZoomBelowInitialFit`. For scale, `1.207` is zoom 15.8 at Orlando
270
+ * (about 2.3 km x 1.3 km on a 1920x1080 screen).
271
+ */
272
+ minZoomMetersPerPixel?: number;
273
+ /**
274
+ * Override the colour the SDK recolours every amenity SVG to before it
275
+ * composites the badge. `none` / `transparent` fills are preserved so
276
+ * cut-outs stay. When the badge is enabled (the default), this defaults
277
+ * to navy (`#162e51`) so icons read on gold. Set explicitly for a
278
+ * different look, or set `amenityBadge: false` to disable recolouring
279
+ * altogether and keep the CMS-uploaded colours.
280
+ */
281
+ amenityIconColor?: string;
282
+ /**
283
+ * Badge composited behind each amenity icon. Pass `false` to render the
284
+ * icon alone (no badge — useful for high-contrast or 2D themes where the
285
+ * gold disc would compete with the floor). Pass an object to tune the
286
+ * disc / ring style. Defaults to a VA-gold disc with a 2px white ring.
287
+ *
288
+ * The badge is baked into the icon bitmap (canvas composite) rather than
289
+ * drawn as a separate circle layer, so badge + icon participate in symbol
290
+ * collision together — overlapping amenities hide as one unit instead of
291
+ * the icon hiding while the disc stays painted.
292
+ */
293
+ amenityBadge?: AmenityBadgeStyle | false;
294
+ /**
295
+ * Badge for vertical-circulation connectors (elevator / stairs / escalator).
296
+ * These render as their own visual class — a navy disc with a white glyph —
297
+ * so circulation reads distinct from the gold service amenities. Pass `false`
298
+ * to fall them back into the regular gold badge, or an object to tune the
299
+ * disc / ring. When `amenityBadge` is `false`, connectors are badge-less too
300
+ * unless this is set explicitly.
301
+ */
302
+ connectorBadge?: AmenityBadgeStyle | false;
303
+ /**
304
+ * Badge for information-desk amenities (curated `information`/`info`
305
+ * icon). These render as their own visual class — a green disc with a
306
+ * white glyph by default — so information reads distinct from the gold
307
+ * service amenities. Pass `false` to fall them back into the regular gold
308
+ * badge, or an object to tune the disc / ring. When `amenityBadge` is
309
+ * `false`, information icons are badge-less too unless this is set
310
+ * explicitly.
311
+ */
312
+ informationBadge?: AmenityBadgeStyle | false;
313
+ /**
314
+ * Glyph colour for information icons on their badge. Default white
315
+ * (matches `informationBadge`'s default green disc).
316
+ */
317
+ informationIconColor?: string;
318
+ /**
319
+ * Badge for the end-of-route flag (`poi-route-end-flag`) shown in place of a
320
+ * destination's dot while a route to it is displayed. Has its own defaults
321
+ * (green disc, white ring) that don't follow `amenityBadge`. Pass an object
322
+ * to tune the disc / ring, or `false` for the bare flag glyph with no badge.
323
+ * When `amenityBadge` is `false`, the flag is badge-less too unless this is
324
+ * set explicitly. Under the high-contrast theme the disc colour is forced to
325
+ * the high-contrast amenity yellow, like the amenity and connector badges.
326
+ */
327
+ routeEndBadge?: AmenityBadgeStyle | false;
328
+ /**
329
+ * Flag glyph colour on the end-of-route badge. Default white (contrasts the
330
+ * default green disc); doesn't follow `amenityIconColor`. Ignored under the
331
+ * high-contrast theme, which forces its own glyph colour.
332
+ */
333
+ routeEndIconColor?: string;
12
334
  styleMode?: 'venueStyleUrl' | 'sdkTemplate';
13
335
  templateOverrideMode?: 'colorsOnly' | 'colorsAndConstants' | 'all';
14
336
  }
@@ -24,9 +346,19 @@ type SDKConfig = {
24
346
  venueId: number;
25
347
  locale?: string;
26
348
  auth?: JMapAuth;
349
+ /**
350
+ * Identifies which physical kiosk this instance is, so the SDK can pin
351
+ * the "You are here" marker. Matched against either the numeric device
352
+ * `id` or the device `uuid` from the venue's `devices`. The device's
353
+ * attached waypoint (`waypoint.deviceIds`) is the kiosk's location.
354
+ */
355
+ deviceId?: string | number;
27
356
  };
28
357
  jacs: {
29
- mode: 'proxy' | 'direct';
358
+ /** `snapshot` reads published venue snapshots from a CDN — what clients
359
+ * should use. `proxy`/`direct` read live JACS (the draft): local dev and
360
+ * CMS preview. */
361
+ mode: 'proxy' | 'direct' | 'snapshot';
30
362
  host?: string;
31
363
  auth?: {
32
364
  clientId: string;
@@ -34,13 +366,17 @@ type SDKConfig = {
34
366
  password: string;
35
367
  };
36
368
  proxyBaseUrl?: string;
369
+ baseUrl?: string;
37
370
  };
38
371
  options?: SDKOptions;
39
372
  };
40
373
 
41
- declare function MinuteMapsView({ config, className }: {
374
+ declare function MinuteMapsView({ config, className, onSelect, }: {
42
375
  config: SDKConfig;
43
376
  className?: string;
377
+ /** Fired when the user taps a destination/amenity pin. `pois` holds every
378
+ * POI co-located at that point (overlapping pins / a shared suite). */
379
+ onSelect?: (pois: POI[], coordinates: [number, number]) => void;
44
380
  }): react_jsx_runtime.JSX.Element;
45
381
 
46
382
  export { MinuteMapsView };