@stream-io/video-react-sdk 1.10.6 → 1.11.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/CHANGELOG.md +17 -0
- package/dist/index.cjs.js +65 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +65 -2
- package/dist/index.es.js.map +1 -1
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.d.ts +18 -3
- package/dist/src/core/components/CallLayout/SpeakerLayout.d.ts +19 -4
- package/dist/src/core/components/CallLayout/hooks.d.ts +8 -1
- package/dist/src/core/components/CallLayout/index.d.ts +1 -0
- package/dist/src/core/components/CallLayout/partcipantFilter.test.d.ts +1 -0
- package/dist/src/utilities/filter.d.ts +26 -0
- package/dist/src/utilities/filter.test.d.ts +1 -0
- package/package.json +3 -3
- package/src/core/components/CallLayout/PaginatedGridLayout.tsx +23 -3
- package/src/core/components/CallLayout/SpeakerLayout.tsx +24 -7
- package/src/core/components/CallLayout/hooks.ts +38 -4
- package/src/core/components/CallLayout/index.ts +5 -0
- package/src/core/components/CallLayout/partcipantFilter.test.ts +65 -0
- package/src/utilities/filter.test.ts +119 -0
- package/src/utilities/filter.ts +79 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.11.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.11.0...@stream-io/video-react-sdk-1.11.1) (2025-01-29)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `@stream-io/video-client` updated to version `1.15.7`
|
|
10
|
+
* `@stream-io/video-react-bindings` updated to version `1.4.7`
|
|
11
|
+
## [1.11.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.10.6...@stream-io/video-react-sdk-1.11.0) (2025-01-29)
|
|
12
|
+
|
|
13
|
+
### Dependency Updates
|
|
14
|
+
|
|
15
|
+
* `@stream-io/video-client` updated to version `1.15.6`
|
|
16
|
+
* `@stream-io/video-react-bindings` updated to version `1.4.6`
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* [VID-315] allow filtering participants using filter object ([#1655](https://github.com/GetStream/stream-video-js/issues/1655)) ([8674390](https://github.com/GetStream/stream-video-js/commit/86743902725a8c23165068c3f5abf2370bc42a8d))
|
|
21
|
+
|
|
5
22
|
## [1.10.6](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.10.5...@stream-io/video-react-sdk-1.10.6) (2025-01-24)
|
|
6
23
|
|
|
7
24
|
### Dependency Updates
|
package/dist/index.cjs.js
CHANGED
|
@@ -2251,6 +2251,56 @@ const StreamVideo = (props) => {
|
|
|
2251
2251
|
};
|
|
2252
2252
|
StreamVideo.displayName = 'StreamVideo';
|
|
2253
2253
|
|
|
2254
|
+
function applyFilter(obj, filter) {
|
|
2255
|
+
if ('$and' in filter) {
|
|
2256
|
+
return filter.$and.every((f) => applyFilter(obj, f));
|
|
2257
|
+
}
|
|
2258
|
+
if ('$or' in filter) {
|
|
2259
|
+
return filter.$or.some((f) => applyFilter(obj, f));
|
|
2260
|
+
}
|
|
2261
|
+
if ('$not' in filter) {
|
|
2262
|
+
return !applyFilter(obj, filter.$not);
|
|
2263
|
+
}
|
|
2264
|
+
return checkConditions(obj, filter);
|
|
2265
|
+
}
|
|
2266
|
+
function checkConditions(obj, conditions) {
|
|
2267
|
+
let match = true;
|
|
2268
|
+
for (const key of Object.keys(conditions)) {
|
|
2269
|
+
const operator = conditions[key];
|
|
2270
|
+
const maybeOperator = operator && typeof operator === 'object';
|
|
2271
|
+
let value = obj[key];
|
|
2272
|
+
if (maybeOperator && '$eq' in operator) {
|
|
2273
|
+
const eqOperator = operator;
|
|
2274
|
+
match && (match = eqOperator.$eq === value);
|
|
2275
|
+
}
|
|
2276
|
+
else if (maybeOperator && '$neq' in operator) {
|
|
2277
|
+
const neqOperator = operator;
|
|
2278
|
+
match && (match = neqOperator.$neq !== value);
|
|
2279
|
+
}
|
|
2280
|
+
else if (maybeOperator && '$in' in operator) {
|
|
2281
|
+
const inOperator = operator;
|
|
2282
|
+
match && (match = inOperator.$in.includes(value));
|
|
2283
|
+
}
|
|
2284
|
+
else if (maybeOperator && '$contains' in operator) {
|
|
2285
|
+
if (Array.isArray(value)) {
|
|
2286
|
+
const containsOperator = operator;
|
|
2287
|
+
match && (match = value.includes(containsOperator.$contains));
|
|
2288
|
+
}
|
|
2289
|
+
else {
|
|
2290
|
+
match = false;
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
else {
|
|
2294
|
+
const eqValue = operator;
|
|
2295
|
+
match && (match = eqValue === value);
|
|
2296
|
+
}
|
|
2297
|
+
if (!match) {
|
|
2298
|
+
return false;
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
return true;
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2254
2304
|
const useFilteredParticipants = ({ excludeLocalParticipant = false, filterParticipants, }) => {
|
|
2255
2305
|
const { useParticipants, useRemoteParticipants } = videoReactBindings.useCallStateHooks();
|
|
2256
2306
|
const allParticipants = useParticipants();
|
|
@@ -2260,7 +2310,7 @@ const useFilteredParticipants = ({ excludeLocalParticipant = false, filterPartic
|
|
|
2260
2310
|
? remoteParticipants
|
|
2261
2311
|
: allParticipants;
|
|
2262
2312
|
return filterParticipants
|
|
2263
|
-
? unfilteredParticipants
|
|
2313
|
+
? applyParticipantsFilter(unfilteredParticipants, filterParticipants)
|
|
2264
2314
|
: unfilteredParticipants;
|
|
2265
2315
|
}, [
|
|
2266
2316
|
allParticipants,
|
|
@@ -2269,6 +2319,19 @@ const useFilteredParticipants = ({ excludeLocalParticipant = false, filterPartic
|
|
|
2269
2319
|
filterParticipants,
|
|
2270
2320
|
]);
|
|
2271
2321
|
};
|
|
2322
|
+
const applyParticipantsFilter = (participants, filter) => {
|
|
2323
|
+
const filterCallback = typeof filter === 'function'
|
|
2324
|
+
? filter
|
|
2325
|
+
: (participant) => applyFilter({
|
|
2326
|
+
userId: participant.userId,
|
|
2327
|
+
isSpeaking: participant.isSpeaking,
|
|
2328
|
+
isDominantSpeaker: participant.isDominantSpeaker,
|
|
2329
|
+
name: participant.name,
|
|
2330
|
+
roles: participant.roles,
|
|
2331
|
+
isPinned: videoClient.isPinned(participant),
|
|
2332
|
+
}, filter);
|
|
2333
|
+
return participants.filter(filterCallback);
|
|
2334
|
+
};
|
|
2272
2335
|
const usePaginatedLayoutSortPreset = (call) => {
|
|
2273
2336
|
react.useEffect(() => {
|
|
2274
2337
|
if (!call)
|
|
@@ -2576,7 +2639,7 @@ const LivestreamPlayer = (props) => {
|
|
|
2576
2639
|
return (jsxRuntime.jsx(StreamCall, { call: call, children: jsxRuntime.jsx(LivestreamLayout, { ...layoutProps }) }));
|
|
2577
2640
|
};
|
|
2578
2641
|
|
|
2579
|
-
const [major, minor, patch] = ("1.
|
|
2642
|
+
const [major, minor, patch] = ("1.11.1").split('.');
|
|
2580
2643
|
videoClient.setSdkInfo({
|
|
2581
2644
|
type: videoClient.SfuModels.SdkType.REACT,
|
|
2582
2645
|
major,
|