@tomtom-org/maps-sdk 0.29.2 → 0.30.1

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.
@@ -63,7 +63,7 @@ terms above.
63
63
  ---
64
64
 
65
65
  Name: @tomtom-org/maps-sdk
66
- Version: 0.29.2
66
+ Version: 0.30.1
67
67
  License: See in LICENSE.txt
68
68
  Private: false
69
69
  Description: JavaScript library for TomTom maps and location services
@@ -939,24 +939,8 @@ declare type BaseSourceAndLayers = {
939
939
  };
940
940
 
941
941
  /**
942
- * Builds the display title for a place feature.
943
- *
944
- * @remarks
945
- * Determines the appropriate title to display on the map by prioritizing
946
- * POI name over the freeform address. This ensures that named locations
947
- * (e.g., "Starbucks", "Central Park") are shown with their recognizable names
948
- * while regular addresses use their street address.
949
- *
950
- * @param place - The place feature to extract the title from
951
- * @returns The display title, either the POI name or freeform address
952
- *
953
- * @example
954
- * ```ts
955
- * const place = { properties: { poi: { name: "Eiffel Tower" }, address: { freeformAddress: "..." } } };
956
- * const title = buildPlaceTitle(place); // Returns "Eiffel Tower"
957
- * ```
958
- *
959
- * @group Places
942
+ * Builds the title of the place to display it on the map.
943
+ * @param place The place to display.
960
944
  */
961
945
  export declare const buildPlaceTitle: (place: Place_2) => string;
962
946
 
@@ -3053,29 +3037,10 @@ export declare type GeometryTextConfig = {
3053
3037
  };
3054
3038
 
3055
3039
  /**
3056
- * Determines the appropriate sprite image ID for displaying a place icon on the map.
3057
- *
3058
- * @remarks
3059
- * Resolves icon IDs using the following priority:
3060
- * 1. Custom icons matching the place's classification code
3061
- * 2. Pin-style icons based on category IDs
3062
- * 3. POI-style icons based on classification codes
3063
- * 4. Default fallback pin icon
3064
- *
3065
- * The icon style is determined by the configuration, supporting both 'pin' and 'poi-like' styles.
3066
- *
3067
- * @param place - The place feature to determine the icon for
3068
- * @param config - Optional configuration for icon style and custom icons
3069
- * @param map - Optional map instance (reserved for future use)
3070
- * @returns The sprite image ID to use for rendering the place icon
3071
- *
3072
- * @example
3073
- * ```ts
3074
- * const iconId = getIconIDForPlace(place, {
3075
- * iconConfig: { iconStyle: 'pin', customIcons: [...] }
3076
- * }, map);
3077
- * ```
3078
- * @group Places
3040
+ * Gets the map style sprite image ID to display on the map for the give place.
3041
+ * @param place The place to display.
3042
+ * @param map
3043
+ * @param config
3079
3044
  */
3080
3045
  export declare const getIconIDForPlace: (place: Place_2, config?: PlacesModuleConfig, map?: Map_2) => string;
3081
3046
 
@@ -2911,6 +2911,60 @@ const buildPlacesLayerSpecs = (config, idPrefix, map) => {
2911
2911
  (spec, index) => withConfig(spec, config, `${idPrefix}-${index === 0 ? "main" : "selected"}`)
2912
2912
  );
2913
2913
  };
2914
+ const supportedPinSubcategories = /* @__PURE__ */ new Set([
2915
+ 7339002,
2916
+ 8099002,
2917
+ 7369004,
2918
+ 7321003,
2919
+ 7376006,
2920
+ 9362003,
2921
+ 9362004,
2922
+ 9160004,
2923
+ 9376007,
2924
+ 7315015,
2925
+ 9376006,
2926
+ 9376002,
2927
+ 7315078,
2928
+ 7315149,
2929
+ 9376005,
2930
+ 7372003,
2931
+ 9352045,
2932
+ 9352032,
2933
+ 9361048,
2934
+ 9902003,
2935
+ 9378005,
2936
+ 7383004,
2937
+ 9910004,
2938
+ 7320002,
2939
+ 9362016,
2940
+ 7320003,
2941
+ 9362025,
2942
+ 9942002,
2943
+ 9942003,
2944
+ 7380005,
2945
+ 9663003,
2946
+ 9361021,
2947
+ 9379009,
2948
+ 9379004,
2949
+ 7315147,
2950
+ 9376003,
2951
+ 9160002,
2952
+ 9160003,
2953
+ 9352008,
2954
+ 9361006,
2955
+ 7389004,
2956
+ 9910006
2957
+ ]);
2958
+ const toMapDisplayPin = (place) => {
2959
+ const categoryID = place.properties.poi?.categoryIds?.[0];
2960
+ if (!categoryID) {
2961
+ return "default_pin";
2962
+ }
2963
+ if (supportedPinSubcategories.has(categoryID)) {
2964
+ return categoryID.toString();
2965
+ }
2966
+ return categoryID.toString().substring(0, 4);
2967
+ };
2914
2968
  const buildPlaceTitle = (place) => place.properties.poi?.name ?? place.properties.address.freeformAddress;
2915
2969
  const getIconIDForPlace = (place, config = {}, map) => {
2916
2970
  const iconStyle = config.iconConfig?.iconStyle ?? "pin";
@@ -2922,8 +2976,7 @@ const getIconIDForPlace = (place, config = {}, map) => {
2922
2976
  }
2923
2977
  let iconId;
2924
2978
  if (iconStyle === "pin") {
2925
- const categoryID = place.properties.poi?.categoryIds?.[0];
2926
- iconId = categoryID ? String(categoryID) : "default_pin";
2979
+ iconId = toMapDisplayPin(place);
2927
2980
  } else {
2928
2981
  iconId = (classificationCode && `poi-${toMapDisplayPOICategory(classificationCode)}`) ?? "default_pin";
2929
2982
  }
@@ -5449,14 +5502,14 @@ t.instance = new t();
5449
5502
  let r = t;
5450
5503
  const G = (e2) => e2?.minutes ?? "min", F = (e2, t2) => {
5451
5504
  if (e2) {
5452
- const o2 = Math.abs(e2) / 3600;
5453
- let a2 = Math.floor(o2), i2 = Math.round(o2 % 1 * 60);
5454
- 60 === i2 && (i2 = 0, a2++);
5455
- const s2 = { ...r.instance.get().displayUnits?.time, ...t2 };
5456
- if (a2) return `${a2} ${n2 = s2, n2?.hours ?? "hr"} ${i2.toString().padStart(2, "0")} ${G(s2)}`;
5457
- if (i2) return `${i2.toString()} ${G(s2)}`;
5458
- }
5459
- var n2;
5505
+ const a = Math.abs(e2) / 3600;
5506
+ let o = Math.floor(a), i = Math.round(a % 1 * 60);
5507
+ 60 === i && (i = 0, o++);
5508
+ const s = { ...r.instance.get().displayUnits?.time, ...t2 };
5509
+ if (o) return `${o} ${n = s, n?.hours ?? "hr"} ${i.toString().padStart(2, "0")} ${G(s)}`;
5510
+ if (i) return `${i.toString()} ${G(s)}`;
5511
+ }
5512
+ var n;
5460
5513
  };
5461
5514
  const getIconID = (chargingStop, config) => {
5462
5515
  const iconConfig = config?.chargingStops?.icon;