@mapvx/web-js 2.0.1-dev.2 → 2.0.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.
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 */ MVXPlace),
293
+ MVXPlace: () => (/* reexport */ place_MVXPlace),
294
294
  MVXRoute: () => (/* reexport */ MVXRoute),
295
295
  MVXRouteLeg: () => (/* reexport */ MVXRouteLeg),
296
296
  MVXRouteStep: () => (/* reexport */ MVXRouteStep),
@@ -670,21 +670,13 @@ function PersistentCache_toPrimitive(t, r) { if ("object" != PersistentCache_typ
670
670
  * ```
671
671
  */
672
672
  var PersistentCache = /*#__PURE__*/function () {
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) {
673
+ function PersistentCache(config, maxStorageBytes) {
681
674
  PersistentCache_classCallCheck(this, PersistentCache);
682
675
  PersistentCache_defineProperty(this, "storageAvailable", true);
683
676
  this.lruCache = new LRUCache(config);
684
677
  this.persistenceKey = config.persistenceKey || "mvx_cache";
685
678
  this.maxStorageBytes = maxStorageBytes !== null && maxStorageBytes !== void 0 ? maxStorageBytes : DEFAULT_MAX_STORAGE_BYTES;
686
679
  this.ttlMs = config.ttlMs;
687
- this.deserialize = deserialize;
688
680
  this.hydrate();
689
681
  }
690
682
  return PersistentCache_createClass(PersistentCache, [{
@@ -757,8 +749,8 @@ var PersistentCache = /*#__PURE__*/function () {
757
749
  continue;
758
750
  }
759
751
 
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);
752
+ // Restore to LRU cache
753
+ this.lruCache.set(entry.key, entry.value);
762
754
  }
763
755
  } catch (err) {
764
756
  _iterator.e(err);
@@ -849,705 +841,176 @@ var PersistentCache = /*#__PURE__*/function () {
849
841
  }
850
842
  }]);
851
843
  }();
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
- */
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
- */
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); }
874
858
 
875
- /**
876
- * List of tags associated with the banner for filtering
877
- */
878
859
 
879
- /**
880
- * Action URL to redirect to when clicking on the banner
881
- */
882
860
 
883
- /**
884
- * Indicates if the banner should open in the same window or a new one
885
- */
886
861
 
887
862
  /**
888
- * A description of the banner.
863
+ * CacheManager - Facade for managing multiple typed caches
889
864
  *
890
- * Can contain html tags.
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
+ * ```
891
887
  */
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;
892
895
 
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); }
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
+ }
913
905
 
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
+ }
914
917
 
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
- */
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
+ }
920
926
 
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
- */
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
+ }
926
935
 
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
- */
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
+ }
932
943
 
933
- /**
934
- * Interface for properties that only contain text.
935
- * Extends Property without adding additional fields.
936
- * @group Places & Locations
937
- */
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
+ }
938
962
 
939
- /**
940
- * Interface for properties that have associated child places.
941
- * Allows referencing other places from a property.
942
- * @group Places & Locations
943
- */
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
+ }
944
981
 
945
- /**
946
- * Interface for properties that have nested sub-properties.
947
- * Allows creating hierarchical property structures.
948
- * @group Places & Locations
949
- */
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
+ }
950
1000
 
951
- /**
952
- * Interface for properties that have an associated URL.
953
- * Allows redirecting to external websites from a property.
954
- * @group Places & Locations
955
- */
956
-
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
- }
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
+ }
1551
1014
 
1552
1015
  // ==================== Categories ====================
1553
1016
  }, {
@@ -11242,7 +10705,7 @@ const extractSafariExtensionDetails = (func, filename) => {
11242
10705
  // replaced with the package version by scripts/inject-build-defines.js. The DSN
11243
10706
  // falls back to the public MapVX Sentry project DSN when none is injected at
11244
10707
  // build time — a DSN's public key is safe to ship in the client bundle.
11245
- var sentry_SDK_VERSION = true ? "2.0.1-dev.2" : 0;
10708
+ var sentry_SDK_VERSION = true ? "2.0.1" : 0;
11246
10709
  var DSN = false ? 0 : "https://872f598f020e3cd73a0933b562d24c81@sentry.mapvx.app/5";
11247
10710
 
11248
10711
  /**
@@ -11768,7 +11231,7 @@ function createRouteAnimationIconDataUrl(config) {
11768
11231
  */
11769
11232
  var routeAnimationDataUrl = createRouteAnimationIconDataUrl();
11770
11233
  ;// ./src/utils/utils.ts
11771
- /* unused harmony import specifier */ var utils_MVXPlace;
11234
+ /* unused harmony import specifier */ var MVXPlace;
11772
11235
 
11773
11236
 
11774
11237
  /**
@@ -11794,7 +11257,7 @@ function generateHexadecimalKey() {
11794
11257
  function formatArrayPlaceData(places) {
11795
11258
  var formattedData = [];
11796
11259
  places.forEach(function (place) {
11797
- formattedData.push(new utils_MVXPlace(place));
11260
+ formattedData.push(new MVXPlace(place));
11798
11261
  });
11799
11262
  return formattedData;
11800
11263
  }
@@ -14901,248 +14364,720 @@ var MVXRoute = /*#__PURE__*/function () {
14901
14364
  }
14902
14365
 
14903
14366
  /**
14904
- * Gets the total length of the route.
14905
- * This property calculates the sum of the length of all legs in the route.
14906
- *
14907
- * @returns {number} The total length of the route, in meters.
14367
+ * Gets the total length of the route.
14368
+ * This property calculates the sum of the length of all legs in the route.
14369
+ *
14370
+ * @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
14908
14601
  */
14909
14602
  }, {
14910
- key: "length",
14603
+ key: "coordinates",
14911
14604
  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);
14605
+ if (this.overviewPoints != null) {
14606
+ return this.overviewPoints;
14607
+ } else {
14608
+ return this.decodedPoints;
14609
+ }
14917
14610
  }
14918
14611
  }]);
14919
14612
  }();
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
+ */
14920
14625
 
14921
14626
  /**
14922
- * Represents a route leg that connects two specific points.
14923
- * Each leg contains information about distance, duration, and detailed steps.
14924
- * @group Routes
14627
+ * Class that represents a banner in MapVX.
14628
+ * Contains information about the image, tags, and banner behavior.
14629
+ * @group Places & Locations
14925
14630
  */
14926
- var MVXRouteLeg = /*#__PURE__*/route_createClass(
14631
+ var Banner = /*#__PURE__*/banner_createClass(
14927
14632
  /**
14928
- * Total distance of the leg in meters
14633
+ * URL of the banner image
14929
14634
  */
14930
14635
 
14931
14636
  /**
14932
- * Estimated duration of the leg in seconds
14637
+ * List of tags associated with the banner for filtering
14933
14638
  */
14934
14639
 
14935
14640
  /**
14936
- * Starting location of the leg
14641
+ * Action URL to redirect to when clicking on the banner
14937
14642
  */
14938
14643
 
14939
14644
  /**
14940
- * Ending location of the leg
14645
+ * Indicates if the banner should open in the same window or a new one
14941
14646
  */
14942
14647
 
14943
14648
  /**
14944
- * List of detailed steps that compose this leg
14649
+ * A description of the banner.
14650
+ *
14651
+ * Can contain html tags.
14945
14652
  */
14946
14653
 
14947
14654
  /**
14948
- * Creates a new route leg instance from response data
14949
- * @hidden
14950
- * @param data API response data containing leg information
14655
+ * Creates a new banner instance from API response data
14656
+ * @param rawBanner API response data containing banner information
14951
14657
  */
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
- });
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;
14964
14666
  });
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
+
14965
14679
 
14966
14680
  /**
14967
- * Represents an individual step within a route leg.
14968
- * Each step contains specific instructions and coordinates for navigation.
14969
- * @group Routes
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
14970
14702
  */
14971
- var MVXRouteStep = /*#__PURE__*/function () {
14703
+
14704
+ /**
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
14716
+ */
14717
+ var place_MVXPlace = /*#__PURE__*/function () {
14972
14718
  /**
14973
- * Distance of the step in meters
14719
+ * Unique identifier to reference the place in MapVX system
14974
14720
  */
14975
14721
 
14976
14722
  /**
14977
- * Estimated duration of the step in seconds
14723
+ * Client-side identifier for the place (optional)
14724
+ * Used for custom identification in client applications
14978
14725
  */
14979
14726
 
14980
14727
  /**
14981
- * Starting location of the step
14728
+ * Title text for the place (localized based on client language)
14982
14729
  */
14983
14730
 
14984
14731
  /**
14985
- * Identifier of the floor where the step begins (if applicable)
14732
+ * Detailed description text for the place (localized based on client language)
14986
14733
  */
14987
14734
 
14988
14735
  /**
14989
- * Identifier of the place where the step begins (if applicable)
14736
+ * Short description text for the place (localized based on client language)
14990
14737
  */
14991
14738
 
14992
14739
  /**
14993
- * Ending location of the step
14740
+ * Central position coordinates for the place
14741
+ * @see {@link LatLng} for coordinate structure
14994
14742
  */
14995
14743
 
14996
14744
  /**
14997
- * Identifier of the floor where the step ends (if applicable)
14745
+ * Flag to control visibility of the place in search results
14998
14746
  */
14999
14747
 
15000
14748
  /**
15001
- * Identifier of the place where the step ends (if applicable)
14749
+ * Category identifier for the place
15002
14750
  */
15003
14751
 
15004
14752
  /**
15005
- * HTML formatted instructions to display to the user
14753
+ * Localized category name for the place (based on client language)
15006
14754
  */
15007
14755
 
15008
14756
  /**
15009
- * Plain text instructions to display to the user
14757
+ * General purpose category string for the place (localized)
15010
14758
  */
15011
14759
 
15012
14760
  /**
15013
- * Type of maneuver the user should perform (e.g., "turn-left", "straight")
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
15014
14764
  */
15015
14765
 
15016
14766
  /**
15017
- * Indicates if a popup with additional information should be shown
14767
+ * Specific floor identifiers where this place exists (for indoor locations)
15018
14768
  */
15019
14769
 
15020
14770
  /**
15021
- * Icon prefix to display for this step
14771
+ * Unique identifier of the institution to which this place belongs
15022
14772
  */
15023
14773
 
15024
14774
  /**
15025
- * Indicates if this step involves using an elevator
14775
+ * Business hours when the place is open
14776
+ * @see {@link OpeningHours} for schedule structure
15026
14777
  */
15027
14778
 
15028
14779
  /**
15029
- * Object containing the polyline information for the step
15030
- * @hidden
14780
+ * Physical address of the place in plain text (if provided)
15031
14781
  */
15032
14782
 
15033
14783
  /**
15034
- * Creates a new route step instance from response data
15035
- * @hidden
15036
- * @param data API response data containing step information
14784
+ * Transport services associated with this place
14785
+ * @see {@link TransportLine} for transport service structure
15037
14786
  */
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);
14787
+
14788
+ /**
14789
+ * URL of the place's logo image
14790
+ */
14791
+
14792
+ /**
14793
+ * List of available image URLs for the place
14794
+ */
14795
+
14796
+ /**
14797
+ * List of available banner images for the place
14798
+ * @see {@link Banner} for banner structure
14799
+ */
14800
+
14801
+ /**
14802
+ * List of properties connected to the place
14803
+ * @see {@link Property} for property structure
14804
+ */
14805
+
14806
+ /**
14807
+ * Unique identifier of the parent place or object
14808
+ */
14809
+
14810
+ /**
14811
+ * Type of the object being referenced by {@link parentId}
14812
+ */
14813
+
14814
+ /**
14815
+ * Tags associated with the place for categorization and filtering
14816
+ */
14817
+
14818
+ /**
14819
+ * Metadata of the place.
14820
+ */
14821
+
14822
+ /**
14823
+ * Visibility of the place
14824
+ */
14825
+
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";
15055
14885
  }
15056
14886
 
15057
14887
  /**
15058
- * Gets the polyline coordinates in GeoJSON format
15059
- * @returns Array of coordinates in [longitude, latitude] format
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
+ * ```
15060
14903
  */
15061
- return route_createClass(MVXRouteStep, [{
15062
- key: "geoJsonCoordinates",
15063
- get: function get() {
15064
- return this.polyline.geoJsonCoordinates;
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
+ });
15065
14918
  }
15066
14919
 
15067
14920
  /**
15068
- * Gets the polyline coordinates in LatLng format
15069
- * @returns Array of LatLng coordinates
14921
+ * Returns a string representation of the place
14922
+ * @returns String in format "MVXPlace {mapvxId}"
15070
14923
  */
15071
14924
  }, {
15072
- key: "coordinates",
15073
- get: function get() {
15074
- return this.polyline.coordinates;
14925
+ key: "toString",
14926
+ value: function toString() {
14927
+ return "MVXPlace ".concat(this.mapvxId);
15075
14928
  }
15076
14929
  }]);
15077
14930
  }();
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
+
15078
14939
 
15079
14940
  /**
15080
- * Internal class that handles polyline decoding and management.
15081
- * A polyline is an encoded representation of a series of coordinates.
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
15082
14944
  */
15083
- var Polyline = /*#__PURE__*/function () {
15084
- /**
15085
- * Encoded string of polyline points
15086
- */
15087
14945
 
15088
- /**
15089
- * Polyline points in LatLng format (optional)
15090
- */
14946
+ /**
14947
+ * Interface that represents the API response for properties.
14948
+ * Contains the data structure as it comes from the server.
14949
+ * @group Places & Locations
14950
+ */
15091
14951
 
15092
- /**
15093
- * Overview points of the polyline (optional)
15094
- */
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
+ */
15095
14957
 
15096
- /**
15097
- * Decoded points of the polyline
15098
- */
14958
+ /**
14959
+ * Interface for properties that only contain text.
14960
+ * Extends Property without adding additional fields.
14961
+ * @group Places & Locations
14962
+ */
15099
14963
 
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
- }
14964
+ /**
14965
+ * Interface for properties that have associated child places.
14966
+ * Allows referencing other places from a property.
14967
+ * @group Places & Locations
14968
+ */
15116
14969
 
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
- }
14970
+ /**
14971
+ * Interface for properties that have nested sub-properties.
14972
+ * Allows creating hierarchical property structures.
14973
+ * @group Places & Locations
14974
+ */
14975
+
14976
+ /**
14977
+ * Interface for properties that have an associated URL.
14978
+ * Allows redirecting to external websites from a property.
14979
+ * @group Places & Locations
14980
+ */
15134
14981
 
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:
15135
14994
  /**
15136
- * Gets coordinates in LatLng format
15137
- * @returns Array of LatLng coordinates
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
15138
15000
  */
15139
- }, {
15140
- key: "coordinates",
15141
- get: function get() {
15142
- if (this.overviewPoints != null) {
15143
- return this.overviewPoints;
15144
- } else {
15145
- return this.decodedPoints;
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 [];
15146
15081
  }
15147
15082
  }
15148
15083
  }]);
@@ -16637,7 +16572,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16637
16572
  return response.json();
16638
16573
  case 5:
16639
16574
  responseData = _context4.v;
16640
- place = new MVXPlace(responseData);
16575
+ place = new place_MVXPlace(responseData);
16641
16576
  this.cachePlace(place, buildingId);
16642
16577
  this.logEvent("fetchAndParsePlaceDetail", {
16643
16578
  cached: "false"
@@ -16696,7 +16631,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16696
16631
  return response.json();
16697
16632
  case 5:
16698
16633
  responseData = _context5.v;
16699
- place = new MVXPlace(responseData);
16634
+ place = new place_MVXPlace(responseData);
16700
16635
  this.cachePlace(place, buildingId);
16701
16636
  this.logEvent("fetchAndParseAnyPlaceDetail", {
16702
16637
  cached: "false"
@@ -16780,7 +16715,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16780
16715
  case 5:
16781
16716
  responseData = _context6.v;
16782
16717
  subPlaces = responseData.map(function (place) {
16783
- return new MVXPlace(place);
16718
+ return new place_MVXPlace(place);
16784
16719
  }); // Cache the result
16785
16720
  this.cache.setSubPlaces(parentPlaceId, this.currentLang, {
16786
16721
  timestamp: Date.now(),
@@ -16841,7 +16776,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16841
16776
  case 4:
16842
16777
  responseData = _context7.v;
16843
16778
  subPlaces = responseData.map(function (place) {
16844
- return new MVXPlace(place);
16779
+ return new place_MVXPlace(place);
16845
16780
  });
16846
16781
  this.logEvent("fetchAndParseAnySubPlaces");
16847
16782
  subPlaces.forEach(function (place) {
@@ -16896,7 +16831,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16896
16831
  case 4:
16897
16832
  typedResponseData = _context8.v;
16898
16833
  data = typedResponseData.map(function (data) {
16899
- return new MVXPlace(data);
16834
+ return new place_MVXPlace(data);
16900
16835
  });
16901
16836
  this.logEvent("fetchAndParseAvailablePlaces");
16902
16837
  data.forEach(function (place) {
@@ -16954,7 +16889,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
16954
16889
  case 4:
16955
16890
  typedResponseData = _context9.v;
16956
16891
  data = typedResponseData.map(function (data) {
16957
- return new MVXPlace(data);
16892
+ return new place_MVXPlace(data);
16958
16893
  });
16959
16894
  this.logEvent("fetchAndParsePlacesFromInstitution");
16960
16895
  data.forEach(function (place) {
@@ -17309,7 +17244,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
17309
17244
  case 5:
17310
17245
  typedResponseData = _context12.v;
17311
17246
  data = typedResponseData.map(function (e) {
17312
- return new MVXPlace(e);
17247
+ return new place_MVXPlace(e);
17313
17248
  });
17314
17249
  this.cache.setStops(stopId + vehicleId, {
17315
17250
  timestamp: Date.now(),
@@ -17364,7 +17299,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
17364
17299
  case 4:
17365
17300
  responseData = _context13.v;
17366
17301
  searchResults = responseData.map(function (result) {
17367
- return new MVXPlace(result);
17302
+ return new place_MVXPlace(result);
17368
17303
  });
17369
17304
  return _context13.a(2, searchResults);
17370
17305
  case 5:
@@ -17410,7 +17345,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
17410
17345
  case 4:
17411
17346
  responseData = _context14.v;
17412
17347
  places = responseData.map(function (place) {
17413
- return new MVXPlace(place);
17348
+ return new place_MVXPlace(place);
17414
17349
  });
17415
17350
  this.logEvent("fetchAndParseSearchPlacesByTags");
17416
17351
  places.forEach(function (place) {