@mappedin/mappedin-js 5.46.0 → 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' {
@@ -1297,11 +1321,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.OfflineSearch'
1297
1321
  /**
1298
1322
  * Search for a term
1299
1323
  */
1300
- search(
1301
- /**
1302
- * Search term
1303
- */
1304
- term: string): Promise<TMappedinOfflineSearchResult[]>;
1324
+ search(term: string): Promise<TMappedinOfflineSearchResult[]>;
1305
1325
  /**
1306
1326
  * Export search index to JSON for storage/caching - this would avoid having to re-index
1307
1327
  * on page reload
@@ -1566,7 +1586,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/' {
1566
1586
  */
1567
1587
  export function setFetchFn(fetchFn: any): void;
1568
1588
  /** Classes */
1569
- 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';
1570
1590
  /**
1571
1591
  * @internal
1572
1592
  * @hidden
@@ -2074,9 +2094,9 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/MappedinNavigatable' {
2074
2094
  }
2075
2095
 
2076
2096
  declare module '@mappedin/mappedin-js/lib/esm/get-venue/MappedinNode' {
2077
- 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';
2078
2098
  import type { TOpeningHours } from '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.API.types';
2079
- 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';
2080
2100
  /**
2081
2101
  * A {@link MappedinNode} represents a position, anchored to a specific {@link MappedinMap}.
2082
2102
  *