@mapvx/web-js 2.0.1 → 2.0.2

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/umd/index.js CHANGED
@@ -290,7 +290,7 @@ __webpack_require__.d(__webpack_exports__, {
290
290
  MAPVX_BRAND_COLOR: () => (/* reexport */ MAPVX_BRAND_COLOR),
291
291
  MAPVX_DEFAULT_PRECONNECT_HOSTS: () => (/* reexport */ MAPVX_DEFAULT_PRECONNECT_HOSTS),
292
292
  MVXLogger: () => (/* reexport */ MVXLogger),
293
- MVXPlace: () => (/* reexport */ place_MVXPlace),
293
+ MVXPlace: () => (/* reexport */ MVXPlace),
294
294
  MVXRoute: () => (/* reexport */ MVXRoute),
295
295
  MVXRouteLeg: () => (/* reexport */ MVXRouteLeg),
296
296
  MVXRouteStep: () => (/* reexport */ MVXRouteStep),
@@ -670,13 +670,21 @@ function PersistentCache_toPrimitive(t, r) { if ("object" != PersistentCache_typ
670
670
  * ```
671
671
  */
672
672
  var PersistentCache = /*#__PURE__*/function () {
673
- function PersistentCache(config, maxStorageBytes) {
673
+ /**
674
+ * @param config - Cache configuration (limits, TTL, persistence key).
675
+ * @param maxStorageBytes - Optional per-cache localStorage budget.
676
+ * @param deserialize - Optional reviver applied to each value read back from
677
+ * localStorage. `JSON.parse` strips class prototypes, so values that carry
678
+ * methods (e.g. `MVXPlace`) must be rebuilt here; plain-data caches omit it.
679
+ */
680
+ function PersistentCache(config, maxStorageBytes, deserialize) {
674
681
  PersistentCache_classCallCheck(this, PersistentCache);
675
682
  PersistentCache_defineProperty(this, "storageAvailable", true);
676
683
  this.lruCache = new LRUCache(config);
677
684
  this.persistenceKey = config.persistenceKey || "mvx_cache";
678
685
  this.maxStorageBytes = maxStorageBytes !== null && maxStorageBytes !== void 0 ? maxStorageBytes : DEFAULT_MAX_STORAGE_BYTES;
679
686
  this.ttlMs = config.ttlMs;
687
+ this.deserialize = deserialize;
680
688
  this.hydrate();
681
689
  }
682
690
  return PersistentCache_createClass(PersistentCache, [{
@@ -749,8 +757,8 @@ var PersistentCache = /*#__PURE__*/function () {
749
757
  continue;
750
758
  }
751
759
 
752
- // Restore to LRU cache
753
- this.lruCache.set(entry.key, entry.value);
760
+ // Restore to LRU cache, reviving class prototypes stripped by JSON when needed.
761
+ this.lruCache.set(entry.key, this.deserialize ? this.deserialize(entry.value) : entry.value);
754
762
  }
755
763
  } catch (err) {
756
764
  _iterator.e(err);
@@ -841,193 +849,722 @@ var PersistentCache = /*#__PURE__*/function () {
841
849
  }
842
850
  }]);
843
851
  }();
844
- ;// ./src/infrastructure/cache/CacheManager.ts
845
- function CacheManager_typeof(o) { "@babel/helpers - typeof"; return CacheManager_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, CacheManager_typeof(o); }
846
- function CacheManager_slicedToArray(r, e) { return CacheManager_arrayWithHoles(r) || CacheManager_iterableToArrayLimit(r, e) || CacheManager_unsupportedIterableToArray(r, e) || CacheManager_nonIterableRest(); }
847
- function CacheManager_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
848
- function CacheManager_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
849
- function CacheManager_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
850
- function CacheManager_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = CacheManager_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
851
- function CacheManager_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return CacheManager_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? CacheManager_arrayLikeToArray(r, a) : void 0; } }
852
- function CacheManager_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
853
- function CacheManager_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
854
- function CacheManager_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, CacheManager_toPropertyKey(o.key), o); } }
855
- function CacheManager_createClass(e, r, t) { return r && CacheManager_defineProperties(e.prototype, r), t && CacheManager_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
856
- function CacheManager_toPropertyKey(t) { var i = CacheManager_toPrimitive(t, "string"); return "symbol" == CacheManager_typeof(i) ? i : i + ""; }
857
- function CacheManager_toPrimitive(t, r) { if ("object" != CacheManager_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != CacheManager_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
852
+ ;// ./src/domain/models/banner.ts
853
+ function banner_typeof(o) { "@babel/helpers - typeof"; return banner_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, banner_typeof(o); }
854
+ function banner_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, banner_toPropertyKey(o.key), o); } }
855
+ function banner_createClass(e, r, t) { return r && banner_defineProperties(e.prototype, r), t && banner_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
856
+ function banner_toPropertyKey(t) { var i = banner_toPrimitive(t, "string"); return "symbol" == banner_typeof(i) ? i : i + ""; }
857
+ function banner_toPrimitive(t, r) { if ("object" != banner_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != banner_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
858
+ function banner_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
859
+ /**
860
+ * Interface that represents the API response for banners.
861
+ * Contains the data structure as it comes from the server.
862
+ * @group Places & Locations
863
+ */
858
864
 
865
+ /**
866
+ * Class that represents a banner in MapVX.
867
+ * Contains information about the image, tags, and banner behavior.
868
+ * @group Places & Locations
869
+ */
870
+ var Banner = /*#__PURE__*/banner_createClass(
871
+ /**
872
+ * URL of the banner image
873
+ */
859
874
 
875
+ /**
876
+ * List of tags associated with the banner for filtering
877
+ */
860
878
 
879
+ /**
880
+ * Action URL to redirect to when clicking on the banner
881
+ */
861
882
 
862
883
  /**
863
- * CacheManager - Facade for managing multiple typed caches
864
- *
865
- * Replaces the old Cache singleton with a more flexible, configurable system.
866
- * Supports:
867
- * - Multiple cache types (places, routes, configurations, etc.)
868
- * - Language-aware caching
869
- * - Optional localStorage persistence
870
- * - Configurable limits and TTL per cache type
871
- *
872
- * @group Configuration
873
- *
874
- * @example
875
- * ```typescript
876
- * const cacheManager = new CacheManager({
877
- * persistent: true,
878
- * maxStorageBytes: 5 * 1024 * 1024,
879
- * configs: {
880
- * places: { maxItems: 1000, ttlMs: 60000 }
881
- * }
882
- * })
883
- *
884
- * cacheManager.setPlace("place-1", "en", placeData)
885
- * const place = cacheManager.getPlace("place-1", "en")
886
- * ```
884
+ * Indicates if the banner should open in the same window or a new one
887
885
  */
888
- var CacheManager = /*#__PURE__*/function () {
889
- function CacheManager(config) {
890
- var _config$persistent, _config$maxStorageByt;
891
- CacheManager_classCallCheck(this, CacheManager);
892
- this.caches = new Map();
893
- this.persistent = (_config$persistent = config === null || config === void 0 ? void 0 : config.persistent) !== null && _config$persistent !== void 0 ? _config$persistent : false;
894
- this.maxStorageBytes = (_config$maxStorageByt = config === null || config === void 0 ? void 0 : config.maxStorageBytes) !== null && _config$maxStorageByt !== void 0 ? _config$maxStorageByt : DEFAULT_MAX_STORAGE_BYTES;
895
886
 
896
- // Initialize all cache types
897
- var cacheTypes = ["places", "routes", "accessibleRoutes", "configurations", "categories", "vehicles", "stops", "subPlaces"];
898
- for (var _i = 0, _cacheTypes = cacheTypes; _i < _cacheTypes.length; _i++) {
899
- var _config$configs;
900
- var cacheType = _cacheTypes[_i];
901
- var cacheConfig = getCacheConfig(cacheType, config === null || config === void 0 || (_config$configs = config.configs) === null || _config$configs === void 0 ? void 0 : _config$configs[cacheType]);
902
- this.caches.set(cacheType, this.createCache(cacheConfig));
903
- }
904
- }
887
+ /**
888
+ * A description of the banner.
889
+ *
890
+ * Can contain html tags.
891
+ */
905
892
 
906
- /**
907
- * Creates a cache instance based on persistence configuration
908
- */
909
- return CacheManager_createClass(CacheManager, [{
910
- key: "createCache",
911
- value: function createCache(config) {
912
- if (this.persistent && config.persistenceKey) {
913
- return new PersistentCache(config, this.maxStorageBytes);
914
- }
915
- return new LRUCache(config);
916
- }
893
+ /**
894
+ * Creates a new banner instance from API response data
895
+ * @param rawBanner API response data containing banner information
896
+ */
897
+ function Banner(rawBanner) {
898
+ var _rawBanner$tags;
899
+ banner_classCallCheck(this, Banner);
900
+ this.url = rawBanner.url;
901
+ this.tags = (_rawBanner$tags = rawBanner.tags) !== null && _rawBanner$tags !== void 0 ? _rawBanner$tags : [];
902
+ this.urlAction = rawBanner.url_action;
903
+ this.sameLink = rawBanner.sameLink;
904
+ this.description = rawBanner.description;
905
+ });
906
+ ;// ./src/domain/models/property.ts
907
+ function property_typeof(o) { "@babel/helpers - typeof"; return property_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, property_typeof(o); }
908
+ function property_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
909
+ function property_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, property_toPropertyKey(o.key), o); } }
910
+ function property_createClass(e, r, t) { return r && property_defineProperties(e.prototype, r), t && property_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
911
+ function property_toPropertyKey(t) { var i = property_toPrimitive(t, "string"); return "symbol" == property_typeof(i) ? i : i + ""; }
912
+ function property_toPrimitive(t, r) { if ("object" != property_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != property_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
917
913
 
918
- /**
919
- * Generates a language-aware cache key
920
- */
921
- }, {
922
- key: "makeKey",
923
- value: function makeKey(id, lang) {
924
- return "".concat(id, "_").concat(lang);
925
- }
926
914
 
927
- /**
928
- * Generates a composite key for configurations
929
- */
930
- }, {
931
- key: "makeConfigKey",
932
- value: function makeConfigKey(placeId, product, lang) {
933
- return "".concat(placeId || "default", "_").concat(product || "default", "_").concat(lang);
934
- }
915
+ /**
916
+ * Base interface for all property types that a place can have.
917
+ * Defines the common fields that all properties must have.
918
+ * @group Places & Locations
919
+ */
935
920
 
936
- // ==================== Places ====================
937
- }, {
938
- key: "getPlace",
939
- value: function getPlace(id, lang) {
940
- var cache = this.caches.get("places");
941
- return cache.get(this.makeKey(id, lang));
942
- }
921
+ /**
922
+ * Interface that represents the API response for properties.
923
+ * Contains the data structure as it comes from the server.
924
+ * @group Places & Locations
925
+ */
943
926
 
944
- /**
945
- * Stores a place in cache
946
- * @param id - Place ID
947
- * @param value - Place data
948
- * @param lang - Language code
949
- */
950
- }, {
951
- key: "setPlace",
952
- value: function setPlace(id, value, lang) {
953
- var cache = this.caches.get("places");
954
- cache.set(this.makeKey(id, lang), value);
955
- }
956
- }, {
957
- key: "hasPlace",
958
- value: function hasPlace(id, lang) {
959
- var cache = this.caches.get("places");
960
- return cache.has(this.makeKey(id, lang));
961
- }
927
+ /**
928
+ * Interface that represents a transport service associated with a place.
929
+ * Extends the Property interface with transport-specific fields.
930
+ * @group Places & Locations
931
+ */
962
932
 
963
- // ==================== Routes ====================
964
- }, {
965
- key: "getRoute",
966
- value: function getRoute(destinationId) {
967
- var cache = this.caches.get("routes");
968
- return cache.get(destinationId);
969
- }
970
- }, {
971
- key: "setRoute",
972
- value: function setRoute(destinationId, value) {
973
- var cache = this.caches.get("routes");
974
- cache.set(destinationId, value);
975
- }
976
- }, {
977
- key: "cleanRoutesCache",
978
- value: function cleanRoutesCache() {
979
- this.caches.get("routes").clear();
980
- }
933
+ /**
934
+ * Interface for properties that only contain text.
935
+ * Extends Property without adding additional fields.
936
+ * @group Places & Locations
937
+ */
981
938
 
982
- // ==================== Accessible Routes ====================
983
- }, {
984
- key: "getAccessibleRoute",
985
- value: function getAccessibleRoute(destinationId) {
986
- var cache = this.caches.get("accessibleRoutes");
987
- return cache.get(destinationId);
988
- }
989
- }, {
990
- key: "setAccessibleRoute",
991
- value: function setAccessibleRoute(destinationId, value) {
992
- var cache = this.caches.get("accessibleRoutes");
993
- cache.set(destinationId, value);
994
- }
995
- }, {
996
- key: "cleanAccessibleRoutesCache",
997
- value: function cleanAccessibleRoutesCache() {
998
- this.caches.get("accessibleRoutes").clear();
999
- }
939
+ /**
940
+ * Interface for properties that have associated child places.
941
+ * Allows referencing other places from a property.
942
+ * @group Places & Locations
943
+ */
1000
944
 
1001
- // ==================== Configurations ====================
1002
- }, {
1003
- key: "getConfiguration",
1004
- value: function getConfiguration(placeId, product, lang) {
1005
- var cache = this.caches.get("configurations");
1006
- return cache.get(this.makeConfigKey(placeId, product, lang));
1007
- }
1008
- }, {
1009
- key: "setConfiguration",
1010
- value: function setConfiguration(placeId, product, lang, value) {
1011
- var cache = this.caches.get("configurations");
1012
- cache.set(this.makeConfigKey(placeId, product, lang), value);
1013
- }
945
+ /**
946
+ * Interface for properties that have nested sub-properties.
947
+ * Allows creating hierarchical property structures.
948
+ * @group Places & Locations
949
+ */
1014
950
 
1015
- // ==================== Categories ====================
1016
- }, {
1017
- key: "getCategories",
1018
- value: function getCategories(placeId, lang) {
1019
- var cache = this.caches.get("categories");
1020
- return cache.get(this.makeKey(placeId || "default", lang));
1021
- }
1022
- }, {
1023
- key: "setCategories",
1024
- value: function setCategories(placeId, lang, value) {
1025
- var cache = this.caches.get("categories");
1026
- cache.set(this.makeKey(placeId || "default", lang), value);
1027
- }
951
+ /**
952
+ * Interface for properties that have an associated URL.
953
+ * Allows redirecting to external websites from a property.
954
+ * @group Places & Locations
955
+ */
1028
956
 
1029
- // ==================== Vehicles ====================
1030
- }, {
957
+ /**
958
+ * Utility class for processing and converting properties from API responses.
959
+ * Provides methods to parse different property structures.
960
+ * @group Places & Locations
961
+ */
962
+ var PropertyUtils = /*#__PURE__*/function () {
963
+ function PropertyUtils() {
964
+ property_classCallCheck(this, PropertyUtils);
965
+ }
966
+ return property_createClass(PropertyUtils, null, [{
967
+ key: "parseProperties",
968
+ value:
969
+ /**
970
+ * Converts an array of PropertyResponse to a typed Property array.
971
+ * Handles nested properties recursively and different property types.
972
+ *
973
+ * @param response Array of PropertyResponse from the API
974
+ * @returns Processed and typed Property array
975
+ */
976
+ function parseProperties(response) {
977
+ var _this = this;
978
+ try {
979
+ var properties = [];
980
+ if (response) {
981
+ response.forEach(function (item) {
982
+ if (item.child_places) {
983
+ var _item$iconPrefix;
984
+ var childPlaces = item.child_places;
985
+ var childPlacesProperty = {
986
+ childPlaces: [],
987
+ title: item.key,
988
+ subtitle: item.text,
989
+ childParentPlace: item.child_parent_place,
990
+ icon: item.icon,
991
+ imageUrl: item.imageUrl,
992
+ iconPrefix: (_item$iconPrefix = item.iconPrefix) !== null && _item$iconPrefix !== void 0 ? _item$iconPrefix : "fas",
993
+ sortChildrenBy: item.sortChildrenBy
994
+ };
995
+ childPlaces.forEach(function (element) {
996
+ if (typeof element === "string") {
997
+ // Add id to the array of childPlaces
998
+ childPlacesProperty.childPlaces.push(element);
999
+ } else {
1000
+ // Transform object to MVXPlace and add to childPlaces array
1001
+ var mvxPlace = new MVXPlace(element);
1002
+ childPlacesProperty.childPlaces.push(mvxPlace);
1003
+ }
1004
+ });
1005
+ properties.push(childPlacesProperty);
1006
+ } else if (item.child_properties) {
1007
+ var _item$iconPrefix2;
1008
+ // Parsing child properties with recursive call
1009
+ var childProperties = item.child_properties;
1010
+ var childPropertiesProperty = {
1011
+ childProperties: [],
1012
+ title: item.key,
1013
+ subtitle: item.text,
1014
+ childParentPlace: item.child_parent_place,
1015
+ icon: item.icon,
1016
+ imageUrl: item.imageUrl,
1017
+ iconPrefix: (_item$iconPrefix2 = item.iconPrefix) !== null && _item$iconPrefix2 !== void 0 ? _item$iconPrefix2 : "fas",
1018
+ sortChildrenBy: item.sortChildrenBy
1019
+ };
1020
+ var childPropertiesResult = _this.parseProperties(childProperties);
1021
+ childPropertiesProperty.childProperties = childPropertiesResult;
1022
+ properties.push(childPropertiesProperty);
1023
+ } else if (item.url) {
1024
+ var property = {
1025
+ title: item.key,
1026
+ subtitle: item.text,
1027
+ icon: item.icon,
1028
+ imageUrl: item.imageUrl,
1029
+ iconPrefix: item.iconPrefix,
1030
+ url: item.url,
1031
+ type: item.type,
1032
+ sortChildrenBy: item.sortChildrenBy
1033
+ };
1034
+ properties.push(property);
1035
+ } else {
1036
+ var _item$iconPrefix3;
1037
+ var _property = {
1038
+ title: item.key,
1039
+ subtitle: item.text,
1040
+ childParentPlace: item.child_parent_place,
1041
+ icon: item.icon,
1042
+ imageUrl: item.imageUrl,
1043
+ type: item.type,
1044
+ iconPrefix: (_item$iconPrefix3 = item.iconPrefix) !== null && _item$iconPrefix3 !== void 0 ? _item$iconPrefix3 : "fas",
1045
+ sortChildrenBy: item.sortChildrenBy
1046
+ };
1047
+ properties.push(_property);
1048
+ }
1049
+ });
1050
+ }
1051
+ return properties;
1052
+ } catch (err) {
1053
+ console.log(err);
1054
+ console.log(response);
1055
+ return [];
1056
+ }
1057
+ }
1058
+ }]);
1059
+ }();
1060
+ ;// ./src/domain/models/place.ts
1061
+ function place_typeof(o) { "@babel/helpers - typeof"; return place_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, place_typeof(o); }
1062
+ function place_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1063
+ function place_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? place_ownKeys(Object(t), !0).forEach(function (r) { place_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : place_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1064
+ function place_defineProperty(e, r, t) { return (r = place_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
1065
+ function place_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
1066
+ function place_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, place_toPropertyKey(o.key), o); } }
1067
+ function place_createClass(e, r, t) { return r && place_defineProperties(e.prototype, r), t && place_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
1068
+ function place_toPropertyKey(t) { var i = place_toPrimitive(t, "string"); return "symbol" == place_typeof(i) ? i : i + ""; }
1069
+ function place_toPrimitive(t, r) { if ("object" != place_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != place_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1070
+
1071
+
1072
+
1073
+ /**
1074
+ * Query used to look up a single place.
1075
+ *
1076
+ * The {@link PlaceQuery.id} can be an internal alias defined by the integrator.
1077
+ * Because aliases are not guaranteed to be globally unique (the same alias may be
1078
+ * reused across different buildings/venues, e.g. the same store alias present in
1079
+ * several shopping malls), provide {@link PlaceQuery.buildingId} —and optionally
1080
+ * {@link PlaceQuery.floorId}— to disambiguate which place the alias refers to.
1081
+ *
1082
+ * This mirrors the disambiguation already available for routes via `IdLocation`.
1083
+ *
1084
+ * @example
1085
+ * ```typescript
1086
+ * // Resolve an alias reused across several malls by pinning the building.
1087
+ * const query: PlaceQuery = {
1088
+ * id: "store-204", // integrator alias, may repeat across buildings
1089
+ * buildingId: "mall-santiago",
1090
+ * floorId: "level-2", // optional; takes precedence over `level`
1091
+ * }
1092
+ * ```
1093
+ *
1094
+ * @group Places & Locations
1095
+ */
1096
+
1097
+ /**
1098
+ * MapVX place object, is a custom object containing data of a specific real place.
1099
+ * Represents a physical location with all its associated metadata and properties.
1100
+ *
1101
+ * @example
1102
+ * ```typescript
1103
+ * const place = new MVXPlace(placeResponse);
1104
+ * console.log(place.title); // "Coffee Shop"
1105
+ * console.log(place.position); // { lat: 40.7128, lng: -74.0060 }
1106
+ * ```
1107
+ *
1108
+ * @group Places & Locations
1109
+ */
1110
+ var MVXPlace = /*#__PURE__*/function () {
1111
+ /**
1112
+ * Unique identifier to reference the place in MapVX system
1113
+ */
1114
+
1115
+ /**
1116
+ * Client-side identifier for the place (optional)
1117
+ * Used for custom identification in client applications
1118
+ */
1119
+
1120
+ /**
1121
+ * Title text for the place (localized based on client language)
1122
+ */
1123
+
1124
+ /**
1125
+ * Detailed description text for the place (localized based on client language)
1126
+ */
1127
+
1128
+ /**
1129
+ * Short description text for the place (localized based on client language)
1130
+ */
1131
+
1132
+ /**
1133
+ * Central position coordinates for the place
1134
+ * @see {@link LatLng} for coordinate structure
1135
+ */
1136
+
1137
+ /**
1138
+ * Flag to control visibility of the place in search results
1139
+ */
1140
+
1141
+ /**
1142
+ * Category identifier for the place
1143
+ */
1144
+
1145
+ /**
1146
+ * Localized category name for the place (based on client language)
1147
+ */
1148
+
1149
+ /**
1150
+ * General purpose category string for the place (localized)
1151
+ */
1152
+
1153
+ /**
1154
+ * Floors available in the parent place. If this exists, the place is indoor.
1155
+ * Otherwise, the place is considered outdoor.
1156
+ * @see {@link InnerFloor} for floor structure
1157
+ */
1158
+
1159
+ /**
1160
+ * Specific floor identifiers where this place exists (for indoor locations)
1161
+ */
1162
+
1163
+ /**
1164
+ * Unique identifier of the institution to which this place belongs
1165
+ */
1166
+
1167
+ /**
1168
+ * Business hours when the place is open
1169
+ * @see {@link OpeningHours} for schedule structure
1170
+ */
1171
+
1172
+ /**
1173
+ * Physical address of the place in plain text (if provided)
1174
+ */
1175
+
1176
+ /**
1177
+ * Transport services associated with this place
1178
+ * @see {@link TransportLine} for transport service structure
1179
+ */
1180
+
1181
+ /**
1182
+ * URL of the place's logo image
1183
+ */
1184
+
1185
+ /**
1186
+ * List of available image URLs for the place
1187
+ */
1188
+
1189
+ /**
1190
+ * List of available banner images for the place
1191
+ * @see {@link Banner} for banner structure
1192
+ */
1193
+
1194
+ /**
1195
+ * List of properties connected to the place
1196
+ * @see {@link Property} for property structure
1197
+ */
1198
+
1199
+ /**
1200
+ * Unique identifier of the parent place or object
1201
+ */
1202
+
1203
+ /**
1204
+ * Type of the object being referenced by {@link parentId}
1205
+ */
1206
+
1207
+ /**
1208
+ * Tags associated with the place for categorization and filtering
1209
+ */
1210
+
1211
+ /**
1212
+ * Metadata of the place.
1213
+ */
1214
+
1215
+ /**
1216
+ * Visibility of the place
1217
+ */
1218
+
1219
+ /**
1220
+ * Creates a new place instance with the parameters specified in the data.
1221
+ *
1222
+ * @param rawPlace - JSON configuration parameters for the place from API response
1223
+ * @returns A new instance of MVXPlace
1224
+ *
1225
+ * @example
1226
+ * ```typescript
1227
+ * const placeResponse = await fetchPlaceData(placeId);
1228
+ * const place = new MVXPlace(placeResponse);
1229
+ * ```
1230
+ */
1231
+ function MVXPlace(rawPlace) {
1232
+ var _rawPlace$tags, _rawPlace$keywords, _rawPlace$alias, _rawPlace$tags2, _rawPlace$localizedCa, _rawPlace$properties, _rawPlace$images, _rawPlace$banners, _rawPlace$properties2, _rawPlace$visibility;
1233
+ place_classCallCheck(this, MVXPlace);
1234
+ var tagsAndKeywords = ((_rawPlace$tags = rawPlace.tags) !== null && _rawPlace$tags !== void 0 ? _rawPlace$tags : []).concat((_rawPlace$keywords = rawPlace.keywords) !== null && _rawPlace$keywords !== void 0 ? _rawPlace$keywords : []);
1235
+ this.mapvxId = rawPlace.id;
1236
+ this.clientId = (_rawPlace$alias = rawPlace.alias) !== null && _rawPlace$alias !== void 0 ? _rawPlace$alias : rawPlace.externalId;
1237
+ this.title = rawPlace.title;
1238
+ this.hidePlace = tagsAndKeywords.includes("hide_search");
1239
+ this.description = rawPlace.description;
1240
+ this.shortDescription = rawPlace.shortDescription;
1241
+ // @ts-expect-error - lon is not in the type but search results have it
1242
+ this.position = {
1243
+ lat: rawPlace.lat,
1244
+ lng: rawPlace.lng || rawPlace.lon
1245
+ };
1246
+ this.category = rawPlace.category;
1247
+ this.tags = (_rawPlace$tags2 = rawPlace.tags) !== null && _rawPlace$tags2 !== void 0 ? _rawPlace$tags2 : [];
1248
+ this.generalCategory = rawPlace.general_category;
1249
+ this.localizedCategory = (_rawPlace$localizedCa = rawPlace.localizedCategory) !== null && _rawPlace$localizedCa !== void 0 ? _rawPlace$localizedCa : "";
1250
+ this.parentInstitutionId = rawPlace.parent_institution;
1251
+ this.inFloors = rawPlace.inFloor;
1252
+ this.innerFloors = [];
1253
+ for (var key in rawPlace.innerFloors) {
1254
+ this.innerFloors.push(place_objectSpread(place_objectSpread({}, rawPlace.innerFloors[key]), {}, {
1255
+ key: key
1256
+ }));
1257
+ }
1258
+ this.innerFloors.sort(function (a, b) {
1259
+ return a.index - b.index;
1260
+ });
1261
+ this.openingHours = rawPlace.opening_hours;
1262
+ this.address = rawPlace.address;
1263
+ this.transportLine = (_rawPlace$properties = rawPlace.properties) === null || _rawPlace$properties === void 0 ? void 0 : _rawPlace$properties.filter(function (p) {
1264
+ return p.type === "transport_line";
1265
+ });
1266
+ if (rawPlace.logo) {
1267
+ this.logo = typeof rawPlace.logo === "string" ? rawPlace.logo : rawPlace.logo.light;
1268
+ }
1269
+ this.images = (_rawPlace$images = rawPlace.images) !== null && _rawPlace$images !== void 0 ? _rawPlace$images : [];
1270
+ this.banners = ((_rawPlace$banners = rawPlace.banners) !== null && _rawPlace$banners !== void 0 ? _rawPlace$banners : []).map(function (bannerResponse) {
1271
+ return new Banner(bannerResponse);
1272
+ });
1273
+ this.properties = PropertyUtils.parseProperties((_rawPlace$properties2 = rawPlace.properties) !== null && _rawPlace$properties2 !== void 0 ? _rawPlace$properties2 : []);
1274
+ this.parentId = rawPlace.parent_id;
1275
+ this.parentType = rawPlace.parent_type;
1276
+ this.metadata = rawPlace.metadata;
1277
+ this.visibility = (_rawPlace$visibility = rawPlace.visibility) !== null && _rawPlace$visibility !== void 0 ? _rawPlace$visibility : "public";
1278
+ }
1279
+
1280
+ /**
1281
+ * Rebuilds an {@link MVXPlace} from a value that has lost its prototype — e.g. a
1282
+ * place rehydrated from the persistent (localStorage) cache, where `JSON.parse`
1283
+ * produces a plain object stripped of the class methods.
1284
+ *
1285
+ * The place's methods only read its own data fields, so restoring the prototype is
1286
+ * sufficient; the raw API {@link PlaceResponse} shape is not needed (and would not
1287
+ * fit, since a serialized place already carries the mapped `MVXPlace` fields). Live
1288
+ * instances and non-object values are returned unchanged.
1289
+ *
1290
+ * @param value - A cached place value (plain object) or an existing instance.
1291
+ * @returns An MVXPlace whose methods (e.g. {@link inFloor}) work again.
1292
+ *
1293
+ * @example
1294
+ * ```typescript
1295
+ * const place = MVXPlace.fromCache(cachedValue);
1296
+ * place.inFloor(parentFloors); // no longer throws
1297
+ * ```
1298
+ */
1299
+ return place_createClass(MVXPlace, [{
1300
+ key: "inFloor",
1301
+ value:
1302
+ /**
1303
+ * Returns the floor in which the place exists as an InnerFloor object.
1304
+ * If no matching available floor is found or if the place is not indoor,
1305
+ * an undefined value will be returned.
1306
+ *
1307
+ * @param parentPlaceFloors - Array of existing parent place floors to search in
1308
+ * @returns The matching InnerFloor object or undefined if not found
1309
+ *
1310
+ * @example
1311
+ * ```typescript
1312
+ * const buildingFloors = getBuildingFloors();
1313
+ * const placeFloor = place.inFloor(buildingFloors);
1314
+ * if (placeFloor) {
1315
+ * console.log(`Place is on floor: ${placeFloor.name}`);
1316
+ * }
1317
+ * ```
1318
+ */
1319
+ function inFloor(parentPlaceFloors) {
1320
+ var _this = this;
1321
+ if (!this.inFloors || this.inFloors.length === 0) {
1322
+ // outdoor place
1323
+ return parentPlaceFloors.find(function (floor) {
1324
+ return floor.reachableFromGPS;
1325
+ });
1326
+ }
1327
+ return parentPlaceFloors.find(function (floor) {
1328
+ var _this$inFloors;
1329
+ return floor.key === ((_this$inFloors = _this.inFloors) === null || _this$inFloors === void 0 ? void 0 : _this$inFloors[0]);
1330
+ });
1331
+ }
1332
+
1333
+ /**
1334
+ * Returns a string representation of the place
1335
+ * @returns String in format "MVXPlace {mapvxId}"
1336
+ */
1337
+ }, {
1338
+ key: "toString",
1339
+ value: function toString() {
1340
+ return "MVXPlace ".concat(this.mapvxId);
1341
+ }
1342
+ }], [{
1343
+ key: "fromCache",
1344
+ value: function fromCache(value) {
1345
+ if (value instanceof MVXPlace) return value;
1346
+ if (value === null || place_typeof(value) !== "object") return value;
1347
+ return Object.assign(Object.create(MVXPlace.prototype), value);
1348
+ }
1349
+ }]);
1350
+ }();
1351
+ ;// ./src/infrastructure/cache/CacheManager.ts
1352
+ function CacheManager_typeof(o) { "@babel/helpers - typeof"; return CacheManager_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, CacheManager_typeof(o); }
1353
+ function CacheManager_slicedToArray(r, e) { return CacheManager_arrayWithHoles(r) || CacheManager_iterableToArrayLimit(r, e) || CacheManager_unsupportedIterableToArray(r, e) || CacheManager_nonIterableRest(); }
1354
+ function CacheManager_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1355
+ function CacheManager_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
1356
+ function CacheManager_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
1357
+ function CacheManager_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = CacheManager_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1358
+ function CacheManager_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return CacheManager_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? CacheManager_arrayLikeToArray(r, a) : void 0; } }
1359
+ function CacheManager_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1360
+ function CacheManager_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
1361
+ function CacheManager_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, CacheManager_toPropertyKey(o.key), o); } }
1362
+ function CacheManager_createClass(e, r, t) { return r && CacheManager_defineProperties(e.prototype, r), t && CacheManager_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
1363
+ function CacheManager_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1364
+ function CacheManager_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? CacheManager_ownKeys(Object(t), !0).forEach(function (r) { CacheManager_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : CacheManager_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1365
+ function CacheManager_defineProperty(e, r, t) { return (r = CacheManager_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
1366
+ function CacheManager_toPropertyKey(t) { var i = CacheManager_toPrimitive(t, "string"); return "symbol" == CacheManager_typeof(i) ? i : i + ""; }
1367
+ function CacheManager_toPrimitive(t, r) { if ("object" != CacheManager_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != CacheManager_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1368
+
1369
+
1370
+
1371
+
1372
+ /**
1373
+ * Per-type revivers restoring class prototypes lost when the persistent cache
1374
+ * rehydrates values from localStorage (`JSON.parse` yields plain objects without
1375
+ * methods). Only caches that hold class instances need an entry; plain-data caches
1376
+ * (routes, configurations, etc.) are left untouched.
1377
+ */
1378
+ var CACHE_DESERIALIZERS = {
1379
+ // `places` stores MVXPlace instances.
1380
+ places: function places(value) {
1381
+ return MVXPlace.fromCache(value);
1382
+ },
1383
+ // `subPlaces` stores a DataSnapshot wrapping an MVXPlace[].
1384
+ subPlaces: function subPlaces(value) {
1385
+ var snapshot = value;
1386
+ if (!snapshot || !Array.isArray(snapshot.data)) return value;
1387
+ return CacheManager_objectSpread(CacheManager_objectSpread({}, snapshot), {}, {
1388
+ data: snapshot.data.map(function (place) {
1389
+ return MVXPlace.fromCache(place);
1390
+ })
1391
+ });
1392
+ }
1393
+ };
1394
+
1395
+ /**
1396
+ * CacheManager - Facade for managing multiple typed caches
1397
+ *
1398
+ * Replaces the old Cache singleton with a more flexible, configurable system.
1399
+ * Supports:
1400
+ * - Multiple cache types (places, routes, configurations, etc.)
1401
+ * - Language-aware caching
1402
+ * - Optional localStorage persistence
1403
+ * - Configurable limits and TTL per cache type
1404
+ *
1405
+ * @group Configuration
1406
+ *
1407
+ * @example
1408
+ * ```typescript
1409
+ * const cacheManager = new CacheManager({
1410
+ * persistent: true,
1411
+ * maxStorageBytes: 5 * 1024 * 1024,
1412
+ * configs: {
1413
+ * places: { maxItems: 1000, ttlMs: 60000 }
1414
+ * }
1415
+ * })
1416
+ *
1417
+ * cacheManager.setPlace("place-1", "en", placeData)
1418
+ * const place = cacheManager.getPlace("place-1", "en")
1419
+ * ```
1420
+ */
1421
+ var CacheManager = /*#__PURE__*/function () {
1422
+ function CacheManager(config) {
1423
+ var _config$persistent, _config$maxStorageByt;
1424
+ CacheManager_classCallCheck(this, CacheManager);
1425
+ this.caches = new Map();
1426
+ this.persistent = (_config$persistent = config === null || config === void 0 ? void 0 : config.persistent) !== null && _config$persistent !== void 0 ? _config$persistent : false;
1427
+ this.maxStorageBytes = (_config$maxStorageByt = config === null || config === void 0 ? void 0 : config.maxStorageBytes) !== null && _config$maxStorageByt !== void 0 ? _config$maxStorageByt : DEFAULT_MAX_STORAGE_BYTES;
1428
+
1429
+ // Initialize all cache types
1430
+ var cacheTypes = ["places", "routes", "accessibleRoutes", "configurations", "categories", "vehicles", "stops", "subPlaces"];
1431
+ for (var _i = 0, _cacheTypes = cacheTypes; _i < _cacheTypes.length; _i++) {
1432
+ var _config$configs;
1433
+ var cacheType = _cacheTypes[_i];
1434
+ var cacheConfig = getCacheConfig(cacheType, config === null || config === void 0 || (_config$configs = config.configs) === null || _config$configs === void 0 ? void 0 : _config$configs[cacheType]);
1435
+ this.caches.set(cacheType, this.createCache(cacheConfig, CACHE_DESERIALIZERS[cacheType]));
1436
+ }
1437
+ }
1438
+
1439
+ /**
1440
+ * Creates a cache instance based on persistence configuration.
1441
+ *
1442
+ * @param config - Per-type cache configuration.
1443
+ * @param deserialize - Optional reviver forwarded to the persistent cache to
1444
+ * rebuild class prototypes when values are rehydrated from localStorage.
1445
+ */
1446
+ return CacheManager_createClass(CacheManager, [{
1447
+ key: "createCache",
1448
+ value: function createCache(config, deserialize) {
1449
+ if (this.persistent && config.persistenceKey) {
1450
+ return new PersistentCache(config, this.maxStorageBytes, deserialize);
1451
+ }
1452
+ return new LRUCache(config);
1453
+ }
1454
+
1455
+ /**
1456
+ * Generates a language-aware cache key
1457
+ */
1458
+ }, {
1459
+ key: "makeKey",
1460
+ value: function makeKey(id, lang) {
1461
+ return "".concat(id, "_").concat(lang);
1462
+ }
1463
+
1464
+ /**
1465
+ * Generates a composite key for configurations
1466
+ */
1467
+ }, {
1468
+ key: "makeConfigKey",
1469
+ value: function makeConfigKey(placeId, product, lang) {
1470
+ return "".concat(placeId || "default", "_").concat(product || "default", "_").concat(lang);
1471
+ }
1472
+
1473
+ // ==================== Places ====================
1474
+ }, {
1475
+ key: "getPlace",
1476
+ value: function getPlace(id, lang) {
1477
+ var cache = this.caches.get("places");
1478
+ return cache.get(this.makeKey(id, lang));
1479
+ }
1480
+
1481
+ /**
1482
+ * Stores a place in cache
1483
+ * @param id - Place ID
1484
+ * @param value - Place data
1485
+ * @param lang - Language code
1486
+ */
1487
+ }, {
1488
+ key: "setPlace",
1489
+ value: function setPlace(id, value, lang) {
1490
+ var cache = this.caches.get("places");
1491
+ cache.set(this.makeKey(id, lang), value);
1492
+ }
1493
+ }, {
1494
+ key: "hasPlace",
1495
+ value: function hasPlace(id, lang) {
1496
+ var cache = this.caches.get("places");
1497
+ return cache.has(this.makeKey(id, lang));
1498
+ }
1499
+
1500
+ // ==================== Routes ====================
1501
+ }, {
1502
+ key: "getRoute",
1503
+ value: function getRoute(destinationId) {
1504
+ var cache = this.caches.get("routes");
1505
+ return cache.get(destinationId);
1506
+ }
1507
+ }, {
1508
+ key: "setRoute",
1509
+ value: function setRoute(destinationId, value) {
1510
+ var cache = this.caches.get("routes");
1511
+ cache.set(destinationId, value);
1512
+ }
1513
+ }, {
1514
+ key: "cleanRoutesCache",
1515
+ value: function cleanRoutesCache() {
1516
+ this.caches.get("routes").clear();
1517
+ }
1518
+
1519
+ // ==================== Accessible Routes ====================
1520
+ }, {
1521
+ key: "getAccessibleRoute",
1522
+ value: function getAccessibleRoute(destinationId) {
1523
+ var cache = this.caches.get("accessibleRoutes");
1524
+ return cache.get(destinationId);
1525
+ }
1526
+ }, {
1527
+ key: "setAccessibleRoute",
1528
+ value: function setAccessibleRoute(destinationId, value) {
1529
+ var cache = this.caches.get("accessibleRoutes");
1530
+ cache.set(destinationId, value);
1531
+ }
1532
+ }, {
1533
+ key: "cleanAccessibleRoutesCache",
1534
+ value: function cleanAccessibleRoutesCache() {
1535
+ this.caches.get("accessibleRoutes").clear();
1536
+ }
1537
+
1538
+ // ==================== Configurations ====================
1539
+ }, {
1540
+ key: "getConfiguration",
1541
+ value: function getConfiguration(placeId, product, lang) {
1542
+ var cache = this.caches.get("configurations");
1543
+ return cache.get(this.makeConfigKey(placeId, product, lang));
1544
+ }
1545
+ }, {
1546
+ key: "setConfiguration",
1547
+ value: function setConfiguration(placeId, product, lang, value) {
1548
+ var cache = this.caches.get("configurations");
1549
+ cache.set(this.makeConfigKey(placeId, product, lang), value);
1550
+ }
1551
+
1552
+ // ==================== Categories ====================
1553
+ }, {
1554
+ key: "getCategories",
1555
+ value: function getCategories(placeId, lang) {
1556
+ var cache = this.caches.get("categories");
1557
+ return cache.get(this.makeKey(placeId || "default", lang));
1558
+ }
1559
+ }, {
1560
+ key: "setCategories",
1561
+ value: function setCategories(placeId, lang, value) {
1562
+ var cache = this.caches.get("categories");
1563
+ cache.set(this.makeKey(placeId || "default", lang), value);
1564
+ }
1565
+
1566
+ // ==================== Vehicles ====================
1567
+ }, {
1031
1568
  key: "getVehicle",
1032
1569
  value: function getVehicle(id, lang) {
1033
1570
  var cache = this.caches.get("vehicles");
@@ -10705,7 +11242,7 @@ const extractSafariExtensionDetails = (func, filename) => {
10705
11242
  // replaced with the package version by scripts/inject-build-defines.js. The DSN
10706
11243
  // falls back to the public MapVX Sentry project DSN when none is injected at
10707
11244
  // build time — a DSN's public key is safe to ship in the client bundle.
10708
- var sentry_SDK_VERSION = true ? "2.0.1" : 0;
11245
+ var sentry_SDK_VERSION = true ? "2.0.2" : 0;
10709
11246
  var DSN = false ? 0 : "https://872f598f020e3cd73a0933b562d24c81@sentry.mapvx.app/5";
10710
11247
 
10711
11248
  /**
@@ -11231,7 +11768,7 @@ function createRouteAnimationIconDataUrl(config) {
11231
11768
  */
11232
11769
  var routeAnimationDataUrl = createRouteAnimationIconDataUrl();
11233
11770
  ;// ./src/utils/utils.ts
11234
- /* unused harmony import specifier */ var MVXPlace;
11771
+ /* unused harmony import specifier */ var utils_MVXPlace;
11235
11772
 
11236
11773
 
11237
11774
  /**
@@ -11257,7 +11794,7 @@ function generateHexadecimalKey() {
11257
11794
  function formatArrayPlaceData(places) {
11258
11795
  var formattedData = [];
11259
11796
  places.forEach(function (place) {
11260
- formattedData.push(new MVXPlace(place));
11797
+ formattedData.push(new utils_MVXPlace(place));
11261
11798
  });
11262
11799
  return formattedData;
11263
11800
  }
@@ -14368,716 +14905,244 @@ var MVXRoute = /*#__PURE__*/function () {
14368
14905
  * This property calculates the sum of the length of all legs in the route.
14369
14906
  *
14370
14907
  * @returns {number} The total length of the route, in meters.
14371
- */
14372
- }, {
14373
- key: "length",
14374
- get: function get() {
14375
- return this.legs.map(function (leg) {
14376
- return leg.distance;
14377
- }).reduce(function (accumulator, currentValue) {
14378
- return accumulator + currentValue;
14379
- }, 0);
14380
- }
14381
- }]);
14382
- }();
14383
-
14384
- /**
14385
- * Represents a route leg that connects two specific points.
14386
- * Each leg contains information about distance, duration, and detailed steps.
14387
- * @group Routes
14388
- */
14389
- var MVXRouteLeg = /*#__PURE__*/route_createClass(
14390
- /**
14391
- * Total distance of the leg in meters
14392
- */
14393
-
14394
- /**
14395
- * Estimated duration of the leg in seconds
14396
- */
14397
-
14398
- /**
14399
- * Starting location of the leg
14400
- */
14401
-
14402
- /**
14403
- * Ending location of the leg
14404
- */
14405
-
14406
- /**
14407
- * List of detailed steps that compose this leg
14408
- */
14409
-
14410
- /**
14411
- * Creates a new route leg instance from response data
14412
- * @hidden
14413
- * @param data API response data containing leg information
14414
- */
14415
- function MVXRouteLeg(data) {
14416
- var _this2 = this;
14417
- route_classCallCheck(this, MVXRouteLeg);
14418
- this.distance = data.distance.value;
14419
- this.duration = data.duration.value;
14420
- this.startLocation = data.start_location;
14421
- this.endLocation = data.end_location;
14422
- this.steps = [];
14423
- data.steps.forEach(function (stepData) {
14424
- var step = new MVXRouteStep(stepData);
14425
- _this2.steps.push(step);
14426
- });
14427
- });
14428
-
14429
- /**
14430
- * Represents an individual step within a route leg.
14431
- * Each step contains specific instructions and coordinates for navigation.
14432
- * @group Routes
14433
- */
14434
- var MVXRouteStep = /*#__PURE__*/function () {
14435
- /**
14436
- * Distance of the step in meters
14437
- */
14438
-
14439
- /**
14440
- * Estimated duration of the step in seconds
14441
- */
14442
-
14443
- /**
14444
- * Starting location of the step
14445
- */
14446
-
14447
- /**
14448
- * Identifier of the floor where the step begins (if applicable)
14449
- */
14450
-
14451
- /**
14452
- * Identifier of the place where the step begins (if applicable)
14453
- */
14454
-
14455
- /**
14456
- * Ending location of the step
14457
- */
14458
-
14459
- /**
14460
- * Identifier of the floor where the step ends (if applicable)
14461
- */
14462
-
14463
- /**
14464
- * Identifier of the place where the step ends (if applicable)
14465
- */
14466
-
14467
- /**
14468
- * HTML formatted instructions to display to the user
14469
- */
14470
-
14471
- /**
14472
- * Plain text instructions to display to the user
14473
- */
14474
-
14475
- /**
14476
- * Type of maneuver the user should perform (e.g., "turn-left", "straight")
14477
- */
14478
-
14479
- /**
14480
- * Indicates if a popup with additional information should be shown
14481
- */
14482
-
14483
- /**
14484
- * Icon prefix to display for this step
14485
- */
14486
-
14487
- /**
14488
- * Indicates if this step involves using an elevator
14489
- */
14490
-
14491
- /**
14492
- * Object containing the polyline information for the step
14493
- * @hidden
14494
- */
14495
-
14496
- /**
14497
- * Creates a new route step instance from response data
14498
- * @hidden
14499
- * @param data API response data containing step information
14500
- */
14501
- function MVXRouteStep(data) {
14502
- route_classCallCheck(this, MVXRouteStep);
14503
- this.distance = data.distance.value;
14504
- this.duration = data.duration.value;
14505
- this.startLocation = data.start_location;
14506
- this.startInsideFloor = data.start_inside_floor;
14507
- this.startInsidePlace = data.start_inside_place;
14508
- this.endLocation = data.end_location;
14509
- this.endInsideFloor = data.end_inside_floor;
14510
- this.endInsidePlace = data.end_inside_place;
14511
- this.htmlInstruction = data.html_instructions;
14512
- this.plainInstruction = data.plain_instructions;
14513
- this.maneuver = data.maneuver;
14514
- this.elevatorStep = data.elevator_step;
14515
- this.showPopup = data.show_popup;
14516
- this.iconPrefix = data.icon_prefix;
14517
- this.polyline = new Polyline(data.polyline);
14518
- }
14519
-
14520
- /**
14521
- * Gets the polyline coordinates in GeoJSON format
14522
- * @returns Array of coordinates in [longitude, latitude] format
14523
- */
14524
- return route_createClass(MVXRouteStep, [{
14525
- key: "geoJsonCoordinates",
14526
- get: function get() {
14527
- return this.polyline.geoJsonCoordinates;
14528
- }
14529
-
14530
- /**
14531
- * Gets the polyline coordinates in LatLng format
14532
- * @returns Array of LatLng coordinates
14533
- */
14534
- }, {
14535
- key: "coordinates",
14536
- get: function get() {
14537
- return this.polyline.coordinates;
14538
- }
14539
- }]);
14540
- }();
14541
-
14542
- /**
14543
- * Internal class that handles polyline decoding and management.
14544
- * A polyline is an encoded representation of a series of coordinates.
14545
- */
14546
- var Polyline = /*#__PURE__*/function () {
14547
- /**
14548
- * Encoded string of polyline points
14549
- */
14550
-
14551
- /**
14552
- * Polyline points in LatLng format (optional)
14553
- */
14554
-
14555
- /**
14556
- * Overview points of the polyline (optional)
14557
- */
14558
-
14559
- /**
14560
- * Decoded points of the polyline
14561
- */
14562
-
14563
- /**
14564
- * Creates a new polyline instance from response data
14565
- * @param data Response data containing polyline information
14566
- */
14567
- function Polyline(data) {
14568
- route_classCallCheck(this, Polyline);
14569
- this.points = data.points;
14570
- this.pointsLatLng = data.points_lat_lng;
14571
- this.overviewPoints = data.overview_points;
14572
- this.decodedPoints = decode(data.points).map(function (point) {
14573
- return {
14574
- lat: point[0],
14575
- lng: point[1]
14576
- };
14577
- });
14578
- }
14579
-
14580
- /**
14581
- * Gets coordinates in GeoJSON format
14582
- * @returns Array of coordinates in [longitude, latitude] format
14583
- */
14584
- return route_createClass(Polyline, [{
14585
- key: "geoJsonCoordinates",
14586
- get: function get() {
14587
- if (this.overviewPoints != null) {
14588
- return this.overviewPoints.map(function (point) {
14589
- return [point.lng, point.lat];
14590
- });
14591
- } else {
14592
- return this.decodedPoints.map(function (point) {
14593
- return [point.lng, point.lat];
14594
- });
14595
- }
14596
- }
14597
-
14598
- /**
14599
- * Gets coordinates in LatLng format
14600
- * @returns Array of LatLng coordinates
14601
- */
14602
- }, {
14603
- key: "coordinates",
14604
- get: function get() {
14605
- if (this.overviewPoints != null) {
14606
- return this.overviewPoints;
14607
- } else {
14608
- return this.decodedPoints;
14609
- }
14908
+ */
14909
+ }, {
14910
+ key: "length",
14911
+ get: function get() {
14912
+ return this.legs.map(function (leg) {
14913
+ return leg.distance;
14914
+ }).reduce(function (accumulator, currentValue) {
14915
+ return accumulator + currentValue;
14916
+ }, 0);
14610
14917
  }
14611
14918
  }]);
14612
14919
  }();
14613
- ;// ./src/domain/models/banner.ts
14614
- function banner_typeof(o) { "@babel/helpers - typeof"; return banner_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, banner_typeof(o); }
14615
- function banner_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, banner_toPropertyKey(o.key), o); } }
14616
- function banner_createClass(e, r, t) { return r && banner_defineProperties(e.prototype, r), t && banner_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
14617
- function banner_toPropertyKey(t) { var i = banner_toPrimitive(t, "string"); return "symbol" == banner_typeof(i) ? i : i + ""; }
14618
- function banner_toPrimitive(t, r) { if ("object" != banner_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != banner_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14619
- function banner_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14620
- /**
14621
- * Interface that represents the API response for banners.
14622
- * Contains the data structure as it comes from the server.
14623
- * @group Places & Locations
14624
- */
14625
14920
 
14626
14921
  /**
14627
- * Class that represents a banner in MapVX.
14628
- * Contains information about the image, tags, and banner behavior.
14629
- * @group Places & Locations
14922
+ * Represents a route leg that connects two specific points.
14923
+ * Each leg contains information about distance, duration, and detailed steps.
14924
+ * @group Routes
14630
14925
  */
14631
- var Banner = /*#__PURE__*/banner_createClass(
14926
+ var MVXRouteLeg = /*#__PURE__*/route_createClass(
14632
14927
  /**
14633
- * URL of the banner image
14928
+ * Total distance of the leg in meters
14634
14929
  */
14635
14930
 
14636
14931
  /**
14637
- * List of tags associated with the banner for filtering
14932
+ * Estimated duration of the leg in seconds
14638
14933
  */
14639
14934
 
14640
14935
  /**
14641
- * Action URL to redirect to when clicking on the banner
14936
+ * Starting location of the leg
14642
14937
  */
14643
14938
 
14644
14939
  /**
14645
- * Indicates if the banner should open in the same window or a new one
14940
+ * Ending location of the leg
14646
14941
  */
14647
14942
 
14648
14943
  /**
14649
- * A description of the banner.
14650
- *
14651
- * Can contain html tags.
14944
+ * List of detailed steps that compose this leg
14652
14945
  */
14653
14946
 
14654
14947
  /**
14655
- * Creates a new banner instance from API response data
14656
- * @param rawBanner API response data containing banner information
14948
+ * Creates a new route leg instance from response data
14949
+ * @hidden
14950
+ * @param data API response data containing leg information
14657
14951
  */
14658
- function Banner(rawBanner) {
14659
- var _rawBanner$tags;
14660
- banner_classCallCheck(this, Banner);
14661
- this.url = rawBanner.url;
14662
- this.tags = (_rawBanner$tags = rawBanner.tags) !== null && _rawBanner$tags !== void 0 ? _rawBanner$tags : [];
14663
- this.urlAction = rawBanner.url_action;
14664
- this.sameLink = rawBanner.sameLink;
14665
- this.description = rawBanner.description;
14952
+ function MVXRouteLeg(data) {
14953
+ var _this2 = this;
14954
+ route_classCallCheck(this, MVXRouteLeg);
14955
+ this.distance = data.distance.value;
14956
+ this.duration = data.duration.value;
14957
+ this.startLocation = data.start_location;
14958
+ this.endLocation = data.end_location;
14959
+ this.steps = [];
14960
+ data.steps.forEach(function (stepData) {
14961
+ var step = new MVXRouteStep(stepData);
14962
+ _this2.steps.push(step);
14963
+ });
14666
14964
  });
14667
- ;// ./src/domain/models/place.ts
14668
- function place_typeof(o) { "@babel/helpers - typeof"; return place_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, place_typeof(o); }
14669
- function place_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14670
- function place_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? place_ownKeys(Object(t), !0).forEach(function (r) { place_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : place_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14671
- function place_defineProperty(e, r, t) { return (r = place_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14672
- function place_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14673
- function place_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, place_toPropertyKey(o.key), o); } }
14674
- function place_createClass(e, r, t) { return r && place_defineProperties(e.prototype, r), t && place_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
14675
- function place_toPropertyKey(t) { var i = place_toPrimitive(t, "string"); return "symbol" == place_typeof(i) ? i : i + ""; }
14676
- function place_toPrimitive(t, r) { if ("object" != place_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != place_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14677
-
14678
-
14679
-
14680
- /**
14681
- * Query used to look up a single place.
14682
- *
14683
- * The {@link PlaceQuery.id} can be an internal alias defined by the integrator.
14684
- * Because aliases are not guaranteed to be globally unique (the same alias may be
14685
- * reused across different buildings/venues, e.g. the same store alias present in
14686
- * several shopping malls), provide {@link PlaceQuery.buildingId} —and optionally
14687
- * {@link PlaceQuery.floorId}— to disambiguate which place the alias refers to.
14688
- *
14689
- * This mirrors the disambiguation already available for routes via `IdLocation`.
14690
- *
14691
- * @example
14692
- * ```typescript
14693
- * // Resolve an alias reused across several malls by pinning the building.
14694
- * const query: PlaceQuery = {
14695
- * id: "store-204", // integrator alias, may repeat across buildings
14696
- * buildingId: "mall-santiago",
14697
- * floorId: "level-2", // optional; takes precedence over `level`
14698
- * }
14699
- * ```
14700
- *
14701
- * @group Places & Locations
14702
- */
14703
14965
 
14704
14966
  /**
14705
- * MapVX place object, is a custom object containing data of a specific real place.
14706
- * Represents a physical location with all its associated metadata and properties.
14707
- *
14708
- * @example
14709
- * ```typescript
14710
- * const place = new MVXPlace(placeResponse);
14711
- * console.log(place.title); // "Coffee Shop"
14712
- * console.log(place.position); // { lat: 40.7128, lng: -74.0060 }
14713
- * ```
14714
- *
14715
- * @group Places & Locations
14967
+ * Represents an individual step within a route leg.
14968
+ * Each step contains specific instructions and coordinates for navigation.
14969
+ * @group Routes
14716
14970
  */
14717
- var place_MVXPlace = /*#__PURE__*/function () {
14718
- /**
14719
- * Unique identifier to reference the place in MapVX system
14720
- */
14721
-
14722
- /**
14723
- * Client-side identifier for the place (optional)
14724
- * Used for custom identification in client applications
14725
- */
14726
-
14727
- /**
14728
- * Title text for the place (localized based on client language)
14729
- */
14730
-
14731
- /**
14732
- * Detailed description text for the place (localized based on client language)
14733
- */
14734
-
14735
- /**
14736
- * Short description text for the place (localized based on client language)
14737
- */
14738
-
14739
- /**
14740
- * Central position coordinates for the place
14741
- * @see {@link LatLng} for coordinate structure
14742
- */
14743
-
14744
- /**
14745
- * Flag to control visibility of the place in search results
14746
- */
14747
-
14748
- /**
14749
- * Category identifier for the place
14750
- */
14751
-
14752
- /**
14753
- * Localized category name for the place (based on client language)
14754
- */
14755
-
14756
- /**
14757
- * General purpose category string for the place (localized)
14758
- */
14759
-
14760
- /**
14761
- * Floors available in the parent place. If this exists, the place is indoor.
14762
- * Otherwise, the place is considered outdoor.
14763
- * @see {@link InnerFloor} for floor structure
14764
- */
14765
-
14971
+ var MVXRouteStep = /*#__PURE__*/function () {
14766
14972
  /**
14767
- * Specific floor identifiers where this place exists (for indoor locations)
14973
+ * Distance of the step in meters
14768
14974
  */
14769
14975
 
14770
14976
  /**
14771
- * Unique identifier of the institution to which this place belongs
14977
+ * Estimated duration of the step in seconds
14772
14978
  */
14773
14979
 
14774
14980
  /**
14775
- * Business hours when the place is open
14776
- * @see {@link OpeningHours} for schedule structure
14981
+ * Starting location of the step
14777
14982
  */
14778
14983
 
14779
14984
  /**
14780
- * Physical address of the place in plain text (if provided)
14985
+ * Identifier of the floor where the step begins (if applicable)
14781
14986
  */
14782
14987
 
14783
14988
  /**
14784
- * Transport services associated with this place
14785
- * @see {@link TransportLine} for transport service structure
14989
+ * Identifier of the place where the step begins (if applicable)
14786
14990
  */
14787
14991
 
14788
14992
  /**
14789
- * URL of the place's logo image
14993
+ * Ending location of the step
14790
14994
  */
14791
14995
 
14792
14996
  /**
14793
- * List of available image URLs for the place
14997
+ * Identifier of the floor where the step ends (if applicable)
14794
14998
  */
14795
14999
 
14796
15000
  /**
14797
- * List of available banner images for the place
14798
- * @see {@link Banner} for banner structure
15001
+ * Identifier of the place where the step ends (if applicable)
14799
15002
  */
14800
15003
 
14801
15004
  /**
14802
- * List of properties connected to the place
14803
- * @see {@link Property} for property structure
15005
+ * HTML formatted instructions to display to the user
14804
15006
  */
14805
15007
 
14806
15008
  /**
14807
- * Unique identifier of the parent place or object
15009
+ * Plain text instructions to display to the user
14808
15010
  */
14809
15011
 
14810
15012
  /**
14811
- * Type of the object being referenced by {@link parentId}
15013
+ * Type of maneuver the user should perform (e.g., "turn-left", "straight")
14812
15014
  */
14813
15015
 
14814
15016
  /**
14815
- * Tags associated with the place for categorization and filtering
15017
+ * Indicates if a popup with additional information should be shown
14816
15018
  */
14817
15019
 
14818
15020
  /**
14819
- * Metadata of the place.
15021
+ * Icon prefix to display for this step
14820
15022
  */
14821
15023
 
14822
15024
  /**
14823
- * Visibility of the place
15025
+ * Indicates if this step involves using an elevator
14824
15026
  */
14825
15027
 
14826
- /**
14827
- * Creates a new place instance with the parameters specified in the data.
14828
- *
14829
- * @param rawPlace - JSON configuration parameters for the place from API response
14830
- * @returns A new instance of MVXPlace
14831
- *
14832
- * @example
14833
- * ```typescript
14834
- * const placeResponse = await fetchPlaceData(placeId);
14835
- * const place = new MVXPlace(placeResponse);
14836
- * ```
14837
- */
14838
- function MVXPlace(rawPlace) {
14839
- var _rawPlace$tags, _rawPlace$keywords, _rawPlace$alias, _rawPlace$tags2, _rawPlace$localizedCa, _rawPlace$properties, _rawPlace$images, _rawPlace$banners, _rawPlace$properties2, _rawPlace$visibility;
14840
- place_classCallCheck(this, MVXPlace);
14841
- var tagsAndKeywords = ((_rawPlace$tags = rawPlace.tags) !== null && _rawPlace$tags !== void 0 ? _rawPlace$tags : []).concat((_rawPlace$keywords = rawPlace.keywords) !== null && _rawPlace$keywords !== void 0 ? _rawPlace$keywords : []);
14842
- this.mapvxId = rawPlace.id;
14843
- this.clientId = (_rawPlace$alias = rawPlace.alias) !== null && _rawPlace$alias !== void 0 ? _rawPlace$alias : rawPlace.externalId;
14844
- this.title = rawPlace.title;
14845
- this.hidePlace = tagsAndKeywords.includes("hide_search");
14846
- this.description = rawPlace.description;
14847
- this.shortDescription = rawPlace.shortDescription;
14848
- // @ts-expect-error - lon is not in the type but search results have it
14849
- this.position = {
14850
- lat: rawPlace.lat,
14851
- lng: rawPlace.lng || rawPlace.lon
14852
- };
14853
- this.category = rawPlace.category;
14854
- this.tags = (_rawPlace$tags2 = rawPlace.tags) !== null && _rawPlace$tags2 !== void 0 ? _rawPlace$tags2 : [];
14855
- this.generalCategory = rawPlace.general_category;
14856
- this.localizedCategory = (_rawPlace$localizedCa = rawPlace.localizedCategory) !== null && _rawPlace$localizedCa !== void 0 ? _rawPlace$localizedCa : "";
14857
- this.parentInstitutionId = rawPlace.parent_institution;
14858
- this.inFloors = rawPlace.inFloor;
14859
- this.innerFloors = [];
14860
- for (var key in rawPlace.innerFloors) {
14861
- this.innerFloors.push(place_objectSpread(place_objectSpread({}, rawPlace.innerFloors[key]), {}, {
14862
- key: key
14863
- }));
14864
- }
14865
- this.innerFloors.sort(function (a, b) {
14866
- return a.index - b.index;
14867
- });
14868
- this.openingHours = rawPlace.opening_hours;
14869
- this.address = rawPlace.address;
14870
- this.transportLine = (_rawPlace$properties = rawPlace.properties) === null || _rawPlace$properties === void 0 ? void 0 : _rawPlace$properties.filter(function (p) {
14871
- return p.type === "transport_line";
14872
- });
14873
- if (rawPlace.logo) {
14874
- this.logo = typeof rawPlace.logo === "string" ? rawPlace.logo : rawPlace.logo.light;
14875
- }
14876
- this.images = (_rawPlace$images = rawPlace.images) !== null && _rawPlace$images !== void 0 ? _rawPlace$images : [];
14877
- this.banners = ((_rawPlace$banners = rawPlace.banners) !== null && _rawPlace$banners !== void 0 ? _rawPlace$banners : []).map(function (bannerResponse) {
14878
- return new Banner(bannerResponse);
14879
- });
14880
- this.properties = PropertyUtils.parseProperties((_rawPlace$properties2 = rawPlace.properties) !== null && _rawPlace$properties2 !== void 0 ? _rawPlace$properties2 : []);
14881
- this.parentId = rawPlace.parent_id;
14882
- this.parentType = rawPlace.parent_type;
14883
- this.metadata = rawPlace.metadata;
14884
- this.visibility = (_rawPlace$visibility = rawPlace.visibility) !== null && _rawPlace$visibility !== void 0 ? _rawPlace$visibility : "public";
15028
+ /**
15029
+ * Object containing the polyline information for the step
15030
+ * @hidden
15031
+ */
15032
+
15033
+ /**
15034
+ * Creates a new route step instance from response data
15035
+ * @hidden
15036
+ * @param data API response data containing step information
15037
+ */
15038
+ function MVXRouteStep(data) {
15039
+ route_classCallCheck(this, MVXRouteStep);
15040
+ this.distance = data.distance.value;
15041
+ this.duration = data.duration.value;
15042
+ this.startLocation = data.start_location;
15043
+ this.startInsideFloor = data.start_inside_floor;
15044
+ this.startInsidePlace = data.start_inside_place;
15045
+ this.endLocation = data.end_location;
15046
+ this.endInsideFloor = data.end_inside_floor;
15047
+ this.endInsidePlace = data.end_inside_place;
15048
+ this.htmlInstruction = data.html_instructions;
15049
+ this.plainInstruction = data.plain_instructions;
15050
+ this.maneuver = data.maneuver;
15051
+ this.elevatorStep = data.elevator_step;
15052
+ this.showPopup = data.show_popup;
15053
+ this.iconPrefix = data.icon_prefix;
15054
+ this.polyline = new Polyline(data.polyline);
14885
15055
  }
14886
15056
 
14887
15057
  /**
14888
- * Returns the floor in which the place exists as an InnerFloor object.
14889
- * If no matching available floor is found or if the place is not indoor,
14890
- * an undefined value will be returned.
14891
- *
14892
- * @param parentPlaceFloors - Array of existing parent place floors to search in
14893
- * @returns The matching InnerFloor object or undefined if not found
14894
- *
14895
- * @example
14896
- * ```typescript
14897
- * const buildingFloors = getBuildingFloors();
14898
- * const placeFloor = place.inFloor(buildingFloors);
14899
- * if (placeFloor) {
14900
- * console.log(`Place is on floor: ${placeFloor.name}`);
14901
- * }
14902
- * ```
15058
+ * Gets the polyline coordinates in GeoJSON format
15059
+ * @returns Array of coordinates in [longitude, latitude] format
14903
15060
  */
14904
- return place_createClass(MVXPlace, [{
14905
- key: "inFloor",
14906
- value: function inFloor(parentPlaceFloors) {
14907
- var _this = this;
14908
- if (!this.inFloors || this.inFloors.length === 0) {
14909
- // outdoor place
14910
- return parentPlaceFloors.find(function (floor) {
14911
- return floor.reachableFromGPS;
14912
- });
14913
- }
14914
- return parentPlaceFloors.find(function (floor) {
14915
- var _this$inFloors;
14916
- return floor.key === ((_this$inFloors = _this.inFloors) === null || _this$inFloors === void 0 ? void 0 : _this$inFloors[0]);
14917
- });
15061
+ return route_createClass(MVXRouteStep, [{
15062
+ key: "geoJsonCoordinates",
15063
+ get: function get() {
15064
+ return this.polyline.geoJsonCoordinates;
14918
15065
  }
14919
15066
 
14920
15067
  /**
14921
- * Returns a string representation of the place
14922
- * @returns String in format "MVXPlace {mapvxId}"
15068
+ * Gets the polyline coordinates in LatLng format
15069
+ * @returns Array of LatLng coordinates
14923
15070
  */
14924
15071
  }, {
14925
- key: "toString",
14926
- value: function toString() {
14927
- return "MVXPlace ".concat(this.mapvxId);
15072
+ key: "coordinates",
15073
+ get: function get() {
15074
+ return this.polyline.coordinates;
14928
15075
  }
14929
15076
  }]);
14930
15077
  }();
14931
- ;// ./src/domain/models/property.ts
14932
- function property_typeof(o) { "@babel/helpers - typeof"; return property_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, property_typeof(o); }
14933
- function property_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14934
- function property_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, property_toPropertyKey(o.key), o); } }
14935
- function property_createClass(e, r, t) { return r && property_defineProperties(e.prototype, r), t && property_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
14936
- function property_toPropertyKey(t) { var i = property_toPrimitive(t, "string"); return "symbol" == property_typeof(i) ? i : i + ""; }
14937
- function property_toPrimitive(t, r) { if ("object" != property_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != property_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14938
-
14939
-
14940
- /**
14941
- * Base interface for all property types that a place can have.
14942
- * Defines the common fields that all properties must have.
14943
- * @group Places & Locations
14944
- */
14945
15078
 
14946
15079
  /**
14947
- * Interface that represents the API response for properties.
14948
- * Contains the data structure as it comes from the server.
14949
- * @group Places & Locations
15080
+ * Internal class that handles polyline decoding and management.
15081
+ * A polyline is an encoded representation of a series of coordinates.
14950
15082
  */
15083
+ var Polyline = /*#__PURE__*/function () {
15084
+ /**
15085
+ * Encoded string of polyline points
15086
+ */
14951
15087
 
14952
- /**
14953
- * Interface that represents a transport service associated with a place.
14954
- * Extends the Property interface with transport-specific fields.
14955
- * @group Places & Locations
14956
- */
15088
+ /**
15089
+ * Polyline points in LatLng format (optional)
15090
+ */
14957
15091
 
14958
- /**
14959
- * Interface for properties that only contain text.
14960
- * Extends Property without adding additional fields.
14961
- * @group Places & Locations
14962
- */
15092
+ /**
15093
+ * Overview points of the polyline (optional)
15094
+ */
14963
15095
 
14964
- /**
14965
- * Interface for properties that have associated child places.
14966
- * Allows referencing other places from a property.
14967
- * @group Places & Locations
14968
- */
15096
+ /**
15097
+ * Decoded points of the polyline
15098
+ */
14969
15099
 
14970
- /**
14971
- * Interface for properties that have nested sub-properties.
14972
- * Allows creating hierarchical property structures.
14973
- * @group Places & Locations
14974
- */
15100
+ /**
15101
+ * Creates a new polyline instance from response data
15102
+ * @param data Response data containing polyline information
15103
+ */
15104
+ function Polyline(data) {
15105
+ route_classCallCheck(this, Polyline);
15106
+ this.points = data.points;
15107
+ this.pointsLatLng = data.points_lat_lng;
15108
+ this.overviewPoints = data.overview_points;
15109
+ this.decodedPoints = decode(data.points).map(function (point) {
15110
+ return {
15111
+ lat: point[0],
15112
+ lng: point[1]
15113
+ };
15114
+ });
15115
+ }
14975
15116
 
14976
- /**
14977
- * Interface for properties that have an associated URL.
14978
- * Allows redirecting to external websites from a property.
14979
- * @group Places & Locations
14980
- */
15117
+ /**
15118
+ * Gets coordinates in GeoJSON format
15119
+ * @returns Array of coordinates in [longitude, latitude] format
15120
+ */
15121
+ return route_createClass(Polyline, [{
15122
+ key: "geoJsonCoordinates",
15123
+ get: function get() {
15124
+ if (this.overviewPoints != null) {
15125
+ return this.overviewPoints.map(function (point) {
15126
+ return [point.lng, point.lat];
15127
+ });
15128
+ } else {
15129
+ return this.decodedPoints.map(function (point) {
15130
+ return [point.lng, point.lat];
15131
+ });
15132
+ }
15133
+ }
14981
15134
 
14982
- /**
14983
- * Utility class for processing and converting properties from API responses.
14984
- * Provides methods to parse different property structures.
14985
- * @group Places & Locations
14986
- */
14987
- var PropertyUtils = /*#__PURE__*/function () {
14988
- function PropertyUtils() {
14989
- property_classCallCheck(this, PropertyUtils);
14990
- }
14991
- return property_createClass(PropertyUtils, null, [{
14992
- key: "parseProperties",
14993
- value:
14994
15135
  /**
14995
- * Converts an array of PropertyResponse to a typed Property array.
14996
- * Handles nested properties recursively and different property types.
14997
- *
14998
- * @param response Array of PropertyResponse from the API
14999
- * @returns Processed and typed Property array
15136
+ * Gets coordinates in LatLng format
15137
+ * @returns Array of LatLng coordinates
15000
15138
  */
15001
- function parseProperties(response) {
15002
- var _this = this;
15003
- try {
15004
- var properties = [];
15005
- if (response) {
15006
- response.forEach(function (item) {
15007
- if (item.child_places) {
15008
- var _item$iconPrefix;
15009
- var childPlaces = item.child_places;
15010
- var childPlacesProperty = {
15011
- childPlaces: [],
15012
- title: item.key,
15013
- subtitle: item.text,
15014
- childParentPlace: item.child_parent_place,
15015
- icon: item.icon,
15016
- imageUrl: item.imageUrl,
15017
- iconPrefix: (_item$iconPrefix = item.iconPrefix) !== null && _item$iconPrefix !== void 0 ? _item$iconPrefix : "fas",
15018
- sortChildrenBy: item.sortChildrenBy
15019
- };
15020
- childPlaces.forEach(function (element) {
15021
- if (typeof element === "string") {
15022
- // Add id to the array of childPlaces
15023
- childPlacesProperty.childPlaces.push(element);
15024
- } else {
15025
- // Transform object to MVXPlace and add to childPlaces array
15026
- var mvxPlace = new place_MVXPlace(element);
15027
- childPlacesProperty.childPlaces.push(mvxPlace);
15028
- }
15029
- });
15030
- properties.push(childPlacesProperty);
15031
- } else if (item.child_properties) {
15032
- var _item$iconPrefix2;
15033
- // Parsing child properties with recursive call
15034
- var childProperties = item.child_properties;
15035
- var childPropertiesProperty = {
15036
- childProperties: [],
15037
- title: item.key,
15038
- subtitle: item.text,
15039
- childParentPlace: item.child_parent_place,
15040
- icon: item.icon,
15041
- imageUrl: item.imageUrl,
15042
- iconPrefix: (_item$iconPrefix2 = item.iconPrefix) !== null && _item$iconPrefix2 !== void 0 ? _item$iconPrefix2 : "fas",
15043
- sortChildrenBy: item.sortChildrenBy
15044
- };
15045
- var childPropertiesResult = _this.parseProperties(childProperties);
15046
- childPropertiesProperty.childProperties = childPropertiesResult;
15047
- properties.push(childPropertiesProperty);
15048
- } else if (item.url) {
15049
- var property = {
15050
- title: item.key,
15051
- subtitle: item.text,
15052
- icon: item.icon,
15053
- imageUrl: item.imageUrl,
15054
- iconPrefix: item.iconPrefix,
15055
- url: item.url,
15056
- type: item.type,
15057
- sortChildrenBy: item.sortChildrenBy
15058
- };
15059
- properties.push(property);
15060
- } else {
15061
- var _item$iconPrefix3;
15062
- var _property = {
15063
- title: item.key,
15064
- subtitle: item.text,
15065
- childParentPlace: item.child_parent_place,
15066
- icon: item.icon,
15067
- imageUrl: item.imageUrl,
15068
- type: item.type,
15069
- iconPrefix: (_item$iconPrefix3 = item.iconPrefix) !== null && _item$iconPrefix3 !== void 0 ? _item$iconPrefix3 : "fas",
15070
- sortChildrenBy: item.sortChildrenBy
15071
- };
15072
- properties.push(_property);
15073
- }
15074
- });
15075
- }
15076
- return properties;
15077
- } catch (err) {
15078
- console.log(err);
15079
- console.log(response);
15080
- return [];
15139
+ }, {
15140
+ key: "coordinates",
15141
+ get: function get() {
15142
+ if (this.overviewPoints != null) {
15143
+ return this.overviewPoints;
15144
+ } else {
15145
+ return this.decodedPoints;
15081
15146
  }
15082
15147
  }
15083
15148
  }]);
@@ -16572,7 +16637,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16572
16637
  return response.json();
16573
16638
  case 5:
16574
16639
  responseData = _context4.v;
16575
- place = new place_MVXPlace(responseData);
16640
+ place = new MVXPlace(responseData);
16576
16641
  this.cachePlace(place, buildingId);
16577
16642
  this.logEvent("fetchAndParsePlaceDetail", {
16578
16643
  cached: "false"
@@ -16631,7 +16696,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16631
16696
  return response.json();
16632
16697
  case 5:
16633
16698
  responseData = _context5.v;
16634
- place = new place_MVXPlace(responseData);
16699
+ place = new MVXPlace(responseData);
16635
16700
  this.cachePlace(place, buildingId);
16636
16701
  this.logEvent("fetchAndParseAnyPlaceDetail", {
16637
16702
  cached: "false"
@@ -16715,7 +16780,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16715
16780
  case 5:
16716
16781
  responseData = _context6.v;
16717
16782
  subPlaces = responseData.map(function (place) {
16718
- return new place_MVXPlace(place);
16783
+ return new MVXPlace(place);
16719
16784
  }); // Cache the result
16720
16785
  this.cache.setSubPlaces(parentPlaceId, this.currentLang, {
16721
16786
  timestamp: Date.now(),
@@ -16776,7 +16841,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16776
16841
  case 4:
16777
16842
  responseData = _context7.v;
16778
16843
  subPlaces = responseData.map(function (place) {
16779
- return new place_MVXPlace(place);
16844
+ return new MVXPlace(place);
16780
16845
  });
16781
16846
  this.logEvent("fetchAndParseAnySubPlaces");
16782
16847
  subPlaces.forEach(function (place) {
@@ -16831,7 +16896,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16831
16896
  case 4:
16832
16897
  typedResponseData = _context8.v;
16833
16898
  data = typedResponseData.map(function (data) {
16834
- return new place_MVXPlace(data);
16899
+ return new MVXPlace(data);
16835
16900
  });
16836
16901
  this.logEvent("fetchAndParseAvailablePlaces");
16837
16902
  data.forEach(function (place) {
@@ -16889,7 +16954,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16889
16954
  case 4:
16890
16955
  typedResponseData = _context9.v;
16891
16956
  data = typedResponseData.map(function (data) {
16892
- return new place_MVXPlace(data);
16957
+ return new MVXPlace(data);
16893
16958
  });
16894
16959
  this.logEvent("fetchAndParsePlacesFromInstitution");
16895
16960
  data.forEach(function (place) {
@@ -17244,7 +17309,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
17244
17309
  case 5:
17245
17310
  typedResponseData = _context12.v;
17246
17311
  data = typedResponseData.map(function (e) {
17247
- return new place_MVXPlace(e);
17312
+ return new MVXPlace(e);
17248
17313
  });
17249
17314
  this.cache.setStops(stopId + vehicleId, {
17250
17315
  timestamp: Date.now(),
@@ -17299,7 +17364,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
17299
17364
  case 4:
17300
17365
  responseData = _context13.v;
17301
17366
  searchResults = responseData.map(function (result) {
17302
- return new place_MVXPlace(result);
17367
+ return new MVXPlace(result);
17303
17368
  });
17304
17369
  return _context13.a(2, searchResults);
17305
17370
  case 5:
@@ -17345,7 +17410,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
17345
17410
  case 4:
17346
17411
  responseData = _context14.v;
17347
17412
  places = responseData.map(function (place) {
17348
- return new place_MVXPlace(place);
17413
+ return new MVXPlace(place);
17349
17414
  });
17350
17415
  this.logEvent("fetchAndParseSearchPlacesByTags");
17351
17416
  places.forEach(function (place) {