@minmaps-dev/mm-web-sdk 1.0.0-rc.51 → 1.0.0-rc.53

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
@@ -86,6 +86,10 @@ interface POI {
86
86
  * type-level name shared by every instance — see `Amenity.name`. Amenities
87
87
  * only, and only set when JACS actually returned an instance name. */
88
88
  instanceName?: string;
89
+ /** The instance flags set to Yes on this placement (`mm_baby_changing`,
90
+ * `mm_wheelchair_accessible`), in `INSTANCE_FLAG_KEYS` order. Amenities
91
+ * only; absent when none. Drives the flag bubble on the map pin. */
92
+ instanceFlags?: string[];
89
93
  }
90
94
  /**
91
95
  * Amenity - a specific type of POI (facilities, services)
@@ -195,10 +199,14 @@ interface Waypoint {
195
199
  * "Parking" amenity placed twice as "Parking Lot A" / "Parking Lot B").
196
200
  * `id` matches an `Amenity.id`, not this waypoint — a waypoint can carry
197
201
  * more than one amenity, so a consumer must find the entry for the
198
- * specific amenity it's rendering rather than assuming index 0. */
202
+ * specific amenity it's rendering rather than assuming index 0.
203
+ * `extensors` are per-instance flags (e.g. baby changing at this one
204
+ * restroom), layered over the amenity's own `extensors`; omitted when the
205
+ * instance has none. */
199
206
  amenityAssociations?: Array<{
200
207
  id: string | number;
201
208
  name: string;
209
+ extensors?: Record<string, string>;
202
210
  }>;
203
211
  }
204
212
  /**
@@ -1073,6 +1081,15 @@ declare const POINT_OF_INTEREST_EXTENSOR_KEY = "mm_point_of_interest";
1073
1081
  * `venue.buildings`.
1074
1082
  */
1075
1083
  declare const BUILDING_NAME_EXTENSOR_KEY = "mm_building_name";
1084
+ /**
1085
+ * Per-instance amenity flags. Unlike the keys above, these ride on one
1086
+ * placement of an amenity (JACS `amenityAssociations[].extensors`), not the
1087
+ * amenity record, because "this restroom has a changing table" is true of one
1088
+ * restroom, not every restroom in the venue. Values are `"true"` / `"false"`;
1089
+ * a missing key means nobody recorded it — see `parseFlag`.
1090
+ */
1091
+ declare const BABY_CHANGING_EXTENSOR_KEY = "mm_baby_changing";
1092
+ declare const WHEELCHAIR_ACCESSIBLE_EXTENSOR_KEY = "mm_wheelchair_accessible";
1076
1093
  interface DestinationPhone {
1077
1094
  /** Exactly as the author typed it — `"(408) 300-9294"`. Deliberately not
1078
1095
  * normalised: doing that properly across international formats needs a real
@@ -1090,6 +1107,9 @@ declare function parsePhone(raw: unknown): DestinationPhone | null;
1090
1107
  declare function parseImageAlt(raw: unknown): string | undefined;
1091
1108
  /** The building name, or `undefined` when the author set none. */
1092
1109
  declare function parseBuildingName(raw: unknown): string | undefined;
1110
+ /** A yes/no/unknown flag. `undefined` for anything but `"true"`/`"false"` —
1111
+ * a missing key is "not recorded", and a kiosk must not read that as "no". */
1112
+ declare function parseFlag(raw: unknown): boolean | undefined;
1093
1113
  /** The point-of-interest flag. Absence means false — only the checked state is
1094
1114
  * ever stored. */
1095
1115
  declare function parsePointOfInterest(raw: unknown): boolean;
@@ -1217,6 +1237,60 @@ declare function timeZoneAbbreviation(now?: Date, timeZone?: string): string;
1217
1237
  */
1218
1238
  declare function getOpenStatus(hours: OpenHours, now?: Date, options?: OpenStatusOptions): OpenStatus;
1219
1239
 
1240
+ /**
1241
+ * Choosing among an amenity's placements by their per-instance flags
1242
+ * (`amenityAssociations[].extensors`, e.g. "this restroom has a changing
1243
+ * table"). Pure — the SDK feeds the result to `findClosestByWalkTime`, so a
1244
+ * flag only ever narrows *which* instances are eligible, never how they rank.
1245
+ *
1246
+ * Everything here is keyed on `'true'`. "No" and "not recorded" are both "not a
1247
+ * match": a kiosk must never send someone to a restroom nobody has verified.
1248
+ */
1249
+ /** The instance flags a consumer can filter or build variants on, in display order. */
1250
+ declare const INSTANCE_FLAG_KEYS: readonly ["mm_baby_changing", "mm_wheelchair_accessible"];
1251
+ type InstanceFlagKey = (typeof INSTANCE_FLAG_KEYS)[number];
1252
+ /** The instance's value for one flag: `true`, `false`, or `undefined` (not recorded). */
1253
+ declare function instanceFlag(amenityId: Amenity['id'], wp: Waypoint, key: string): boolean | undefined;
1254
+ /**
1255
+ * Why `preferAccessible` fell back to every instance:
1256
+ * - `'none-accessible'` — instances are recorded, but none as accessible. Worth
1257
+ * telling the visitor.
1258
+ * - `'not-recorded'` — nobody has recorded accessibility here yet (a venue not
1259
+ * backfilled). Say nothing: it's today's behaviour, and a warning on every
1260
+ * route would only alarm people.
1261
+ */
1262
+ type AccessibleFallback = 'none-accessible' | 'not-recorded';
1263
+ interface AmenityInstanceChoice {
1264
+ /** The eligible waypoints, before any walk-time ranking. */
1265
+ waypoints: Waypoint[];
1266
+ /** Set when `preferAccessible` found no accessible instance and fell back. */
1267
+ fallback?: AccessibleFallback;
1268
+ }
1269
+ /**
1270
+ * The instances to pick from: those matching `require`, then — with
1271
+ * `preferAccessible` — only the wheelchair-accessible ones among them, falling
1272
+ * back to all of them when there are none. `require` never falls back: a
1273
+ * "Restroom · Baby changing" request with no flagged restroom has no answer.
1274
+ */
1275
+ declare function chooseAmenityInstances(amenity: Amenity, opts?: {
1276
+ require?: readonly string[];
1277
+ preferAccessible?: boolean;
1278
+ }): AmenityInstanceChoice;
1279
+ /** A flag-specific way to ask for an amenity — "Restroom · Baby changing station". */
1280
+ interface AmenityVariant {
1281
+ amenity: Amenity;
1282
+ /** The instance flag this variant requires; pass it as `require: [flag]`. */
1283
+ flag: InstanceFlagKey;
1284
+ /** How many placements qualify. Always at least 1. */
1285
+ instanceCount: number;
1286
+ }
1287
+ /**
1288
+ * One variant per amenity and flag with at least one instance flagged Yes, in
1289
+ * amenity order then `INSTANCE_FLAG_KEYS` order. A venue nobody has backfilled
1290
+ * yields none, so consumers can ship variant rows before the data exists.
1291
+ */
1292
+ declare function amenityVariants(amenities: readonly Amenity[]): AmenityVariant[];
1293
+
1220
1294
  /** One floor of the active route, drawn on its own for a printout. */
1221
1295
  type RouteFloorImage = {
1222
1296
  floor: Floor;
@@ -1766,6 +1840,14 @@ declare class MinuteMaps {
1766
1840
  * refetch and no re-compositing.
1767
1841
  */
1768
1842
  private serveMissingStyleImage;
1843
+ /**
1844
+ * Compose a pin-plus-flag-bubble image (`map/flagBadge.ts`) from the pin's
1845
+ * own registered image. Uploaded and curated icons register asynchronously
1846
+ * during `init`, and a sprite sheet may still be loading, so a base that
1847
+ * isn't on the map yet is retried for a few seconds rather than given up on —
1848
+ * giving up would leave a flagged pin blank for the whole session.
1849
+ */
1850
+ private serveFlaggedIcon;
1769
1851
  on(event: string, cb: (e: MapEvent) => void): void;
1770
1852
  off(event: string, cb?: (e: MapEvent) => void): void;
1771
1853
  addControl(control: IControl, position?: ControlPosition): void;
@@ -2104,6 +2186,13 @@ declare class MinuteMaps {
2104
2186
  * tick if the UI stays on screen. The raw string also remains in
2105
2187
  * `properties` for consumers that would rather parse it themselves. */
2106
2188
  openHours?: OpenHours;
2189
+ /** This placement has a baby changing station (`mm_baby_changing`).
2190
+ * Amenity instances only. `undefined` means not recorded — render
2191
+ * nothing rather than "No". */
2192
+ babyChanging?: boolean;
2193
+ /** This placement is wheelchair accessible (`mm_wheelchair_accessible`).
2194
+ * Amenity instances only; same `undefined` = not recorded rule. */
2195
+ wheelchairAccessible?: boolean;
2107
2196
  };
2108
2197
  /** Resolve the source Destination/Amenity record backing a rendered POI,
2109
2198
  * for detail fields (category, localized description) that don't live on
@@ -2760,6 +2849,29 @@ declare class MinuteMaps {
2760
2849
  findClosestByWalkTime<T>(items: readonly T[], toWaypoint: (item: T) => Waypoint | null | undefined, opts?: {
2761
2850
  avoidStairs?: boolean;
2762
2851
  }): T | null;
2852
+ /**
2853
+ * Flag-specific ways to ask for an amenity — one per amenity and instance
2854
+ * flag with at least one placement flagged Yes ("Restroom · Baby changing
2855
+ * station"). Route one with `navigateFromKioskToClosestAmenity(amenity.id,
2856
+ * { require: [variant.flag] })`. Empty for a venue whose instances carry no
2857
+ * flags yet, so a consumer can render variant rows before the backfill.
2858
+ */
2859
+ getAmenityVariants(): AmenityVariant[];
2860
+ /**
2861
+ * The placements of an amenity eligible for a request, before walk-time
2862
+ * ranking: only those with every `require` flag set to Yes, then — with
2863
+ * `preferAccessible` — only the wheelchair-accessible ones among them,
2864
+ * falling back to all of them (see `fallback`) when none are. `null` for an
2865
+ * unknown amenity.
2866
+ *
2867
+ * The routing and highlight calls use this internally; a consumer collapsing
2868
+ * search results to one instance per amenity should rank this list with
2869
+ * `findClosestByWalkTime` so its pick matches the route.
2870
+ */
2871
+ getAmenityInstances(amenityId: string | number, options?: {
2872
+ require?: readonly string[];
2873
+ preferAccessible?: boolean;
2874
+ }): AmenityInstanceChoice | null;
2763
2875
  /**
2764
2876
  * Route from the kiosk to the closest physical instance of an amenity.
2765
2877
  * Resolves the amenity venue-wide, picks the instance with the smallest
@@ -2775,9 +2887,15 @@ declare class MinuteMaps {
2775
2887
  * otherwise handles accessibility preference automatically). The same
2776
2888
  * flag is passed to the closest-instance pick, so an instance reachable
2777
2889
  * only by stairs is skipped in favour of one the route can actually reach.
2890
+ *
2891
+ * `require` and `preferAccessible` narrow which instances are eligible
2892
+ * before the pick — see `getAmenityInstances`. A `require` nothing matches
2893
+ * routes nowhere (and warns) rather than to an unverified instance.
2778
2894
  */
2779
2895
  navigateFromKioskToClosestAmenity(amenityId: string | number, options?: {
2780
2896
  avoidStairs?: boolean;
2897
+ require?: readonly string[];
2898
+ preferAccessible?: boolean;
2781
2899
  }): Promise<any>;
2782
2900
  /**
2783
2901
  * Highlight + center on the closest physical instance of an amenity.
@@ -2788,9 +2906,13 @@ declare class MinuteMaps {
2788
2906
  * This is the right call from a venue-wide list ("here are all the
2789
2907
  * bathrooms in the building, take me to the closest one"). For taps on
2790
2908
  * a specific resolved POI (e.g. a search result that already names one
2791
- * instance), use `highlightPOI` instead.
2909
+ * instance), use `highlightPOI` instead. `require` / `preferAccessible`
2910
+ * narrow the eligible instances as in `navigateFromKioskToClosestAmenity`.
2792
2911
  */
2793
- highlightAmenity(amenityId: string | number): Promise<void>;
2912
+ highlightAmenity(amenityId: string | number, options?: {
2913
+ require?: readonly string[];
2914
+ preferAccessible?: boolean;
2915
+ }): Promise<void>;
2794
2916
  /** Which floor owns this waypoint, by matching mapId against the floor's
2795
2917
  * `mapId` (or `id` as fallback). Used to switch floors when routing /
2796
2918
  * highlighting hits an instance on a different one. */
@@ -3100,5 +3222,5 @@ type ResolvedIconSource = {
3100
3222
  */
3101
3223
  declare function resolveAmenityIconSource(amenity: AmenityLike, preferredLocale?: string): ResolvedIconSource | null;
3102
3224
 
3103
- export { BUILDING_NAME_EXTENSOR_KEY, DAY_KEYS, IMAGE_ALT_EXTENSOR_KEY, MinuteMaps, OPEN_HOURS_EXTENSOR_KEY, OPEN_HOURS_VERSION, PHONE_EXTENSOR_KEY, POINT_OF_INTEREST_EXTENSOR_KEY, RESERVED_EXTENSOR_PREFIX, SNAPSHOT_SCHEMA_VERSION, SnapshotProvider, SnapshotUnavailableError, VenueDirectory, activeSectionIndex, createMinuteMapsSDK, customerDisplayName, dayKeyAt, getOpenStatus, groupStepsIntoFloorSections, isConnectorAmenity, isMapLocation, parseBuildingName, parseImageAlt, parseOpenHours, parsePhone, parsePointOfInterest, resolveAmenityIconSource, resolveSnapshotLocale, timeZoneAbbreviation };
3104
- export type { Amenity, AmenityBadgeStyle, AmenityWithFloor, Bounds, BoundsPadding, CameraState, Customer, CustomerVenues, DayKey, Destination, DestinationPhone, EventCallback, Floor, FloorMetadata, HoursRange, JMapAuth, JMapConfig, JacsAuth, JacsConfig, JacsProviderConfig, JacsReader, ListCustomerVenuesOptions, MapEvent, MapLocation, OpenHours, OpenHoursTransition, OpenStatus, OpenStatusOptions, POI, POISearchResult, ResolvedIconSource, RouteEndPreview, RouteFloorImage, RouteFloorSection, RouteImageOptions, RoutePoint, RoutingOptions, SDKConfig, SDKOptions, SnapshotProviderConfig, SnapshotUpdateCheck, SnapshotVersions, ThemeName, TransitionStep, VenueDirectoryConfig, VenueSummary, ViewOptions, WayfindCenterMode, WayfindStep, Waypoint, Zone };
3225
+ export { BABY_CHANGING_EXTENSOR_KEY, BUILDING_NAME_EXTENSOR_KEY, DAY_KEYS, IMAGE_ALT_EXTENSOR_KEY, INSTANCE_FLAG_KEYS, MinuteMaps, OPEN_HOURS_EXTENSOR_KEY, OPEN_HOURS_VERSION, PHONE_EXTENSOR_KEY, POINT_OF_INTEREST_EXTENSOR_KEY, RESERVED_EXTENSOR_PREFIX, SNAPSHOT_SCHEMA_VERSION, SnapshotProvider, SnapshotUnavailableError, VenueDirectory, WHEELCHAIR_ACCESSIBLE_EXTENSOR_KEY, activeSectionIndex, amenityVariants, chooseAmenityInstances, createMinuteMapsSDK, customerDisplayName, dayKeyAt, getOpenStatus, groupStepsIntoFloorSections, instanceFlag, isConnectorAmenity, isMapLocation, parseBuildingName, parseFlag, parseImageAlt, parseOpenHours, parsePhone, parsePointOfInterest, resolveAmenityIconSource, resolveSnapshotLocale, timeZoneAbbreviation };
3226
+ export type { AccessibleFallback, Amenity, AmenityBadgeStyle, AmenityInstanceChoice, AmenityVariant, AmenityWithFloor, Bounds, BoundsPadding, CameraState, Customer, CustomerVenues, DayKey, Destination, DestinationPhone, EventCallback, Floor, FloorMetadata, HoursRange, InstanceFlagKey, JMapAuth, JMapConfig, JacsAuth, JacsConfig, JacsProviderConfig, JacsReader, ListCustomerVenuesOptions, MapEvent, MapLocation, OpenHours, OpenHoursTransition, OpenStatus, OpenStatusOptions, POI, POISearchResult, ResolvedIconSource, RouteEndPreview, RouteFloorImage, RouteFloorSection, RouteImageOptions, RoutePoint, RoutingOptions, SDKConfig, SDKOptions, SnapshotProviderConfig, SnapshotUpdateCheck, SnapshotVersions, ThemeName, TransitionStep, VenueDirectoryConfig, VenueSummary, ViewOptions, WayfindCenterMode, WayfindStep, Waypoint, Zone };