@stream-io/video-react-sdk 1.19.8 → 1.20.0
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/CHANGELOG.md +16 -0
- package/dist/css/styles.css +5 -0
- package/dist/css/styles.css.map +1 -1
- package/dist/index.cjs.js +20 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +20 -26
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/Search/hooks/useSearch.d.ts +1 -1
- package/dist/src/translations/index.d.ts +1 -0
- package/package.json +4 -4
- package/src/components/CallParticipantsList/CallParticipantsList.tsx +14 -25
- package/src/components/Search/hooks/useSearch.ts +8 -5
- package/src/core/components/ParticipantView/ParticipantActionsContextMenu.tsx +9 -8
- package/src/translations/en.json +1 -0
package/dist/index.cjs.js
CHANGED
|
@@ -580,6 +580,7 @@ const ParticipantActionsContextMenu = () => {
|
|
|
580
580
|
const hasScreenShareTrack = videoClient.hasScreenShare(participant);
|
|
581
581
|
const hasScreenShareAudioTrack = videoClient.hasScreenShareAudio(participant);
|
|
582
582
|
const blockUser = () => call?.blockUser(userId);
|
|
583
|
+
const kickUser = () => call?.kickUser({ user_id: userId });
|
|
583
584
|
const muteAudio = () => call?.muteUser(userId, 'audio');
|
|
584
585
|
const muteVideo = () => call?.muteUser(userId, 'video');
|
|
585
586
|
const muteScreenShare = () => call?.muteUser(userId, 'screenshare');
|
|
@@ -606,20 +607,14 @@ const ParticipantActionsContextMenu = () => {
|
|
|
606
607
|
};
|
|
607
608
|
const pinForEveryone = () => {
|
|
608
609
|
call
|
|
609
|
-
?.pinForEveryone({
|
|
610
|
-
user_id: userId,
|
|
611
|
-
session_id: sessionId,
|
|
612
|
-
})
|
|
610
|
+
?.pinForEveryone({ user_id: userId, session_id: sessionId })
|
|
613
611
|
.catch((err) => {
|
|
614
612
|
console.error(`Failed to pin participant ${userId}`, err);
|
|
615
613
|
});
|
|
616
614
|
};
|
|
617
615
|
const unpinForEveryone = () => {
|
|
618
616
|
call
|
|
619
|
-
?.unpinForEveryone({
|
|
620
|
-
user_id: userId,
|
|
621
|
-
session_id: sessionId,
|
|
622
|
-
})
|
|
617
|
+
?.unpinForEveryone({ user_id: userId, session_id: sessionId })
|
|
623
618
|
.catch((err) => {
|
|
624
619
|
console.error(`Failed to unpin participant ${userId}`, err);
|
|
625
620
|
});
|
|
@@ -650,7 +645,7 @@ const ParticipantActionsContextMenu = () => {
|
|
|
650
645
|
return document.exitPictureInPicture().catch(console.error);
|
|
651
646
|
};
|
|
652
647
|
const { close } = useMenuContext() || {};
|
|
653
|
-
return (jsxRuntime.jsxs(GenericMenu, { onItemClick: close, children: [jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: toggleParticipantPin, disabled: pin && !pin.isLocalPin, children: [jsxRuntime.jsx(Icon, { icon: "pin" }), pin ? t('Unpin') : t('Pin')] }), jsxRuntime.jsxs(videoReactBindings.Restricted, { requiredGrants: [videoClient.OwnCapability.PIN_FOR_EVERYONE], children: [jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: pinForEveryone, disabled: pin && !pin.isLocalPin, children: [jsxRuntime.jsx(Icon, { icon: "pin" }), t('Pin for everyone')] }), jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: unpinForEveryone, disabled: !pin || pin.isLocalPin, children: [jsxRuntime.jsx(Icon, { icon: "pin" }), t('Unpin for everyone')] })] }), jsxRuntime.jsx(videoReactBindings.Restricted, { requiredGrants: [videoClient.OwnCapability.BLOCK_USERS], children: jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: blockUser, children: [jsxRuntime.jsx(Icon, { icon: "not-allowed" }), t('Block')] }) }), jsxRuntime.jsxs(videoReactBindings.Restricted, { requiredGrants: [videoClient.OwnCapability.MUTE_USERS], children: [hasVideoTrack && (jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: muteVideo, children: [jsxRuntime.jsx(Icon, { icon: "camera-off-outline" }), t('Turn off video')] })), hasScreenShareTrack && (jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: muteScreenShare, children: [jsxRuntime.jsx(Icon, { icon: "screen-share-off" }), t('Turn off screen share')] })), hasAudioTrack && (jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: muteAudio, children: [jsxRuntime.jsx(Icon, { icon: "no-audio" }), t('Mute audio')] })), hasScreenShareAudioTrack && (jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: muteScreenShareAudio, children: [jsxRuntime.jsx(Icon, { icon: "no-audio" }), t('Mute screen share audio')] }))] }), participantViewElement &&
|
|
648
|
+
return (jsxRuntime.jsxs(GenericMenu, { onItemClick: close, children: [jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: toggleParticipantPin, disabled: pin && !pin.isLocalPin, children: [jsxRuntime.jsx(Icon, { icon: "pin" }), pin ? t('Unpin') : t('Pin')] }), jsxRuntime.jsxs(videoReactBindings.Restricted, { requiredGrants: [videoClient.OwnCapability.PIN_FOR_EVERYONE], children: [jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: pinForEveryone, disabled: pin && !pin.isLocalPin, children: [jsxRuntime.jsx(Icon, { icon: "pin" }), t('Pin for everyone')] }), jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: unpinForEveryone, disabled: !pin || pin.isLocalPin, children: [jsxRuntime.jsx(Icon, { icon: "pin" }), t('Unpin for everyone')] })] }), jsxRuntime.jsx(videoReactBindings.Restricted, { requiredGrants: [videoClient.OwnCapability.BLOCK_USERS], children: jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: blockUser, children: [jsxRuntime.jsx(Icon, { icon: "not-allowed" }), t('Block')] }) }), jsxRuntime.jsx(videoReactBindings.Restricted, { requiredGrants: [videoClient.OwnCapability.KICK_USER], children: jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: kickUser, children: [jsxRuntime.jsx(Icon, { icon: "kick-user" }), t('Kick')] }) }), jsxRuntime.jsxs(videoReactBindings.Restricted, { requiredGrants: [videoClient.OwnCapability.MUTE_USERS], children: [hasVideoTrack && (jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: muteVideo, children: [jsxRuntime.jsx(Icon, { icon: "camera-off-outline" }), t('Turn off video')] })), hasScreenShareTrack && (jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: muteScreenShare, children: [jsxRuntime.jsx(Icon, { icon: "screen-share-off" }), t('Turn off screen share')] })), hasAudioTrack && (jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: muteAudio, children: [jsxRuntime.jsx(Icon, { icon: "no-audio" }), t('Mute audio')] })), hasScreenShareAudioTrack && (jsxRuntime.jsxs(GenericMenuButtonItem, { onClick: muteScreenShareAudio, children: [jsxRuntime.jsx(Icon, { icon: "no-audio" }), t('Mute screen share audio')] }))] }), participantViewElement &&
|
|
654
649
|
typeof participantViewElement.requestFullscreen !== 'undefined' && (jsxRuntime.jsx(GenericMenuButtonItem, { onClick: toggleFullscreenMode, children: t('{{ direction }} fullscreen', {
|
|
655
650
|
direction: fullscreenModeOn ? t('Leave') : t('Enter'),
|
|
656
651
|
}) })), videoElement && document.pictureInPictureEnabled && (jsxRuntime.jsx(GenericMenuButtonItem, { onClick: togglePictureInPicture, children: t('{{ direction }} picture-in-picture', {
|
|
@@ -1848,9 +1843,11 @@ function SearchResults({ EmptySearchResultComponent, LoadingIndicator: LoadingIn
|
|
|
1848
1843
|
return jsxRuntime.jsx(SearchResultList, { data: searchResults });
|
|
1849
1844
|
}
|
|
1850
1845
|
|
|
1851
|
-
const useSearch = ({ debounceInterval, searchFn, searchQuery = '', }) => {
|
|
1846
|
+
const useSearch = ({ debounceInterval = 200, searchFn, searchQuery = '', }) => {
|
|
1852
1847
|
const [searchResults, setSearchResults] = react.useState([]);
|
|
1853
1848
|
const [searchQueryInProgress, setSearchQueryInProgress] = react.useState(false);
|
|
1849
|
+
const searchFnRef = react.useRef(searchFn);
|
|
1850
|
+
searchFnRef.current = searchFn;
|
|
1854
1851
|
react.useEffect(() => {
|
|
1855
1852
|
if (!searchQuery.length) {
|
|
1856
1853
|
setSearchQueryInProgress(false);
|
|
@@ -1860,7 +1857,7 @@ const useSearch = ({ debounceInterval, searchFn, searchQuery = '', }) => {
|
|
|
1860
1857
|
setSearchQueryInProgress(true);
|
|
1861
1858
|
const timeout = setTimeout(async () => {
|
|
1862
1859
|
try {
|
|
1863
|
-
const results = await
|
|
1860
|
+
const results = await searchFnRef.current(searchQuery);
|
|
1864
1861
|
setSearchResults(results);
|
|
1865
1862
|
}
|
|
1866
1863
|
catch (error) {
|
|
@@ -1873,7 +1870,7 @@ const useSearch = ({ debounceInterval, searchFn, searchQuery = '', }) => {
|
|
|
1873
1870
|
return () => {
|
|
1874
1871
|
clearTimeout(timeout);
|
|
1875
1872
|
};
|
|
1876
|
-
}, [debounceInterval,
|
|
1873
|
+
}, [debounceInterval, searchQuery]);
|
|
1877
1874
|
return {
|
|
1878
1875
|
searchQueryInProgress,
|
|
1879
1876
|
searchResults,
|
|
@@ -1884,7 +1881,6 @@ const UserListTypes = {
|
|
|
1884
1881
|
active: 'Active users',
|
|
1885
1882
|
blocked: 'Blocked users',
|
|
1886
1883
|
};
|
|
1887
|
-
const DEFAULT_DEBOUNCE_SEARCH_INTERVAL = 200;
|
|
1888
1884
|
const CallParticipantsList = ({ onClose, activeUsersSearchFn, blockedUsersSearchFn, debounceSearchInterval, }) => {
|
|
1889
1885
|
const [searchQuery, setSearchQuery] = react.useState('');
|
|
1890
1886
|
const [userListType, setUserListType] = react.useState('active');
|
|
@@ -1893,19 +1889,17 @@ const CallParticipantsList = ({ onClose, activeUsersSearchFn, blockedUsersSearch
|
|
|
1893
1889
|
};
|
|
1894
1890
|
const CallParticipantListContentHeader = ({ userListType, setUserListType, }) => {
|
|
1895
1891
|
const call = videoReactBindings.useCall();
|
|
1896
|
-
const muteAll = () => {
|
|
1892
|
+
const muteAll = react.useCallback(() => {
|
|
1897
1893
|
call?.muteAllUsers('audio');
|
|
1898
|
-
};
|
|
1894
|
+
}, [call]);
|
|
1899
1895
|
return (jsxRuntime.jsxs("div", { className: "str-video__participant-list__content-header", children: [jsxRuntime.jsx("div", { className: "str-video__participant-list__content-header-title", children: userListType === 'active' && (jsxRuntime.jsx(videoReactBindings.Restricted, { requiredGrants: [videoClient.OwnCapability.MUTE_USERS], hasPermissionsOnly: true, children: jsxRuntime.jsx(TextButton, { onClick: muteAll, children: "Mute all" }) })) }), jsxRuntime.jsx(MenuToggle, { placement: "bottom-end", ToggleButton: ToggleButton$1, children: jsxRuntime.jsx(GenericMenu, { children: Object.keys(UserListTypes).map((lt) => (jsxRuntime.jsx(GenericMenuButtonItem, { "aria-selected": lt === userListType, onClick: () => setUserListType(lt), children: UserListTypes[lt] }, lt))) }) })] }));
|
|
1900
1896
|
};
|
|
1901
|
-
const ActiveUsersSearchResults = ({ searchQuery, activeUsersSearchFn: activeUsersSearchFnFromProps, debounceSearchInterval
|
|
1897
|
+
const ActiveUsersSearchResults = ({ searchQuery, activeUsersSearchFn: activeUsersSearchFnFromProps, debounceSearchInterval, }) => {
|
|
1902
1898
|
const { useParticipants } = videoReactBindings.useCallStateHooks();
|
|
1903
1899
|
const participants = useParticipants({ sortBy: videoClient.name });
|
|
1904
|
-
const activeUsersSearchFn = react.useCallback((queryString) => {
|
|
1900
|
+
const activeUsersSearchFn = react.useCallback(async (queryString) => {
|
|
1905
1901
|
const queryRegExp = new RegExp(queryString, 'i');
|
|
1906
|
-
return
|
|
1907
|
-
return participant.name.match(queryRegExp);
|
|
1908
|
-
}));
|
|
1902
|
+
return participants.filter((p) => p.name.match(queryRegExp));
|
|
1909
1903
|
}, [participants]);
|
|
1910
1904
|
const { searchQueryInProgress, searchResults } = useSearch({
|
|
1911
1905
|
searchFn: activeUsersSearchFnFromProps ?? activeUsersSearchFn,
|
|
@@ -1914,14 +1908,12 @@ const ActiveUsersSearchResults = ({ searchQuery, activeUsersSearchFn: activeUser
|
|
|
1914
1908
|
});
|
|
1915
1909
|
return (jsxRuntime.jsx(SearchResults, { EmptySearchResultComponent: EmptyParticipantSearchList, LoadingIndicator: LoadingIndicator, searchQueryInProgress: searchQueryInProgress, searchResults: searchQuery ? searchResults : participants, SearchResultList: CallParticipantListing }));
|
|
1916
1910
|
};
|
|
1917
|
-
const BlockedUsersSearchResults = ({ blockedUsersSearchFn: blockedUsersSearchFnFromProps, debounceSearchInterval
|
|
1911
|
+
const BlockedUsersSearchResults = ({ blockedUsersSearchFn: blockedUsersSearchFnFromProps, debounceSearchInterval, searchQuery, }) => {
|
|
1918
1912
|
const { useCallBlockedUserIds } = videoReactBindings.useCallStateHooks();
|
|
1919
1913
|
const blockedUsers = useCallBlockedUserIds();
|
|
1920
|
-
const blockedUsersSearchFn = react.useCallback((queryString) => {
|
|
1914
|
+
const blockedUsersSearchFn = react.useCallback(async (queryString) => {
|
|
1921
1915
|
const queryRegExp = new RegExp(queryString, 'i');
|
|
1922
|
-
return
|
|
1923
|
-
return blockedUser.match(queryRegExp);
|
|
1924
|
-
}));
|
|
1916
|
+
return blockedUsers.filter((userId) => userId.match(queryRegExp));
|
|
1925
1917
|
}, [blockedUsers]);
|
|
1926
1918
|
const { searchQueryInProgress, searchResults } = useSearch({
|
|
1927
1919
|
searchFn: blockedUsersSearchFnFromProps ?? blockedUsersSearchFn,
|
|
@@ -2348,6 +2340,7 @@ var Pinned = "Pinned";
|
|
|
2348
2340
|
var Unpin = "Unpin";
|
|
2349
2341
|
var Pin = "Pin";
|
|
2350
2342
|
var Block = "Block";
|
|
2343
|
+
var Kick = "Kick";
|
|
2351
2344
|
var Enter = "Enter";
|
|
2352
2345
|
var Leave = "Leave";
|
|
2353
2346
|
var Participants = "Participants";
|
|
@@ -2418,6 +2411,7 @@ var en = {
|
|
|
2418
2411
|
"Pin for everyone": "Pin for everyone",
|
|
2419
2412
|
"Unpin for everyone": "Unpin for everyone",
|
|
2420
2413
|
Block: Block,
|
|
2414
|
+
Kick: Kick,
|
|
2421
2415
|
"Turn off video": "Turn off video",
|
|
2422
2416
|
"Turn off screen share": "Turn off screen share",
|
|
2423
2417
|
"Mute audio": "Mute audio",
|
|
@@ -2960,7 +2954,7 @@ const checkCanJoinEarly = (startsAt, joinAheadTimeSeconds) => {
|
|
|
2960
2954
|
return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;
|
|
2961
2955
|
};
|
|
2962
2956
|
|
|
2963
|
-
const [major, minor, patch] = ("1.
|
|
2957
|
+
const [major, minor, patch] = ("1.20.0").split('.');
|
|
2964
2958
|
videoClient.setSdkInfo({
|
|
2965
2959
|
type: videoClient.SfuModels.SdkType.REACT,
|
|
2966
2960
|
major,
|