@stream-io/video-react-sdk 1.21.2 → 1.22.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 +27 -0
- package/dist/index.cjs.js +54 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +54 -8
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/BackgroundFilters/BackgroundFilters.d.ts +2 -2
- package/dist/src/utilities/filter.d.ts +16 -1
- package/index.ts +1 -0
- package/package.json +4 -4
- package/src/components/BackgroundFilters/BackgroundFilters.tsx +9 -3
- package/src/components/CallParticipantsList/CallParticipantsList.tsx +3 -1
- package/src/utilities/filter.test.ts +20 -0
- package/src/utilities/filter.ts +54 -2
package/dist/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export * from './src/components';
|
|
|
5
5
|
export * from './src/wrappers';
|
|
6
6
|
export * from './src/translations';
|
|
7
7
|
export { useHorizontalScrollPosition, useVerticalScrollPosition, useRequestPermission, usePersistedDevicePreferences, useDeviceList, } from './src/hooks';
|
|
8
|
+
export { applyFilter, type Filter } from './src/utilities/filter';
|
package/dist/index.es.js
CHANGED
|
@@ -848,7 +848,7 @@ const useBackgroundFilters = () => {
|
|
|
848
848
|
* in your project before using this component.
|
|
849
849
|
*/
|
|
850
850
|
const BackgroundFiltersProvider = (props) => {
|
|
851
|
-
const { children, backgroundImages = [], backgroundFilter: bgFilterFromProps = undefined, backgroundImage: bgImageFromProps = undefined, backgroundBlurLevel: bgBlurLevelFromProps = undefined, tfFilePath, modelFilePath, basePath, onError, } = props;
|
|
851
|
+
const { children, backgroundImages = [], backgroundFilter: bgFilterFromProps = undefined, backgroundImage: bgImageFromProps = undefined, backgroundBlurLevel: bgBlurLevelFromProps = undefined, tfFilePath, modelFilePath, basePath, onError, forceSafariSupport, forceMobileSupport, } = props;
|
|
852
852
|
const [backgroundFilter, setBackgroundFilter] = useState(bgFilterFromProps);
|
|
853
853
|
const [backgroundImage, setBackgroundImage] = useState(bgImageFromProps);
|
|
854
854
|
const [backgroundBlurLevel, setBackgroundBlurLevel] = useState(bgBlurLevelFromProps);
|
|
@@ -867,8 +867,11 @@ const BackgroundFiltersProvider = (props) => {
|
|
|
867
867
|
}, []);
|
|
868
868
|
const [isSupported, setIsSupported] = useState(false);
|
|
869
869
|
useEffect(() => {
|
|
870
|
-
isPlatformSupported(
|
|
871
|
-
|
|
870
|
+
isPlatformSupported({
|
|
871
|
+
forceSafariSupport,
|
|
872
|
+
forceMobileSupport,
|
|
873
|
+
}).then(setIsSupported);
|
|
874
|
+
}, [forceMobileSupport, forceSafariSupport]);
|
|
872
875
|
const [tfLite, setTfLite] = useState();
|
|
873
876
|
useEffect(() => {
|
|
874
877
|
// don't try to load TFLite if the platform is not supported
|
|
@@ -1898,10 +1901,11 @@ const CallParticipantsList = ({ onClose, activeUsersSearchFn, blockedUsersSearch
|
|
|
1898
1901
|
};
|
|
1899
1902
|
const CallParticipantListContentHeader = ({ userListType, setUserListType, }) => {
|
|
1900
1903
|
const call = useCall();
|
|
1904
|
+
const { t } = useI18n();
|
|
1901
1905
|
const muteAll = useCallback(() => {
|
|
1902
1906
|
call?.muteAllUsers('audio');
|
|
1903
1907
|
}, [call]);
|
|
1904
|
-
return (jsxs("div", { className: "str-video__participant-list__content-header", children: [jsx("div", { className: "str-video__participant-list__content-header-title", children: userListType === 'active' && (jsx(Restricted, { requiredGrants: [OwnCapability.MUTE_USERS], hasPermissionsOnly: true, children: jsx(TextButton, { onClick: muteAll, children:
|
|
1908
|
+
return (jsxs("div", { className: "str-video__participant-list__content-header", children: [jsx("div", { className: "str-video__participant-list__content-header-title", children: userListType === 'active' && (jsx(Restricted, { requiredGrants: [OwnCapability.MUTE_USERS], hasPermissionsOnly: true, children: jsx(TextButton, { onClick: muteAll, children: t('Mute all') }) })) }), jsx(MenuToggle, { placement: "bottom-end", ToggleButton: ToggleButton$1, children: jsx(GenericMenu, { children: Object.keys(UserListTypes).map((lt) => (jsx(GenericMenuButtonItem, { "aria-selected": lt === userListType, onClick: () => setUserListType(lt), children: UserListTypes[lt] }, lt))) }) })] }));
|
|
1905
1909
|
};
|
|
1906
1910
|
const ActiveUsersSearchResults = ({ searchQuery, activeUsersSearchFn: activeUsersSearchFnFromProps, debounceSearchInterval, }) => {
|
|
1907
1911
|
const { useParticipants } = useCallStateHooks();
|
|
@@ -2470,15 +2474,26 @@ function applyFilter(obj, filter) {
|
|
|
2470
2474
|
}
|
|
2471
2475
|
return checkConditions(obj, filter);
|
|
2472
2476
|
}
|
|
2477
|
+
const isDateString = (value) => typeof value === 'string' &&
|
|
2478
|
+
/^((?:(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}(?:\.\d+)?))(Z|[+-]\d{2}:\d{2})?)$/.test(value);
|
|
2473
2479
|
function checkConditions(obj, conditions) {
|
|
2474
2480
|
let match = true;
|
|
2475
2481
|
for (const key of Object.keys(conditions)) {
|
|
2476
2482
|
const operator = conditions[key];
|
|
2477
2483
|
const maybeOperator = operator && typeof operator === 'object';
|
|
2478
|
-
|
|
2484
|
+
let value = obj[key];
|
|
2485
|
+
if (value instanceof Date) {
|
|
2486
|
+
value = value.getTime();
|
|
2487
|
+
}
|
|
2488
|
+
else if (isDateString(value)) {
|
|
2489
|
+
value = new Date(value).getTime();
|
|
2490
|
+
}
|
|
2479
2491
|
if (maybeOperator && '$eq' in operator) {
|
|
2480
2492
|
const eqOperator = operator;
|
|
2481
|
-
|
|
2493
|
+
const eqOperatorValue = isDateString(eqOperator.$eq)
|
|
2494
|
+
? new Date(eqOperator.$eq).getTime()
|
|
2495
|
+
: eqOperator.$eq;
|
|
2496
|
+
match && (match = eqOperatorValue === value);
|
|
2482
2497
|
}
|
|
2483
2498
|
else if (maybeOperator && '$neq' in operator) {
|
|
2484
2499
|
const neqOperator = operator;
|
|
@@ -2497,6 +2512,37 @@ function checkConditions(obj, conditions) {
|
|
|
2497
2512
|
match = false;
|
|
2498
2513
|
}
|
|
2499
2514
|
}
|
|
2515
|
+
else if (maybeOperator && '$gt' in operator) {
|
|
2516
|
+
const gtOperator = operator;
|
|
2517
|
+
const gtOperatorValue = isDateString(gtOperator.$gt)
|
|
2518
|
+
? new Date(gtOperator.$gt).getTime()
|
|
2519
|
+
: gtOperator.$gt;
|
|
2520
|
+
match && (match = value > gtOperatorValue);
|
|
2521
|
+
}
|
|
2522
|
+
else if (maybeOperator && '$gte' in operator) {
|
|
2523
|
+
const gteOperator = operator;
|
|
2524
|
+
const gteOperatorValue = isDateString(gteOperator.$gte)
|
|
2525
|
+
? new Date(gteOperator.$gte).getTime()
|
|
2526
|
+
: gteOperator.$gte;
|
|
2527
|
+
match && (match = value >= gteOperatorValue);
|
|
2528
|
+
}
|
|
2529
|
+
else if (maybeOperator && '$lt' in operator) {
|
|
2530
|
+
const ltOperator = operator;
|
|
2531
|
+
const ltOperatorValue = isDateString(ltOperator.$lt)
|
|
2532
|
+
? new Date(ltOperator.$lt).getTime()
|
|
2533
|
+
: ltOperator.$lt;
|
|
2534
|
+
match && (match = value < ltOperatorValue);
|
|
2535
|
+
}
|
|
2536
|
+
else if (maybeOperator && '$lte' in operator) {
|
|
2537
|
+
const lteOperator = operator;
|
|
2538
|
+
const lteOperatorValue = isDateString(lteOperator.$lte)
|
|
2539
|
+
? new Date(lteOperator.$lte).getTime()
|
|
2540
|
+
: lteOperator.$lte;
|
|
2541
|
+
match && (match = value <= lteOperatorValue);
|
|
2542
|
+
// } else if (maybeOperator && '$autocomplete' in operator) {
|
|
2543
|
+
// TODO: regexp solution maybe?
|
|
2544
|
+
// match &&= false;
|
|
2545
|
+
}
|
|
2500
2546
|
else {
|
|
2501
2547
|
const eqValue = operator;
|
|
2502
2548
|
match && (match = eqValue === value);
|
|
@@ -2970,7 +3016,7 @@ const checkCanJoinEarly = (startsAt, joinAheadTimeSeconds) => {
|
|
|
2970
3016
|
return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;
|
|
2971
3017
|
};
|
|
2972
3018
|
|
|
2973
|
-
const [major, minor, patch] = ("1.
|
|
3019
|
+
const [major, minor, patch] = ("1.22.0").split('.');
|
|
2974
3020
|
setSdkInfo({
|
|
2975
3021
|
type: SfuModels.SdkType.REACT,
|
|
2976
3022
|
major,
|
|
@@ -2978,5 +3024,5 @@ setSdkInfo({
|
|
|
2978
3024
|
patch,
|
|
2979
3025
|
});
|
|
2980
3026
|
|
|
2981
|
-
export { AcceptCallButton, Audio, Avatar, AvatarFallback, BackgroundFiltersProvider, BackstageLayout, BaseVideo, CallControls, CallParticipantListing, CallParticipantListingItem, CallParticipantsList, CallPreview, CallRecordingList, CallRecordingListHeader, CallRecordingListItem, CallStats, CallStatsButton, CancelCallButton, CancelCallConfirmButton, CompositeButton, DefaultParticipantViewUI, DefaultReactionsMenu, DefaultScreenShareOverlay, DefaultVideoPlaceholder, DeviceSelector, DeviceSelectorAudioInput, DeviceSelectorAudioOutput, DeviceSelectorVideo, DeviceSettings, DropDownSelect, DropDownSelectOption, EmptyCallRecordingListing, GenericMenu, GenericMenuButtonItem, Icon, IconButton, LivestreamLayout, LivestreamPlayer, LoadingCallRecordingListing, LoadingIndicator, MenuToggle, MenuVisualType, NoiseCancellationProvider, Notification, PaginatedGridLayout, ParticipantActionsContextMenu, ParticipantDetails, ParticipantView, ParticipantViewContext, ParticipantsAudio, PermissionNotification, PermissionRequestList, PermissionRequests, PipLayout, Reaction, ReactionsButton, RecordCallButton, RecordCallConfirmationButton, RecordingInProgressNotification, RingingCall, RingingCallControls, ScreenShareButton, SearchInput, SearchResults, SpeakerLayout, SpeakingWhileMutedNotification, SpeechIndicator, StatCard, StreamCall, StreamTheme, StreamVideo, TextButton, ToggleAudioOutputButton, ToggleAudioPreviewButton, ToggleAudioPublishingButton, ToggleVideoPreviewButton, ToggleVideoPublishingButton, Tooltip, Video$1 as Video, VideoPreview, WithTooltip, defaultEmojiReactionMap, defaultReactions, translations, useBackgroundFilters, useDeviceList, useFilteredParticipants, useHorizontalScrollPosition, useMenuContext, useNoiseCancellation, useParticipantViewContext, usePersistedDevicePreferences, useRequestPermission, useTrackElementVisibility, useVerticalScrollPosition };
|
|
3027
|
+
export { AcceptCallButton, Audio, Avatar, AvatarFallback, BackgroundFiltersProvider, BackstageLayout, BaseVideo, CallControls, CallParticipantListing, CallParticipantListingItem, CallParticipantsList, CallPreview, CallRecordingList, CallRecordingListHeader, CallRecordingListItem, CallStats, CallStatsButton, CancelCallButton, CancelCallConfirmButton, CompositeButton, DefaultParticipantViewUI, DefaultReactionsMenu, DefaultScreenShareOverlay, DefaultVideoPlaceholder, DeviceSelector, DeviceSelectorAudioInput, DeviceSelectorAudioOutput, DeviceSelectorVideo, DeviceSettings, DropDownSelect, DropDownSelectOption, EmptyCallRecordingListing, GenericMenu, GenericMenuButtonItem, Icon, IconButton, LivestreamLayout, LivestreamPlayer, LoadingCallRecordingListing, LoadingIndicator, MenuToggle, MenuVisualType, NoiseCancellationProvider, Notification, PaginatedGridLayout, ParticipantActionsContextMenu, ParticipantDetails, ParticipantView, ParticipantViewContext, ParticipantsAudio, PermissionNotification, PermissionRequestList, PermissionRequests, PipLayout, Reaction, ReactionsButton, RecordCallButton, RecordCallConfirmationButton, RecordingInProgressNotification, RingingCall, RingingCallControls, ScreenShareButton, SearchInput, SearchResults, SpeakerLayout, SpeakingWhileMutedNotification, SpeechIndicator, StatCard, StreamCall, StreamTheme, StreamVideo, TextButton, ToggleAudioOutputButton, ToggleAudioPreviewButton, ToggleAudioPublishingButton, ToggleVideoPreviewButton, ToggleVideoPublishingButton, Tooltip, Video$1 as Video, VideoPreview, WithTooltip, applyFilter, defaultEmojiReactionMap, defaultReactions, translations, useBackgroundFilters, useDeviceList, useFilteredParticipants, useHorizontalScrollPosition, useMenuContext, useNoiseCancellation, useParticipantViewContext, usePersistedDevicePreferences, useRequestPermission, useTrackElementVisibility, useVerticalScrollPosition };
|
|
2982
3028
|
//# sourceMappingURL=index.es.js.map
|