@mapvx/web-components 0.0.12 → 0.0.13

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.
@@ -1,5 +1,5 @@
1
- import { i, s as sdkContext } from './components-WD5664Tb.js';
2
- import { R as RollbarController } from './route-view-totems-B6XNhVcN.js';
1
+ import { i, s as sdkContext } from './components-DPVi46Wo.js';
2
+ import { R as RollbarController } from './route-view-totems-CfybX1VD.js';
3
3
 
4
4
  var dist = {exports: {}};
5
5
 
@@ -5900,13 +5900,12 @@ function requireDist () {
5900
5900
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
5901
5901
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: true, configurable: true } }), Object.defineProperty(t, "prototype", { writable: false }), e && _setPrototypeOf(t, e); }
5902
5902
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
5903
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
5904
5903
  function _typeof(o) { "@babel/helpers - typeof"; return _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; }, _typeof(o); }
5905
5904
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
5906
5905
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
5907
5906
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: false }), e; }
5908
5907
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
5909
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5908
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return (String )(t); }
5910
5909
 
5911
5910
 
5912
5911
  /**
@@ -5966,8 +5965,8 @@ function requireDist () {
5966
5965
  var _markerContainer$getE, _iconContainer$height, _iconContainer$width;
5967
5966
  markerContainer.appendChild(marker.element);
5968
5967
  var iconContainer = (_markerContainer$getE = markerContainer.getElementsByTagName("img")) === null || _markerContainer$getE === void 0 ? void 0 : _markerContainer$getE[0];
5969
- iconHeight = "".concat((_iconContainer$height = iconContainer.height) !== null && _iconContainer$height !== void 0 ? _iconContainer$height : 40, "px");
5970
- iconWidth = "".concat((_iconContainer$width = iconContainer.width) !== null && _iconContainer$width !== void 0 ? _iconContainer$width : 40, "px");
5968
+ iconHeight = "".concat((_iconContainer$height = iconContainer === null || iconContainer === void 0 ? void 0 : iconContainer.height) !== null && _iconContainer$height !== void 0 ? _iconContainer$height : 40, "px");
5969
+ iconWidth = "".concat((_iconContainer$width = iconContainer === null || iconContainer === void 0 ? void 0 : iconContainer.width) !== null && _iconContainer$width !== void 0 ? _iconContainer$width : 40, "px");
5971
5970
  return this.setAndCreateText(marker, markerContainer, iconHeight, iconWidth);
5972
5971
  }
5973
5972
  var markerElementsContainer = document.createElement("div");
@@ -5989,8 +5988,8 @@ function requireDist () {
5989
5988
  } else if (marker.icon) {
5990
5989
  var _marker$icon$getEleme, _iconContainer$height2, _iconContainer$width2;
5991
5990
  var _iconContainer = (_marker$icon$getEleme = marker.icon.getElementsByTagName("img")) === null || _marker$icon$getEleme === void 0 ? void 0 : _marker$icon$getEleme[0];
5992
- iconHeight = "".concat((_iconContainer$height2 = _iconContainer.height) !== null && _iconContainer$height2 !== void 0 ? _iconContainer$height2 : 40, "px");
5993
- iconWidth = "".concat((_iconContainer$width2 = _iconContainer.width) !== null && _iconContainer$width2 !== void 0 ? _iconContainer$width2 : 40, "px");
5991
+ iconHeight = "".concat((_iconContainer$height2 = _iconContainer === null || _iconContainer === void 0 ? void 0 : _iconContainer.height) !== null && _iconContainer$height2 !== void 0 ? _iconContainer$height2 : 40, "px");
5992
+ iconWidth = "".concat((_iconContainer$width2 = _iconContainer === null || _iconContainer === void 0 ? void 0 : _iconContainer.width) !== null && _iconContainer$width2 !== void 0 ? _iconContainer$width2 : 40, "px");
5994
5993
  markerElementsContainer.appendChild(marker.icon);
5995
5994
  }
5996
5995
  this.setAndCreateText(marker, markerElementsContainer, iconHeight, iconWidth);
@@ -6078,6 +6077,12 @@ function requireDist () {
6078
6077
  * Custom implementation of a MapLibre Marker
6079
6078
  */
6080
6079
  var MarkerAttribute = /*#__PURE__*/function (_Marker) {
6080
+ /** Unique identifier for the marker attribute. */
6081
+
6082
+ /** Geographic coordinates of the marker attribute. */
6083
+
6084
+ /** Identifier of the floor where the marker attribute is located. */
6085
+
6081
6086
  /**
6082
6087
  * Constructs a new `MarkerAttribute` object with the specified properties.
6083
6088
  * @param markerConfig `MarkerConfig` object containing the configuration properties.
@@ -6090,11 +6095,6 @@ function requireDist () {
6090
6095
  element: MarkerUtils.createMarkerElement(markerConfig),
6091
6096
  draggable: false
6092
6097
  }]);
6093
- /** Unique identifier for the marker attribute. */
6094
- /** Geographic coordinates of the marker attribute. */
6095
- /** Identifier of the floor where the marker attribute is located. */
6096
- /** Flag to know if the marker is hidden*/
6097
- _defineProperty(_this, "isHidden", false);
6098
6098
  _this.setLngLat([markerConfig.coordinate.lng, markerConfig.coordinate.lat]);
6099
6099
  _this.setRotationAlignment((_markerConfig$rotatio = markerConfig.rotationAlignment) !== null && _markerConfig$rotatio !== void 0 ? _markerConfig$rotatio : "viewport");
6100
6100
  _this.setPitchAlignment("viewport");
@@ -6112,6 +6112,7 @@ function requireDist () {
6112
6112
  return _createClass(MarkerAttribute, [{
6113
6113
  key: "addToMap",
6114
6114
  value: function addToMap(map) {
6115
+ if (!map) return;
6115
6116
  this.addTo(map);
6116
6117
  }
6117
6118
 
@@ -6156,8 +6157,7 @@ function requireDist () {
6156
6157
  }, {
6157
6158
  key: "hide",
6158
6159
  value: function hide() {
6159
- this.isHidden = true;
6160
- this._element.style.visibility = "hidden";
6160
+ this.remove();
6161
6161
  }
6162
6162
 
6163
6163
  /**
@@ -6165,9 +6165,11 @@ function requireDist () {
6165
6165
  */
6166
6166
  }, {
6167
6167
  key: "show",
6168
- value: function show() {
6169
- this.isHidden = false;
6170
- this._element.style.visibility = "visible";
6168
+ value: function show(map) {
6169
+ if (!map) {
6170
+ return;
6171
+ }
6172
+ this.addTo(map);
6171
6173
  }
6172
6174
 
6173
6175
  /**
@@ -6175,11 +6177,11 @@ function requireDist () {
6175
6177
  */
6176
6178
  }, {
6177
6179
  key: "changeFloor",
6178
- value: function changeFloor(floorId) {
6179
- if (floorId == this.floorId && !this.isHidden) {
6180
- this._element.style.visibility = "visible";
6180
+ value: function changeFloor(floorId, map) {
6181
+ if (floorId == this.floorId || !this.floorId) {
6182
+ this.show(map);
6181
6183
  } else {
6182
- this._element.style.visibility = "hidden";
6184
+ this.hide();
6183
6185
  }
6184
6186
  }
6185
6187
  }]);
@@ -6188,7 +6190,7 @@ function requireDist () {
6188
6190
  function nav_functions_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
6189
6191
  function nav_functions_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, nav_functions_toPropertyKey(o.key), o); } }
6190
6192
  function nav_functions_createClass(e, r, t) { return t && nav_functions_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: false }), e; }
6191
- function nav_functions_defineProperty(e, r, t) { return (r = nav_functions_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
6193
+ function _defineProperty(e, r, t) { return (r = nav_functions_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
6192
6194
  function nav_functions_toPropertyKey(t) { var i = nav_functions_toPrimitive(t, "string"); return "symbol" == nav_functions_typeof(i) ? i : i + ""; }
6193
6195
  function nav_functions_toPrimitive(t, r) { if ("object" != nav_functions_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != nav_functions_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6194
6196
  var asin = Math.asin,
@@ -6338,7 +6340,7 @@ function requireDist () {
6338
6340
  }
6339
6341
  }]);
6340
6342
  }();
6341
- nav_functions_defineProperty(NavFunctions, "EARTH_RADIUS", 6378000);
6343
+ _defineProperty(NavFunctions, "EARTH_RADIUS", 6378000);
6342
6344
  function routeController_typeof(o) { "@babel/helpers - typeof"; return routeController_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; }, routeController_typeof(o); }
6343
6345
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
6344
6346
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -6524,7 +6526,7 @@ function requireDist () {
6524
6526
  key: "updateLayerFilter",
6525
6527
  value: function updateLayerFilter(layerId, floorId) {
6526
6528
  var newFloorId = floorId !== null && floorId !== void 0 ? floorId : this.lazarilloMap.getCurrentFloor();
6527
- if (newFloorId === undefined) return;
6529
+ if (newFloorId === undefined || !this.map) return;
6528
6530
  if (this.map.getStyle().layers.some(function (layer) {
6529
6531
  return layer.id === layerId;
6530
6532
  })) {
@@ -6562,7 +6564,7 @@ function requireDist () {
6562
6564
  key: "updateRouteMarkerVisibility",
6563
6565
  value: function updateRouteMarkerVisibility(floorId) {
6564
6566
  var _this$routeMarker, _this$routeMarker2, _this$routeMarker3;
6565
- ((_this$routeMarker = this.routeMarker) === null || _this$routeMarker === void 0 ? void 0 : _this$routeMarker.floorId) === floorId ? (_this$routeMarker2 = this.routeMarker) === null || _this$routeMarker2 === void 0 ? void 0 : _this$routeMarker2.show() : (_this$routeMarker3 = this.routeMarker) === null || _this$routeMarker3 === void 0 ? void 0 : _this$routeMarker3.hide();
6567
+ ((_this$routeMarker = this.routeMarker) === null || _this$routeMarker === void 0 ? void 0 : _this$routeMarker.floorId) === floorId ? (_this$routeMarker2 = this.routeMarker) === null || _this$routeMarker2 === void 0 ? void 0 : _this$routeMarker2.show(this.map) : (_this$routeMarker3 = this.routeMarker) === null || _this$routeMarker3 === void 0 ? void 0 : _this$routeMarker3.hide();
6566
6568
  }
6567
6569
  }, {
6568
6570
  key: "updatePlaceFloorForRouting",
@@ -7306,33 +7308,39 @@ function requireDist () {
7306
7308
  };
7307
7309
  var Logger = /*#__PURE__*/function () {
7308
7310
  function Logger() {
7309
- var _Countly$q;
7310
7311
  logger_classCallCheck(this, Logger);
7311
- countly_default().init({
7312
- app_key: logger_countly.apiKey,
7313
- url: logger_countly.url,
7314
- app_version: "2.14.0",
7315
- session_update: 10,
7316
- debug: false,
7317
- require_consent: false,
7318
- namespace: "SDK JS"
7319
- });
7320
- this.countly = (countly_default()) !== null && (countly_default()) !== void 0 ? (countly_default()) : {};
7321
- this.countly.q = (_Countly$q = (countly_default()).q) !== null && _Countly$q !== void 0 ? _Countly$q : [];
7322
- this.countly.q.push(["track_sessions", "track_pageview", "track_clicks", "track_scrolls", "track_errors", "track_links", "track_forms", "collect_from_forms"]);
7312
+ {
7313
+ var _Countly$q;
7314
+ countly_default().init({
7315
+ app_key: logger_countly.apiKey,
7316
+ url: logger_countly.url,
7317
+ app_version: "2.15.0",
7318
+ session_update: 10,
7319
+ debug: false,
7320
+ require_consent: false,
7321
+ namespace: "SDK JS"
7322
+ });
7323
+ this.countly = (countly_default()) !== null && (countly_default()) !== void 0 ? (countly_default()) : {};
7324
+ this.countly.q = (_Countly$q = (countly_default()).q) !== null && _Countly$q !== void 0 ? _Countly$q : [];
7325
+ this.countly.q.push(["track_sessions", "track_pageview", "track_clicks", "track_scrolls", "track_errors", "track_links", "track_forms", "collect_from_forms"]);
7326
+ }
7323
7327
  }
7324
7328
  return logger_createClass(Logger, [{
7325
7329
  key: "logEvent",
7326
7330
  value: function logEvent(eventName, eventSegmentation) {
7327
- this.countly.q.push(["add_event", {
7328
- key: eventName,
7329
- segmentation: eventSegmentation
7330
- }]);
7331
+ {
7332
+ this.countly.q.push(["add_event", {
7333
+ key: eventName,
7334
+ segmentation: eventSegmentation
7335
+ }]);
7336
+ }
7331
7337
  }
7332
7338
  }, {
7333
7339
  key: "logError",
7334
7340
  value: function logError(error, segmentation) {
7335
- this.countly.q.push(["log_error", error, segmentation]);
7341
+ {
7342
+ this.countly.q.push(["log_error", error, segmentation]);
7343
+ }
7336
7344
  }
7337
7345
  }, {
7338
7346
  key: "debugLog",
@@ -7840,6 +7848,10 @@ function requireDist () {
7840
7848
  * The type of the object being referenced by {@link parentId}
7841
7849
  */
7842
7850
 
7851
+ /**
7852
+ * Tags for place
7853
+ */
7854
+
7843
7855
  /**
7844
7856
  * Creates a new place instance with the parameters specified in the data.
7845
7857
  * @hidden
@@ -7847,7 +7859,7 @@ function requireDist () {
7847
7859
  * @returns A new instance of LzPlace is returned.
7848
7860
  */
7849
7861
  function LzPlace(rawPlace) {
7850
- var _rawPlace$tags, _rawPlace$keywords, _rawPlace$alias, _rawPlace$localizedCa, _rawPlace$properties, _rawPlace$images, _rawPlace$banners, _rawPlace$properties2;
7862
+ var _rawPlace$tags, _rawPlace$keywords, _rawPlace$alias, _rawPlace$tags2, _rawPlace$localizedCa, _rawPlace$properties, _rawPlace$images, _rawPlace$banners, _rawPlace$properties2;
7851
7863
  place_classCallCheck(this, LzPlace);
7852
7864
  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 : []);
7853
7865
  this.lazarilloId = rawPlace.id;
@@ -7861,6 +7873,7 @@ function requireDist () {
7861
7873
  lng: rawPlace.lng
7862
7874
  };
7863
7875
  this.category = rawPlace.category;
7876
+ this.tags = (_rawPlace$tags2 = rawPlace.tags) !== null && _rawPlace$tags2 !== void 0 ? _rawPlace$tags2 : [];
7864
7877
  this.generalCategory = rawPlace.general_category;
7865
7878
  this.localizedCategory = (_rawPlace$localizedCa = rawPlace.localizedCategory) !== null && _rawPlace$localizedCa !== void 0 ? _rawPlace$localizedCa : "";
7866
7879
  this.parentInstitutionId = rawPlace.parent_institution;
@@ -7879,7 +7892,9 @@ function requireDist () {
7879
7892
  this.transportLine = (_rawPlace$properties = rawPlace.properties) === null || _rawPlace$properties === void 0 ? void 0 : _rawPlace$properties.filter(function (p) {
7880
7893
  return p.type === "transport_line";
7881
7894
  });
7882
- this.logo = rawPlace.logo;
7895
+ if (rawPlace.logo) {
7896
+ this.logo = typeof rawPlace.logo === "string" ? rawPlace.logo : rawPlace.logo.light;
7897
+ }
7883
7898
  this.images = (_rawPlace$images = rawPlace.images) !== null && _rawPlace$images !== void 0 ? _rawPlace$images : [];
7884
7899
  this.banners = ((_rawPlace$banners = rawPlace.banners) !== null && _rawPlace$banners !== void 0 ? _rawPlace$banners : []).map(function (bannerResponse) {
7885
7900
  return new Banner(bannerResponse);
@@ -8008,8 +8023,6 @@ function requireDist () {
8008
8023
  }
8009
8024
  return properties;
8010
8025
  } catch (err) {
8011
- console.log(err);
8012
- console.log(response);
8013
8026
  return [];
8014
8027
  }
8015
8028
  }
@@ -9922,7 +9935,7 @@ function requireDist () {
9922
9935
  if (mapConfig.parentPlaceId != null) {
9923
9936
  _this.initialPlaceDetailSetUp(mapConfig.parentPlaceId);
9924
9937
  }
9925
- if (mapConfig.otherPotentialParentPlacesIds) {
9938
+ if (mapConfig.otherPotentialParentPlacesIds && mapConfig.otherPotentialParentPlacesIds.length > 0) {
9926
9939
  _this.loadOtherPotentialParentPlaces(mapConfig.otherPotentialParentPlacesIds);
9927
9940
  }
9928
9941
  _this.enableHover = mapConfig.enableHover || false;
@@ -9947,7 +9960,11 @@ function requireDist () {
9947
9960
  this.repository.fetchAndParsePlaceDetail(parentPlaceId).then(function (place) {
9948
9961
  _this3.changeParentPlaceTo(place);
9949
9962
  _this3.potentialParentPlaces.push(place);
9950
- })["catch"](console.error);
9963
+ })["catch"](function (error) {
9964
+ _this3.logError(error, {
9965
+ functionName: "initialPlaceDetailSetUp"
9966
+ });
9967
+ });
9951
9968
  }
9952
9969
  }, {
9953
9970
  key: "loadOtherPotentialParentPlaces",
@@ -9958,7 +9975,11 @@ function requireDist () {
9958
9975
  })).then(function (places) {
9959
9976
  var _this4$potentialParen;
9960
9977
  (_this4$potentialParen = _this4.potentialParentPlaces).push.apply(_this4$potentialParen, map_toConsumableArray(places));
9961
- })["catch"](console.error);
9978
+ })["catch"](function (error) {
9979
+ _this4.logError(error, {
9980
+ functionName: "loadOtherPotentialParentPlaces"
9981
+ });
9982
+ });
9962
9983
  }
9963
9984
  }, {
9964
9985
  key: "subPlacesLoad",
@@ -9966,14 +9987,19 @@ function requireDist () {
9966
9987
  var _this5 = this;
9967
9988
  this.repository.fetchAndParseSubPlaces(parentPlaceId).then(function (subPlaces) {
9968
9989
  _this5.subPlaces = subPlaces;
9969
- })["catch"](console.error);
9990
+ })["catch"](function (error) {
9991
+ _this5.logError(error, {
9992
+ functionName: "subPlacesLoad"
9993
+ });
9994
+ _this5.subPlaces = [];
9995
+ });
9970
9996
  }
9971
9997
  }, {
9972
9998
  key: "initialMapStyleSetUp",
9973
9999
  value: function initialMapStyleSetUp(mapConfig, container) {
9974
10000
  var _this6 = this;
9975
10001
  this.repository.fetchAndParseMapStyle(mapConfig.parentPlaceId).then(function (style) {
9976
- var _mapConfig$pitch, _mapConfig$bearingSna;
10002
+ var _mapConfig$pitch, _mapConfig$bearingSna, _mapConfig$navigation;
9977
10003
  var mapOptions = {
9978
10004
  container: container,
9979
10005
  style: style,
@@ -9981,6 +10007,7 @@ function requireDist () {
9981
10007
  zoom: mapConfig.zoom,
9982
10008
  pitch: (_mapConfig$pitch = mapConfig.pitch) !== null && _mapConfig$pitch !== void 0 ? _mapConfig$pitch : 0,
9983
10009
  attributionControl: false,
10010
+ maplibreLogo: false,
9984
10011
  bearingSnap: (_mapConfig$bearingSna = mapConfig.bearingSnap) !== null && _mapConfig$bearingSna !== void 0 ? _mapConfig$bearingSna : 0
9985
10012
  };
9986
10013
  if (mapConfig.maxZoom) mapOptions.maxZoom = mapConfig.maxZoom;
@@ -9990,7 +10017,10 @@ function requireDist () {
9990
10017
  mapOptions.maxBounds = new maplibre_gl.LngLatBounds([boundingBox[0].lng, boundingBox[0].lat], [boundingBox[1].lng, boundingBox[1].lat]);
9991
10018
  }
9992
10019
  _this6.map = new maplibre_gl.Map(mapOptions);
9993
- _this6.map.addControl(new maplibre_gl.NavigationControl({}), "top-right");
10020
+ _this6.map.addControl(new maplibre_gl.NavigationControl({
10021
+ showCompass: mapConfig.showCompass !== undefined ? mapConfig.showCompass : true,
10022
+ showZoom: mapConfig.showZoom !== undefined ? mapConfig.showZoom : true
10023
+ }), (_mapConfig$navigation = mapConfig.navigationPosition) !== null && _mapConfig$navigation !== void 0 ? _mapConfig$navigation : "top-right");
9994
10024
  _this6.map.on("load", function () {
9995
10025
  var _mapConfig$onMapReady;
9996
10026
  _this6.whenStyleUpdates(style);
@@ -10008,7 +10038,11 @@ function requireDist () {
10008
10038
  });
10009
10039
  _this6.defaultClickListener();
10010
10040
  return _this6.map;
10011
- })["catch"](console.error);
10041
+ })["catch"](function (error) {
10042
+ _this6.logError(error, {
10043
+ functionName: "initialMapStyleSetUp"
10044
+ });
10045
+ });
10012
10046
  }
10013
10047
  }, {
10014
10048
  key: "setBaseFilters",
@@ -10137,7 +10171,11 @@ function requireDist () {
10137
10171
  _this9.map.setStyle(style);
10138
10172
  _this9.whenStyleUpdates(style);
10139
10173
  onStyleReady === null || onStyleReady === void 0 || onStyleReady();
10140
- })["catch"](console.error);
10174
+ })["catch"](function (error) {
10175
+ _this9.logError(error, {
10176
+ functionName: "changeParentPlaceTo"
10177
+ });
10178
+ });
10141
10179
  }
10142
10180
  }
10143
10181
 
@@ -10178,7 +10216,6 @@ function requireDist () {
10178
10216
  this.logError(error, {
10179
10217
  functionName: "updateParentPlaceAndFloor"
10180
10218
  });
10181
- throw new Error("Failed to update parent place and floor");
10182
10219
  }
10183
10220
  }
10184
10221
  }, {
@@ -10218,8 +10255,7 @@ function requireDist () {
10218
10255
  value: function addMarker(marker) {
10219
10256
  try {
10220
10257
  var markerCreated = new MarkerAttribute(marker);
10221
- markerCreated.changeFloor(this.currentFloor);
10222
- markerCreated.addToMap(this.map);
10258
+ markerCreated.changeFloor(this.currentFloor, this.map);
10223
10259
  this.markers.push(markerCreated);
10224
10260
  this.logEvent("addMarker");
10225
10261
  return markerCreated.id;
@@ -10227,7 +10263,7 @@ function requireDist () {
10227
10263
  this.logError(error, {
10228
10264
  functionName: "addMarker"
10229
10265
  });
10230
- throw new Error("Failed to add marker");
10266
+ return "";
10231
10267
  }
10232
10268
  }
10233
10269
  }, {
@@ -10247,7 +10283,7 @@ function requireDist () {
10247
10283
  this.logError(error, {
10248
10284
  functionName: "updateMarker"
10249
10285
  });
10250
- throw new Error("Failed to update marker");
10286
+ return "";
10251
10287
  }
10252
10288
  }
10253
10289
  }, {
@@ -10257,15 +10293,14 @@ function requireDist () {
10257
10293
  var _marker2 = this.markers.find(function (e) {
10258
10294
  return e.id === markerId;
10259
10295
  });
10260
- if (_marker2 !== null) {
10261
- _marker2 === null || _marker2 === void 0 || _marker2.show();
10296
+ if (_marker2 !== null && this.map) {
10297
+ _marker2 === null || _marker2 === void 0 || _marker2.show(this.map);
10262
10298
  }
10263
10299
  this.logEvent("showMarker");
10264
10300
  } catch (error) {
10265
10301
  this.logError(error, {
10266
10302
  functionName: "showMarker"
10267
10303
  });
10268
- throw new Error("Failed to show marker");
10269
10304
  }
10270
10305
  }
10271
10306
  }, {
@@ -10283,7 +10318,6 @@ function requireDist () {
10283
10318
  this.logError(error, {
10284
10319
  functionName: "hideMarker"
10285
10320
  });
10286
- throw new Error("Failed to hide marker");
10287
10321
  }
10288
10322
  }
10289
10323
  }, {
@@ -10304,7 +10338,6 @@ function requireDist () {
10304
10338
  this.logError(error, {
10305
10339
  functionName: "removeMarker"
10306
10340
  });
10307
- throw new Error("Failed to remove marker");
10308
10341
  }
10309
10342
  }
10310
10343
 
@@ -10315,12 +10348,14 @@ function requireDist () {
10315
10348
  }, {
10316
10349
  key: "filterByFloorKey",
10317
10350
  value: function filterByFloorKey(floorKey) {
10351
+ this.currentFloor = floorKey;
10318
10352
  if (this.innerFloors.every(function (floor) {
10319
10353
  return floor.key !== floorKey;
10320
10354
  }) && floorKey !== "") {
10321
- throw new Error("Invalid id '".concat(floorKey, "' for inner floor"));
10355
+ this.logEvent("invalidFloorKey", {
10356
+ floorKey: floorKey
10357
+ });
10322
10358
  }
10323
- this.currentFloor = floorKey;
10324
10359
  this.updateFiltersTo(floorKey);
10325
10360
  this.updateMarkersTo(floorKey);
10326
10361
  this.routeController.updateRouteLayers(floorKey);
@@ -10334,8 +10369,9 @@ function requireDist () {
10334
10369
  }, {
10335
10370
  key: "updateMarkersTo",
10336
10371
  value: function updateMarkersTo(floorId) {
10372
+ var _this10 = this;
10337
10373
  this.markers.forEach(function (e) {
10338
- e.changeFloor(floorId);
10374
+ e.changeFloor(floorId, _this10.map);
10339
10375
  });
10340
10376
  }
10341
10377
  }, {
@@ -10343,13 +10379,14 @@ function requireDist () {
10343
10379
  value: function updateFiltersTo(floorId) {
10344
10380
  var _this$map$getStyle$la2,
10345
10381
  _this$map$getStyle2,
10346
- _this10 = this,
10382
+ _this11 = this,
10347
10383
  _this$innerFloors$fin4;
10384
+ if (!this.map) return;
10348
10385
  var layers = (_this$map$getStyle$la2 = (_this$map$getStyle2 = this.map.getStyle()) === null || _this$map$getStyle2 === void 0 ? void 0 : _this$map$getStyle2.layers) !== null && _this$map$getStyle$la2 !== void 0 ? _this$map$getStyle$la2 : [];
10349
10386
  layers.filter(function (l) {
10350
10387
  return l.id.startsWith("base-indoor-");
10351
10388
  }).forEach(function (l) {
10352
- _this10.map.removeLayer(l.id);
10389
+ _this11.map.removeLayer(l.id);
10353
10390
  });
10354
10391
  var baseFloorId = (_this$innerFloors$fin4 = this.innerFloors.find(function (floor) {
10355
10392
  return floor.key === floorId;
@@ -10365,13 +10402,13 @@ function requireDist () {
10365
10402
  }).forEach(function (layer) {
10366
10403
  var baseLayer = structuredClone(layer);
10367
10404
  baseLayer.id = "base-" + layer.id;
10368
- _this10.baseFilters[baseLayer.id] = _this10.baseFilters[layer.id];
10369
- _this10.map.addLayer(baseLayer, firstLayerId);
10370
- _this10.applyLayerFilters(baseLayer, baseFloorId);
10405
+ _this11.baseFilters[baseLayer.id] = _this11.baseFilters[layer.id];
10406
+ _this11.map.addLayer(baseLayer, firstLayerId);
10407
+ _this11.applyLayerFilters(baseLayer, baseFloorId);
10371
10408
  });
10372
10409
  }
10373
10410
  indoorLayers.forEach(function (layer) {
10374
- _this10.applyLayerFilters(layer, floorId);
10411
+ _this11.applyLayerFilters(layer, floorId);
10375
10412
  });
10376
10413
  }
10377
10414
  }, {
@@ -10506,7 +10543,6 @@ function requireDist () {
10506
10543
  functionName: "updateFloor",
10507
10544
  floorId: floorId
10508
10545
  });
10509
- throw new Error("Failed to update floor");
10510
10546
  }
10511
10547
  }
10512
10548
  }, {
@@ -10526,7 +10562,6 @@ function requireDist () {
10526
10562
  functionName: "updatePlaceAndFloorForRouting",
10527
10563
  floorId: floorId
10528
10564
  });
10529
- throw new Error("Failed to update place and floor for routing");
10530
10565
  }
10531
10566
  }
10532
10567
  }, {
@@ -10580,7 +10615,6 @@ function requireDist () {
10580
10615
  this.logError(error, {
10581
10616
  functionName: "removeRoute"
10582
10617
  });
10583
- throw new Error("Error: Failed to remove route");
10584
10618
  }
10585
10619
  }
10586
10620
  }, {
@@ -10617,26 +10651,26 @@ function requireDist () {
10617
10651
  }, {
10618
10652
  key: "defaultClickListener",
10619
10653
  value: function defaultClickListener() {
10620
- var _this11 = this;
10654
+ var _this12 = this;
10621
10655
  this.map.on("click", function (e) {
10622
10656
  var _ref4, _clickedPlace$lazaril;
10623
- var features = _this11.map.queryRenderedFeatures(e.point);
10657
+ var features = _this12.map.queryRenderedFeatures(e.point);
10624
10658
  var touchedFeature = features.find(function (feature) {
10625
10659
  return feature.properties["class"] === "room";
10626
10660
  });
10627
- var clickedPlace = _this11.subPlaces.find(function (subPlace) {
10661
+ var clickedPlace = _this12.subPlaces.find(function (subPlace) {
10628
10662
  return subPlace.lazarilloId === (touchedFeature === null || touchedFeature === void 0 ? void 0 : touchedFeature.properties.ref);
10629
10663
  });
10630
10664
  var clickedPlaceId = (_ref4 = (_clickedPlace$lazaril = clickedPlace === null || clickedPlace === void 0 ? void 0 : clickedPlace.lazarilloId) !== null && _clickedPlace$lazaril !== void 0 ? _clickedPlace$lazaril : clickedPlace === null || clickedPlace === void 0 ? void 0 : clickedPlace.clientId) !== null && _ref4 !== void 0 ? _ref4 : "";
10631
- if (clickedPlace !== undefined && _this11.clickCallback) {
10632
- _this11.clickCallback(clickedPlaceId);
10665
+ if (clickedPlace !== undefined && _this12.clickCallback) {
10666
+ _this12.clickCallback(clickedPlaceId);
10633
10667
  }
10634
10668
  });
10635
10669
  }
10636
10670
  }, {
10637
10671
  key: "onHover",
10638
10672
  value: function onHover() {
10639
- var _this12 = this;
10673
+ var _this13 = this;
10640
10674
  if (!this.enableHover) return;
10641
10675
  this.map.on("mousemove", "hoverable", function (e) {
10642
10676
  var _e$features;
@@ -10644,54 +10678,100 @@ function requireDist () {
10644
10678
  var _feature$properties$r, _feature$properties;
10645
10679
  return (
10646
10680
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
10647
- ((_feature$properties$r = feature.properties.ref) === null || _feature$properties$r === void 0 ? void 0 : _feature$properties$r.length) > 0 && ((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.floor_key) === _this12.currentFloor
10681
+ ((_feature$properties$r = feature.properties.ref) === null || _feature$properties$r === void 0 ? void 0 : _feature$properties$r.length) > 0 && ((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.floor_key) === _this13.currentFloor
10648
10682
  );
10649
10683
  });
10650
10684
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10651
10685
  var ref = feature === null || feature === void 0 ? void 0 : feature.properties.ref;
10652
10686
  if (ref !== undefined && ref.length > 0) {
10653
- _this12.hoveredId = ref;
10654
- _this12.updateFiltersTo(_this12.currentFloor);
10655
- } else if (ref === undefined && _this12.hoveredId !== "unselected") {
10656
- _this12.hoveredId = "unselected";
10657
- _this12.updateFiltersTo(_this12.currentFloor);
10687
+ _this13.hoveredId = ref;
10688
+ _this13.updateFiltersTo(_this13.currentFloor);
10689
+ } else if (ref === undefined && _this13.hoveredId !== "unselected") {
10690
+ _this13.hoveredId = "unselected";
10691
+ _this13.updateFiltersTo(_this13.currentFloor);
10658
10692
  }
10659
10693
  });
10660
10694
 
10661
10695
  // When the mouse leaves the state-fill layer, update the feature state of the
10662
10696
  // previously hovered feature.
10663
10697
  this.map.on("mouseleave", "hoverable", function () {
10664
- _this12.hoveredId = "unselected";
10665
- _this12.updateFiltersTo(_this12.currentFloor);
10698
+ _this13.hoveredId = "unselected";
10699
+ _this13.updateFiltersTo(_this13.currentFloor);
10666
10700
  });
10667
10701
  }
10668
10702
  }, {
10669
10703
  key: "setPlacesAsSelected",
10670
- value: function setPlacesAsSelected(placeIds) {
10671
- var color = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "#276EF1";
10704
+ value: function setPlacesAsSelected(placeIds, color) {
10672
10705
  try {
10673
10706
  if (!this.hasLayer("indoor-colored-places")) {
10674
- return;
10707
+ this.logError(new Error("Layer indoor-colored-places does not exist on current style"));
10708
+ this.createColoredPlacesLayer();
10675
10709
  }
10676
10710
  var basicFilter = this.createBasicFilters();
10677
- var coloredPlaces = this.subPlaces.filter(function (place) {
10678
- var _place$clientId;
10679
- return placeIds.includes((_place$clientId = place.clientId) !== null && _place$clientId !== void 0 ? _place$clientId : "") || placeIds.includes(place.lazarilloId);
10680
- });
10681
- var coloredPlacesFilters = coloredPlaces.map(function (place) {
10682
- var filter = ["==", ["get", "ref"], place.lazarilloId];
10711
+ var coloredPlacesFilters = placeIds.map(function (id) {
10712
+ var filter = ["==", ["get", "ref"], id];
10683
10713
  return filter;
10684
10714
  });
10685
10715
  var placeFilter = ["any"].concat(map_toConsumableArray(coloredPlacesFilters));
10686
10716
  var condition = ["all", placeFilter, basicFilter];
10687
10717
  this.map.setFilter("indoor-colored-places", condition);
10688
10718
  this.baseFilters["indoor-colored-places"] = placeFilter;
10689
- this.map.setPaintProperty("indoor-colored-places", "fill-color", color);
10719
+ if (color !== undefined) {
10720
+ var layer = this.map.getLayer("indoor-colored-places");
10721
+ switch (layer === null || layer === void 0 ? void 0 : layer.type) {
10722
+ case "fill":
10723
+ this.map.setPaintProperty("indoor-colored-places", "fill-color", color);
10724
+ break;
10725
+ case "fill-extrusion":
10726
+ this.map.setPaintProperty("indoor-colored-places", "fill-extrusion-color", color);
10727
+ break;
10728
+ default:
10729
+ break;
10730
+ }
10731
+ }
10690
10732
  } catch (error) {
10691
10733
  this.logError(error, {
10692
10734
  functionName: "setPlacesAsSelected"
10693
10735
  });
10694
- throw new Error("Failed to set places as selected");
10736
+ }
10737
+ }
10738
+ }, {
10739
+ key: "is3DStyle",
10740
+ value: function is3DStyle() {
10741
+ var layers = this.map.getStyle().layers;
10742
+ return layers.some(function (layer) {
10743
+ return layer.type === "fill-extrusion";
10744
+ });
10745
+ }
10746
+ }, {
10747
+ key: "createColoredPlacesLayer",
10748
+ value: function createColoredPlacesLayer() {
10749
+ if (this.is3DStyle()) {
10750
+ var layer = {
10751
+ id: "indoor-colored-places",
10752
+ type: "fill-extrusion",
10753
+ source: "indoorequal",
10754
+ "source-layer": "area",
10755
+ filter: ["all", ["has", "ref"], ["==", ["get", "ref"], "unselected"]],
10756
+ paint: {
10757
+ "fill-extrusion-height": 2.5,
10758
+ "fill-extrusion-color": "#276EF1",
10759
+ "fill-extrusion-opacity": 0.8
10760
+ }
10761
+ };
10762
+ this.map.addLayer(layer);
10763
+ } else {
10764
+ var _layer = {
10765
+ id: "indoor-colored-places",
10766
+ type: "fill",
10767
+ source: "indoorequal",
10768
+ "source-layer": "area",
10769
+ filter: ["all", ["has", "ref"], ["==", ["get", "ref"], "unselected"]],
10770
+ paint: {
10771
+ "fill-color": "#276EF1"
10772
+ }
10773
+ };
10774
+ this.map.addLayer(_layer);
10695
10775
  }
10696
10776
  }
10697
10777
  }, {
@@ -10701,7 +10781,7 @@ function requireDist () {
10701
10781
  var publicPlaceFilter = ["==", ["get", "public_place"], true];
10702
10782
  var subPlaceFilter = ["!=", ["get", "is_subplace"], (_this$parentPlaceId3 = this.parentPlaceId) !== null && _this$parentPlaceId3 !== void 0 ? _this$parentPlaceId3 : ""];
10703
10783
  var floorId = (_this$currentFloor = this.currentFloor) !== null && _this$currentFloor !== void 0 ? _this$currentFloor : "+";
10704
- var floorFilter = ["any", ["==", ["get", "floor_key"], floorId]];
10784
+ var floorFilter = ["==", ["get", "floor_key"], floorId];
10705
10785
  var showInFloorFilter = ["==", ["get", "show_in_floor"], floorId];
10706
10786
  var basicFilters = publicPlaceFilter;
10707
10787
  if (this.parentPlaceId != null) {
@@ -11027,6 +11107,7 @@ function requireDist () {
11027
11107
  }, {
11028
11108
  key: "addUserLocationTracking",
11029
11109
  value: function addUserLocationTracking(enableHighAccuracy) {
11110
+ var _this14 = this;
11030
11111
  var initialCoordinate = {
11031
11112
  lat: 0.0,
11032
11113
  lng: 0.0
@@ -11045,7 +11126,9 @@ function requireDist () {
11045
11126
  marker.setLngLat([position.coords.longitude, position.coords.latitude]);
11046
11127
  };
11047
11128
  this.watchPositionID = navigator.geolocation.watchPosition(updateMarker, function (error) {
11048
- console.error("Error getting user location:", error);
11129
+ _this14.logError(error, {
11130
+ functionName: "addUserLocationTracking"
11131
+ });
11049
11132
  }, {
11050
11133
  enableHighAccuracy: enableHighAccuracy
11051
11134
  });
@@ -11063,7 +11146,9 @@ function requireDist () {
11063
11146
  this.watchPositionID = undefined;
11064
11147
  }
11065
11148
  } else {
11066
- console.error("Error trying to remove location tracking, is already gone");
11149
+ this.logError(new Error("Error trying to remove location tracking, is already gone"), {
11150
+ functionName: "removeUserLocationTracking"
11151
+ });
11067
11152
  }
11068
11153
  }
11069
11154
  }, {
@@ -11073,28 +11158,25 @@ function requireDist () {
11073
11158
  }
11074
11159
  }, {
11075
11160
  key: "addBorderToPlaces",
11076
- value: function addBorderToPlaces(placeIds) {
11077
- var color = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "#276EF1";
11078
- var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 4;
11161
+ value: function addBorderToPlaces(placeIds, color, width) {
11079
11162
  try {
11080
11163
  if (!this.hasLayer("indoor-bordered-places")) {
11081
- throw new Error("Layer indoor-bordered-places does not exist on current style");
11164
+ this.logError(new Error("Layer indoor-bordered-places does not exist on current style"));
11165
+ this.createBorderedPlacesLayer();
11082
11166
  }
11083
11167
  var basicFilter = this.createBasicFilters();
11084
- var coloredPlaces = this.subPlaces.filter(function (place) {
11085
- var _place$clientId2;
11086
- return placeIds.includes((_place$clientId2 = place.clientId) !== null && _place$clientId2 !== void 0 ? _place$clientId2 : "") || placeIds.includes(place.lazarilloId);
11087
- });
11088
- var coloredPlacesFilters = coloredPlaces.map(function (place) {
11089
- var filter = ["==", ["get", "ref"], place.lazarilloId];
11168
+ var coloredPlacesFilters = placeIds.map(function (id) {
11169
+ var filter = ["==", ["get", "ref"], id];
11090
11170
  return filter;
11091
11171
  });
11092
11172
  var placeFilter = ["any"].concat(map_toConsumableArray(coloredPlacesFilters));
11093
11173
  var condition = ["all", placeFilter, basicFilter];
11094
11174
  this.map.setFilter("indoor-bordered-places", condition);
11095
11175
  this.baseFilters["indoor-bordered-places"] = placeFilter;
11096
- this.map.setPaintProperty("indoor-bordered-places", "line-color", color);
11097
- this.map.setPaintProperty("indoor-bordered-places", "line-width", width);
11176
+ if (color !== undefined && width !== undefined) {
11177
+ this.map.setPaintProperty("indoor-bordered-places", "line-color", color);
11178
+ this.map.setPaintProperty("indoor-bordered-places", "line-width", width);
11179
+ }
11098
11180
  } catch (error) {
11099
11181
  this.logError(error, {
11100
11182
  functionName: "addBorderToPlaces"
@@ -11102,6 +11184,22 @@ function requireDist () {
11102
11184
  throw new Error("Failed to add border to places");
11103
11185
  }
11104
11186
  }
11187
+ }, {
11188
+ key: "createBorderedPlacesLayer",
11189
+ value: function createBorderedPlacesLayer() {
11190
+ var layer = {
11191
+ id: "indoor-bordered-places",
11192
+ type: "line",
11193
+ source: "indoorequal",
11194
+ "source-layer": "area",
11195
+ filter: ["all", ["has", "ref"], ["==", ["get", "ref"], "unselected"]],
11196
+ paint: {
11197
+ "line-color": "#276EF1",
11198
+ "line-width": 4
11199
+ }
11200
+ };
11201
+ this.map.addLayer(layer);
11202
+ }
11105
11203
  }, {
11106
11204
  key: "clearBorderedPlaces",
11107
11205
  value: function clearBorderedPlaces() {
@@ -12397,4 +12495,4 @@ class RouteAnimationController {
12397
12495
  }
12398
12496
 
12399
12497
  export { MarkerController as M, RouteAnimationController as R, SDKController as S };
12400
- //# sourceMappingURL=utils-CL_wN9yE.js.map
12498
+ //# sourceMappingURL=utils-BClW6qwe.js.map