@stream-io/video-react-sdk 1.7.5 → 1.7.7

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.
@@ -1,5 +1,4 @@
1
1
  export * from './useFloatingUIPreset';
2
2
  export * from './usePersistedDevicePreferences';
3
3
  export * from './useScrollPosition';
4
- export * from './useToggleCallRecording';
5
4
  export * from './useRequestPermission';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-sdk",
3
- "version": "1.7.5",
3
+ "version": "1.7.7",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -32,9 +32,9 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@floating-ui/react": "^0.26.24",
35
- "@stream-io/video-client": "1.10.1",
35
+ "@stream-io/video-client": "1.10.2",
36
36
  "@stream-io/video-filters-web": "0.1.4",
37
- "@stream-io/video-react-bindings": "1.1.10",
37
+ "@stream-io/video-react-bindings": "1.1.12",
38
38
  "chart.js": "^4.4.4",
39
39
  "clsx": "^2.0.0",
40
40
  "react-chartjs-2": "^5.2.0"
@@ -1,7 +1,11 @@
1
1
  import { forwardRef } from 'react';
2
2
 
3
3
  import { OwnCapability } from '@stream-io/video-client';
4
- import { Restricted, useI18n } from '@stream-io/video-react-bindings';
4
+ import {
5
+ Restricted,
6
+ useI18n,
7
+ useToggleCallRecording,
8
+ } from '@stream-io/video-react-bindings';
5
9
  import { CompositeButton } from '../Button/';
6
10
  import { Icon } from '../Icon';
7
11
  import {
@@ -11,7 +15,6 @@ import {
11
15
  useMenuContext,
12
16
  } from '../Menu';
13
17
  import { LoadingIndicator } from '../LoadingIndicator';
14
- import { useToggleCallRecording } from '../../hooks';
15
18
  import { WithTooltip } from '../Tooltip';
16
19
 
17
20
  export type RecordCallButtonProps = {
@@ -1,6 +1,8 @@
1
1
  import { PropsWithChildren, useEffect, useState } from 'react';
2
- import { useI18n } from '@stream-io/video-react-bindings';
3
- import { useToggleCallRecording } from '../../hooks';
2
+ import {
3
+ useI18n,
4
+ useToggleCallRecording,
5
+ } from '@stream-io/video-react-bindings';
4
6
  import { Notification } from './Notification';
5
7
 
6
8
  export type RecordingInProgressNotificationProps = {
@@ -1,5 +1,4 @@
1
1
  export * from './useFloatingUIPreset';
2
2
  export * from './usePersistedDevicePreferences';
3
3
  export * from './useScrollPosition';
4
- export * from './useToggleCallRecording';
5
4
  export * from './useRequestPermission';
@@ -1,5 +0,0 @@
1
- export declare const useToggleCallRecording: () => {
2
- toggleCallRecording: () => Promise<void>;
3
- isAwaitingResponse: boolean;
4
- isCallRecordingInProgress: boolean;
5
- };
@@ -1,36 +0,0 @@
1
- import { useCallback, useEffect, useState } from 'react';
2
- import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
3
-
4
- export const useToggleCallRecording = () => {
5
- const call = useCall();
6
- const { useIsCallRecordingInProgress } = useCallStateHooks();
7
- const isCallRecordingInProgress = useIsCallRecordingInProgress();
8
- const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);
9
-
10
- // TODO: add permissions
11
-
12
- useEffect(() => {
13
- // we wait until call.recording_started/stopped event to flips the
14
- // `isCallRecordingInProgress` state variable.
15
- // Once the flip happens, we remove the loading indicator
16
- setIsAwaitingResponse((isAwaiting) => {
17
- if (isAwaiting) return false;
18
- return isAwaiting;
19
- });
20
- }, [isCallRecordingInProgress]);
21
-
22
- const toggleCallRecording = useCallback(async () => {
23
- try {
24
- setIsAwaitingResponse(true);
25
- if (isCallRecordingInProgress) {
26
- await call?.stopRecording();
27
- } else {
28
- await call?.startRecording();
29
- }
30
- } catch (e) {
31
- console.error(`Failed start recording`, e);
32
- }
33
- }, [call, isCallRecordingInProgress]);
34
-
35
- return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };
36
- };