@mappedin/mappedin-js 5.45.1 → 5.47.0

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.
@@ -30,7 +30,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue' {
30
30
  */
31
31
  export function setFetchFn(fetchFn: any): void;
32
32
  /** Classes */
33
- export { MappedinCollectionType, MappedinNavigatable, MappedinNode, MappedinLocation, MappedinPolygon, MappedinCategory, MappedinDirections, MappedinDestinationSet, MappedinVortex, MappedinVenue, MappedinRankings, MappedinEvent, MappedinLocationState, MappedinMap, MappedinCoordinate, MappedinMapGroup, Mappedin, } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
33
+ export { MappedinCollectionType, MappedinNavigatable, MappedinNode, MappedinLocation, MappedinPolygon, MappedinCategory, MappedinDirections, MappedinDestinationSet, MappedinVortex, MappedinVenue, MappedinRankings, MappedinEvent, MappedinLocationState, MappedinMap, MappedinCoordinate, MappedinMapGroup, findPreferredLanguage, Mappedin, } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
34
34
  /**
35
35
  * @internal
36
36
  * @hidden
@@ -226,6 +226,11 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.types' {
226
226
  noAuth?: boolean;
227
227
  perspective?: string;
228
228
  language?: string;
229
+ /**
230
+ * Fallback to navigator language if the language is not available
231
+ * @default true
232
+ */
233
+ fallbackToNavigatorLanguages?: boolean;
229
234
  headers?: {
230
235
  [key in string]: string;
231
236
  };
@@ -292,18 +297,18 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.types' {
292
297
  declare module '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin' {
293
298
  import { Navigator } from '@mappedin/mappedin-js/lib/esm/get-venue/--/navigator';
294
299
  import type { TAllGetVenueOptions, TGetVenueOptions, TGetVenueOptionsInternal } from '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.types';
295
- import type { MappedinNode, MappedinPolygon, MappedinLocation, MappedinCategory, MappedinVortex, MappedinVenue, MappedinTheme, MappedinRankings, MappedinLocationRankings, MappedinEvent, MappedinLocationState, MappedinMap, MappedinMapGroup, GET_VENUE_PAYLOAD } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
296
- import { TAccessors, GET_VENUE_EVENT } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
297
- import { IAnalytics } from '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.CustomerAnalytics';
298
- import { ParsedMVF } from '@mappedin/mvf';
299
- import { ParsedMVFv1 } from '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.MVF.types';
300
+ import type { MappedinNode, MappedinPolygon, MappedinLocation, MappedinCategory, MappedinVortex, MappedinVenue, MappedinTheme, MappedinRankings, MappedinLocationRankings, MappedinEvent, MappedinLocationState, MappedinMap, MappedinMapGroup, GET_VENUE_PAYLOAD, TAccessors } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
301
+ import { GET_VENUE_EVENT } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
302
+ import type { IAnalytics } from '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.CustomerAnalytics';
303
+ import type { ParsedMVF } from '@mappedin/mvf';
304
+ import type { ParsedMVFv1 } from '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.MVF.types';
300
305
  import { PubSub } from '@mappedin/mappedin-js/lib/esm/get-venue/pub-sub.typed';
301
306
  export const defaultOptions: TGetVenueOptionsInternal<TGetVenueOptions>;
302
307
  export class Mappedin extends PubSub<GET_VENUE_PAYLOAD, GET_VENUE_EVENT> {
303
308
  #private;
304
309
  perspective: any;
305
310
  things: any;
306
- options: any;
311
+ options: TGetVenueOptionsInternal<TAllGetVenueOptions> & Pick<TGetVenueOptions, 'language' | 'fallbackToNavigatorLanguages'>;
307
312
  updatedAt?: string;
308
313
  categories: MappedinCategory[];
309
314
  locations: MappedinLocation[];
@@ -545,6 +550,25 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin' {
545
550
  */
546
551
  toString: (includeOptions?: boolean) => string;
547
552
  }
553
+ /**
554
+ * Finds the ideal language for the venue based on the following priority:
555
+ * 1. User specified language (if it exists in venue languages)
556
+ * 2. Browser navigator languages (if fallback is enabled)
557
+ * 3. Venue's default language
558
+ *
559
+ * @param venue - The MappedinVenue object containing available languages
560
+ * @param options - Configuration options
561
+ * @param options.language - Preferred language code to use
562
+ * @param options.fallbackToNavigatorLanguages - Whether to use browser's language settings as fallback (defaults to true)
563
+ * @returns An object containing the selected language code and name, or undefined if no language is found
564
+ */
565
+ export function findPreferredLanguage(venue: MappedinVenue, options: {
566
+ language?: string;
567
+ fallbackToNavigatorLanguages?: boolean;
568
+ }): {
569
+ code: string;
570
+ name: string;
571
+ } | undefined;
548
572
  }
549
573
 
550
574
  declare module '@mappedin/mappedin-js/lib/esm/get-venue/default-things' {
@@ -629,7 +653,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/internal' {
629
653
  code: string;
630
654
  };
631
655
  };
632
- export { Mappedin } from '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin';
656
+ export { Mappedin, findPreferredLanguage } from '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin';
633
657
  }
634
658
 
635
659
  declare module '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.CustomerAnalytics' {
@@ -949,6 +973,51 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/MappedinLocation' {
949
973
  */
950
974
  get parent(): MappedinLocation | undefined;
951
975
  set parent(parent: MappedinLocation | undefined);
976
+ /**
977
+ * Specific instances of this location with different properties.
978
+ * Typically, there will be at least one node or polygon defined,
979
+ * plus one or more other properties that are different from the parent.
980
+ * The remaining properties will be the same as the parent.
981
+ * For example, suppose there is a location like this:
982
+ *
983
+ * ```json
984
+ * {
985
+ * "id": "location-id-1",
986
+ * "name": "Location 1",
987
+ * "nodes": ["node-1", "node-2"],
988
+ * "polygons": ["polygon-1", "polygon-2"],
989
+ * "externalId": "externalId-1",
990
+ * "description": "Description 1",
991
+ * }
992
+ * ```
993
+ *
994
+ * (Note that for clarity, we have put strings in for nodes and polygons, but in practice they would be objects.)
995
+ *
996
+ * Then suppose it had an `instances` array that contained an object that looked like this:
997
+ *
998
+ * ```json
999
+ * {
1000
+ * "id": "instance-id-1",
1001
+ * "name": "Location 1 - A",
1002
+ * "nodes": ["node-1"],
1003
+ * "polygons": ["polygon-1"],
1004
+ * "externalId": "externalId-1-A",
1005
+ * "description": "Description 1",
1006
+ * }
1007
+ * ```
1008
+ * This says "Location 1" is the parent location, and "Location 1 - A" is an instance of it. The instance has a different name, and a different external ID, and it only applies to node `node-1` and polygon `polygon-1`.
1009
+ * The ID will always be different, but other properties (like the description) are the same as the parent.
1010
+ *
1011
+ * Example use cases:
1012
+ * - A Mall may have a location with two nodes and one polygon. It may then have an instance with one of the nodes, and operating hours
1013
+ * that are different from the parent. This indicates that this instance is an entrance for the location that is accessible at different times, perhaps for an interior mall entrance, when the main location (and other, exterior entrance) is open later than the rest of the mall.
1014
+ * - An airport may have a location with several polygons and nodes, and an instance for each node (and corresponding polygon, if any) with a different siblingGroup. The location in the sibling group may be the airport terminal, or airside vs landside.
1015
+ * This would allow an application to show the location once in a search result, but offer UX to select the instance that is in the right terminal.
1016
+ *
1017
+ * Note: Instances are actual EnterpriseLocations. This means they have all the properties of a normal EnterpriseLocation, including an `instances` property, that will always be undefined. They also do NOT have a parent property, or any other explicit reference to the parent location. These instances are
1018
+ * only referenced from their parent location, and will not show up in other places in the map data. However, they should otherwise behave like normal EnterpriseLocations, being targetable for things like navigation and focus.
1019
+ */
1020
+ get instances(): MappedinLocation[];
952
1021
  /**
953
1022
  * Categories related to this location.
954
1023
  *
@@ -1252,11 +1321,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.OfflineSearch'
1252
1321
  /**
1253
1322
  * Search for a term
1254
1323
  */
1255
- search(
1256
- /**
1257
- * Search term
1258
- */
1259
- term: string): Promise<TMappedinOfflineSearchResult[]>;
1324
+ search(term: string): Promise<TMappedinOfflineSearchResult[]>;
1260
1325
  /**
1261
1326
  * Export search index to JSON for storage/caching - this would avoid having to re-index
1262
1327
  * on page reload
@@ -1521,7 +1586,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/' {
1521
1586
  */
1522
1587
  export function setFetchFn(fetchFn: any): void;
1523
1588
  /** Classes */
1524
- export { MappedinCollectionType, MappedinNavigatable, MappedinNode, MappedinLocation, MappedinPolygon, MappedinCategory, MappedinDirections, MappedinDestinationSet, MappedinVortex, MappedinVenue, MappedinRankings, MappedinEvent, MappedinLocationState, MappedinMap, MappedinCoordinate, MappedinMapGroup, Mappedin, } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
1589
+ export { MappedinCollectionType, MappedinNavigatable, MappedinNode, MappedinLocation, MappedinPolygon, MappedinCategory, MappedinDirections, MappedinDestinationSet, MappedinVortex, MappedinVenue, MappedinRankings, MappedinEvent, MappedinLocationState, MappedinMap, MappedinCoordinate, MappedinMapGroup, findPreferredLanguage, Mappedin, } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
1525
1590
  /**
1526
1591
  * @internal
1527
1592
  * @hidden
@@ -2029,9 +2094,9 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/MappedinNavigatable' {
2029
2094
  }
2030
2095
 
2031
2096
  declare module '@mappedin/mappedin-js/lib/esm/get-venue/MappedinNode' {
2032
- import type { MappedinPolygon, MappedinLocation, Mappedin } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
2097
+ import type { MappedinPolygon, MappedinLocation, Mappedin, MappedinDirections, MappedinMap, TDirectionToOptions } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
2033
2098
  import type { TOpeningHours } from '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.API.types';
2034
- import { MappedinNavigatable, MappedinDirections, MappedinDestinationSet, MappedinMap, TDirectionToOptions } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
2099
+ import { MappedinNavigatable, MappedinDestinationSet } from '@mappedin/mappedin-js/lib/esm/get-venue/internal';
2035
2100
  /**
2036
2101
  * A {@link MappedinNode} represents a position, anchored to a specific {@link MappedinMap}.
2037
2102
  *