UNPKG

communication-react-19

Version:

React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)

27 lines 1.46 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { toFlatCommunicationIdentifier } from "../../../../../acs-ui-common/src"; import * as reselect from 'reselect'; import { getRemoteParticipants, getSpotlightedParticipants } from './baseSelectors'; /** * Get the first remote participant that is spotlighted if any * * @private */ export const getFirstSpotlightedRemoteParticipant = reselect.createSelector([getRemoteParticipants, getSpotlightedParticipants], (remoteParticipants, spotlightedParticipants) => { const spotlightedParticipantUserIds = spotlightedParticipants ? spotlightedParticipants.map((p) => toFlatCommunicationIdentifier(p.identifier)) : []; const firstSpotlightedRemoteParticipant = remoteParticipants ? findFirstSpotlightedRemoteParticipant(remoteParticipants, spotlightedParticipantUserIds) : undefined; return firstSpotlightedRemoteParticipant; }); const findFirstSpotlightedRemoteParticipant = (remoteParticipants, spotlightedParticipantUserIds) => { const remoteParticipantIds = Object.keys(remoteParticipants); const spotlightedRemoteParticipantUserIds = spotlightedParticipantUserIds.filter((p) => remoteParticipantIds.includes(p)); return spotlightedRemoteParticipantUserIds[0] ? remoteParticipants[spotlightedRemoteParticipantUserIds[0]] : undefined; }; //# sourceMappingURL=getFirstSpotlightedRemoteParticipantSelector.js.map