Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/map-template/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.96.16] - 2026-03-25

### Fixed

- Upgraded to Web SDK 4.56.0.

## [1.96.15] - 2026-03-24

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions packages/map-template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#005655" />
<title>MapsIndoors Web</title>
<script defer src="https://app.mapsindoors.com/mapsindoors/js/sdk/4.55.0/mapsindoors-4.55.0.js.gz"
integrity="sha384-oW7TEiuEViUPGMgbrtXn96vWoBrrtrT+tYYCaVNll6KZTr8GWS5dqjV0sdJOcyhk"
<script defer src="https://app.mapsindoors.com/mapsindoors/js/sdk/4.56.0/mapsindoors-4.56.0.js.gz"
integrity="sha384-jNY73YbOtdlv5xKtZYwPDPMWFym59MhTK1MAfgFrT1kheVpr+LvomZTbuETxf2lj"
crossorigin="anonymous"></script>
</head>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ function MapTemplate({ apiKey, gmApiKey, mapboxAccessToken, venue, locationId, p
const miSdkApiTag = document.createElement('script');
miSdkApiTag.setAttribute('type', 'text/javascript');
// Remember to update the root index.html with the same version / integrity
miSdkApiTag.setAttribute('src', 'https://app.mapsindoors.com/mapsindoors/js/sdk/4.55.0/mapsindoors-4.55.0.js.gz');
miSdkApiTag.setAttribute('integrity', 'sha384-oW7TEiuEViUPGMgbrtXn96vWoBrrtrT+tYYCaVNll6KZTr8GWS5dqjV0sdJOcyhk');
miSdkApiTag.setAttribute('src', 'https://app.mapsindoors.com/mapsindoors/js/sdk/4.56.0/mapsindoors-4.56.0.js.gz');
miSdkApiTag.setAttribute('integrity', 'sha384-jNY73YbOtdlv5xKtZYwPDPMWFym59MhTK1MAfgFrT1kheVpr+LvomZTbuETxf2lj');
miSdkApiTag.setAttribute('crossorigin', 'anonymous');
document.body.appendChild(miSdkApiTag);
miSdkApiTag.onload = () => {
Expand Down Expand Up @@ -587,6 +587,7 @@ function MapTemplate({ apiKey, gmApiKey, mapboxAccessToken, venue, locationId, p

if (currentLocation && currentLocation.id !== kioskOriginLocationId) {
if (mapsIndoorsInstance?.selectLocation) {
mapsIndoorsInstance.highlight?.([]);
mapsIndoorsInstance.selectLocation(currentLocation);
}
} else {
Expand Down
14 changes: 11 additions & 3 deletions packages/map-template/src/components/MapWrapper/MapWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import gmApiKeyState from '../../atoms/gmApiKeyState';
import mapboxAccessTokenState from '../../atoms/mapboxAccessTokenState';
import filteredLocationsState from '../../atoms/filteredLocationsState';
import filteredLocationsByExternalIDState from '../../atoms/filteredLocationsByExternalIDState';
import currentLocationState from '../../atoms/currentLocationState';
import tileStyleState from '../../atoms/tileStyleState';
import positionControlState from '../../atoms/positionControlState';
import bearingState from '../../atoms/bearingState';
Expand Down Expand Up @@ -78,6 +79,7 @@ function MapWrapper({ onLocationClick, onMapPositionKnown, useMapProviderModule,
const setDirectionsService = useSetRecoilState(directionsServiceState);
const filteredLocations = useRecoilValue(filteredLocationsState);
const filteredLocationsByExternalIDs = useRecoilValue(filteredLocationsByExternalIDState);
const currentLocation = useRecoilValue(currentLocationState);
const tileStyle = useRecoilValue(tileStyleState);
const bearing = useRecoilValue(bearingState);
const pitch = useRecoilValue(pitchState);
Expand Down Expand Up @@ -175,17 +177,23 @@ function MapWrapper({ onLocationClick, onMapPositionKnown, useMapProviderModule,
* Dynamically filter or highlight location based on the "filteredLocations", "filteredLocationsByExternalIDs" and "hideNonMatches" property.
*/
useEffect(() => {
if (!mapsIndoorsInstance) return;

const locations = filteredLocations || filteredLocationsByExternalIDs;
if (!locations || locations.length === 0 || !mapsIndoorsInstance) return;

if (currentLocation || !locations || locations.length === 0) {
mapsIndoorsInstance.highlight?.([]);
return;
}

const locationIds = locations.map(location => location.id);

// Check if the hideNonMatches prop or highlight method in the SDK exists
if (hideNonMatches || !mapsIndoorsInstance.highlight) {
mapsIndoorsInstance.filter(locationIds);
} else {
mapsIndoorsInstance.highlight(locationIds);
}
}, [filteredLocations, filteredLocationsByExternalIDs, mapsIndoorsInstance, hideNonMatches]);
}, [filteredLocations, filteredLocationsByExternalIDs, mapsIndoorsInstance, hideNonMatches, currentLocation]);

/*
* React to changes in bearing and pitch props and set them on the map if mapsIndoorsInstance exists.
Expand Down
21 changes: 18 additions & 3 deletions packages/map-template/src/components/Search/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import isNullOrUndefined from '../../helpers/isNullOrUndefined';
import venuesInSolutionState from '../../atoms/venuesInSolutionState';
import initialVenueNameState from '../../atoms/initialVenueNameState';
import primaryColorState from '../../atoms/primaryColorState';
import mapTypeState from '../../atoms/mapTypeState';
import { mapTypes } from '../../constants/mapTypes';
import PropTypes from 'prop-types';

Search.propTypes = {
Expand Down Expand Up @@ -88,6 +90,7 @@ function Search({ onSetSize, isOpen, onOpenChat }) {
const [hoveredLocation, setHoveredLocation] = useState();

const mapsIndoorsInstance = useRecoilValue(mapsIndoorsInstanceState);
const mapType = useRecoilValue(mapTypeState);

const setFilteredLocations = useSetRecoilState(filteredLocationsState);

Expand Down Expand Up @@ -372,8 +375,6 @@ function Search({ onSetSize, isOpen, onOpenChat }) {
* @param {object} location
*/
function onLocationClicked(location) {
setCurrentLocation(location);

// Set the current venue to be the selected location venue.
if (location.properties.venueId.toLowerCase() !== currentVenueName.toLowerCase()) {
setCurrentVenueName(location.properties.venueId);
Expand All @@ -383,9 +384,23 @@ function Search({ onSetSize, isOpen, onOpenChat }) {
const currentFloor = mapsIndoorsInstance.getFloor();
const locationFloor = location.properties.floor;

// Set the floor to the one that the location belongs to.
if (locationFloor !== currentFloor) {
// Register listener before setFloor — floor_changed fires
// synchronously inside setFloor(), so it would be missed otherwise.
mapsIndoorsInstance.once('floor_changed', () => {
const map = mapsIndoorsInstance.getMap();
if (mapType === mapTypes.Mapbox) {
map.once('idle', () => setCurrentLocation(location));
} else if (mapType === mapTypes.Google) {
const listener = map.addListener('idle', () => {
listener.remove();
setCurrentLocation(location);
});
}
});
mapsIndoorsInstance.setFloor(locationFloor);
} else {
setCurrentLocation(location);
}

Promise.all([getBottomPadding(), getLeftPadding()]).then(([bottomPadding, leftPadding]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { useTranslation } from 'react-i18next';
import './ListItemLocation.scss';
import showExternalIDsState from '../../../atoms/showExternalIDsState';
import PropTypes from 'prop-types';
import { debounce } from 'lodash';

ListItemLocation.propTypes = {
location: PropTypes.object,
locationClicked: PropTypes.func,
Expand Down Expand Up @@ -34,25 +32,22 @@ function ListItemLocation({ location, locationClicked, icon, isHovered, disableH
const showExternalIDs = useRecoilValue(showExternalIDsState);

useEffect(() => {
const clickHandler = customEvent => locationClicked(customEvent.detail);
const hoverHandler = debounce(() => {
// Skip hover functionality if disabled (e.g., during routing to prevent dual pins)
const clickHandler = customEvent => {
mapsIndoorsInstance.unhoverLocation();
locationClicked(customEvent.detail);
};
const hoverHandler = () => {
if (disableHover) return;

// Check if the location is non-selectable before hovering it
if (location.properties.locationSettings?.selectable !== false) {
mapsIndoorsInstance.hoverLocation(location);
}
}, 150);
const unhoverHandler = debounce(() => {
// Skip unhover functionality if disabled
};
const unhoverHandler = () => {
if (disableHover) return;

// Check if the location is non-selectable before unhovering it
if (location.properties.locationSettings?.selectable !== false) {
mapsIndoorsInstance.unhoverLocation(location);
}
}, 150);
};

// Add a "non-selectable" class to the non-selectable locations.
if (location.properties.locationSettings?.selectable === false) {
Expand Down
Loading