@stream-io/video-react-bindings 0.0.11 → 0.0.13
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/src/contexts/StreamVideoContext.js +14 -1
- package/dist/src/contexts/StreamVideoContext.js.map +1 -1
- package/dist/src/hooks/call.d.ts +0 -16
- package/dist/src/hooks/call.js +0 -22
- package/dist/src/hooks/call.js.map +1 -1
- package/package.json +3 -3
- package/src/contexts/StreamVideoContext.tsx +27 -1
- package/src/hooks/call.ts +0 -24
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
|
+
### [0.0.13](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.12...@stream-io/video-react-bindings-0.0.13) (2023-06-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Update React sample apps for new connect flow ([#637](https://github.com/GetStream/stream-video-js/issues/637)) ([4f71f01](https://github.com/GetStream/stream-video-js/commit/4f71f01c882f350f67df03a4b06f214b06746460))
|
|
11
|
+
|
|
12
|
+
### [0.0.12](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.11...@stream-io/video-react-bindings-0.0.12) (2023-06-13)
|
|
13
|
+
|
|
14
|
+
### Dependency Updates
|
|
15
|
+
|
|
16
|
+
* `@stream-io/video-client` updated to version `0.0.1`
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* Make it possible to provide user and token in StreamVideoClient… ([#631](https://github.com/GetStream/stream-video-js/issues/631)) ([93f9b03](https://github.com/GetStream/stream-video-js/commit/93f9b03313ac74179f1d93b513ea4de306312291))
|
|
21
|
+
|
|
5
22
|
### [0.0.11](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.10...@stream-io/video-react-bindings-0.0.11) (2023-06-13)
|
|
6
23
|
|
|
7
24
|
### Dependency Updates
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext } from 'react';
|
|
2
|
+
import { createContext, useContext, useEffect, useRef, } from 'react';
|
|
3
3
|
import { StreamI18nProvider, } from './StreamI18nContext';
|
|
4
4
|
const StreamVideoContext = createContext(undefined);
|
|
5
5
|
/**
|
|
@@ -9,6 +9,19 @@ const StreamVideoContext = createContext(undefined);
|
|
|
9
9
|
* @category Client State
|
|
10
10
|
*/
|
|
11
11
|
export const StreamVideo = ({ children, client, i18nInstance, language, translationsOverrides, }) => {
|
|
12
|
+
const prevClient = useRef(undefined);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (client.user) {
|
|
15
|
+
client
|
|
16
|
+
.connectUser()
|
|
17
|
+
.catch((error) => console.error('Failed to establish connection', error));
|
|
18
|
+
}
|
|
19
|
+
prevClient.current = client;
|
|
20
|
+
return () => {
|
|
21
|
+
var _a;
|
|
22
|
+
(_a = prevClient.current) === null || _a === void 0 ? void 0 : _a.disconnectUser().catch((error) => console.error(`Failed to disconnect`, error));
|
|
23
|
+
};
|
|
24
|
+
}, [client]);
|
|
12
25
|
return (_jsx(StreamVideoContext.Provider, Object.assign({ value: client }, { children: _jsx(StreamI18nProvider, Object.assign({ i18nInstance: i18nInstance, language: language, translationsOverrides: translationsOverrides }, { children: children })) })));
|
|
13
26
|
};
|
|
14
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamVideoContext.js","sourceRoot":"","sources":["../../../src/contexts/StreamVideoContext.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"StreamVideoContext.js","sourceRoot":"","sources":["../../../src/contexts/StreamVideoContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAEb,UAAU,EACV,SAAS,EAC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50,6 @@ export declare const useDominantSpeaker: () => import("@stream-io/video-client")
|
|
|
50
50
|
* @category Client State
|
|
51
51
|
*/
|
|
52
52
|
export declare const useCalls: () => import("@stream-io/video-client").Call[];
|
|
53
|
-
/**
|
|
54
|
-
* Utility hook which provides a list of all incoming ring calls (somebody calls me).
|
|
55
|
-
*
|
|
56
|
-
* @deprecated derive from useCalls()/useCall() instead.
|
|
57
|
-
* @internal
|
|
58
|
-
* @category Client State
|
|
59
|
-
*/
|
|
60
|
-
export declare const useIncomingCalls: () => import("@stream-io/video-client").Call[];
|
|
61
|
-
/**
|
|
62
|
-
* Utility hook which provides a list of all outgoing ring calls (I call somebody).
|
|
63
|
-
*
|
|
64
|
-
* @deprecated derive from useCalls()/useCall() instead.
|
|
65
|
-
* @internal
|
|
66
|
-
* @category Client State
|
|
67
|
-
*/
|
|
68
|
-
export declare const useOutgoingCalls: () => import("@stream-io/video-client").Call[];
|
|
69
53
|
/**
|
|
70
54
|
* Utility hook which provides call metadata (such as blocked users and own capabilities).
|
|
71
55
|
*
|
package/dist/src/hooks/call.js
CHANGED
|
@@ -73,28 +73,6 @@ export const useCalls = () => {
|
|
|
73
73
|
const { calls$ } = useStore();
|
|
74
74
|
return useObservableValue(calls$);
|
|
75
75
|
};
|
|
76
|
-
/**
|
|
77
|
-
* Utility hook which provides a list of all incoming ring calls (somebody calls me).
|
|
78
|
-
*
|
|
79
|
-
* @deprecated derive from useCalls()/useCall() instead.
|
|
80
|
-
* @internal
|
|
81
|
-
* @category Client State
|
|
82
|
-
*/
|
|
83
|
-
export const useIncomingCalls = () => {
|
|
84
|
-
const { incomingCalls$ } = useStore();
|
|
85
|
-
return useObservableValue(incomingCalls$);
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Utility hook which provides a list of all outgoing ring calls (I call somebody).
|
|
89
|
-
*
|
|
90
|
-
* @deprecated derive from useCalls()/useCall() instead.
|
|
91
|
-
* @internal
|
|
92
|
-
* @category Client State
|
|
93
|
-
*/
|
|
94
|
-
export const useOutgoingCalls = () => {
|
|
95
|
-
const { outgoingCalls$ } = useStore();
|
|
96
|
-
return useObservableValue(outgoingCalls$);
|
|
97
|
-
};
|
|
98
76
|
/**
|
|
99
77
|
* Utility hook which provides call metadata (such as blocked users and own capabilities).
|
|
100
78
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call.js","sourceRoot":"","sources":["../../../src/hooks/call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,OAAO,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAA,CAAC;AAC/B,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,EAAE;IAClD,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,OAAO,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,YAAY,CAAA,CAAC;AACzC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,OAAO,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAA,CAAC;AAC9B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,MAAM,EAAE,sBAAsB,EAAE,GAAG,YAAY,EAAE,CAAC;IAClD,OAAO,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;AACpD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,EAAE,GAAG,YAAY,EAAE,CAAC;IACpC,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,EAAE,kBAAkB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC9C,OAAO,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,EAAE,aAAa,EAAE,GAAG,YAAY,EAAE,CAAC;IACzC,OAAO,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,EAAE,CAAC;IACtC,OAAO,kBAAkB,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@stream-io/i18n": "^0.0.3",
|
|
27
|
-
"@stream-io/video-client": "^0.0.
|
|
27
|
+
"@stream-io/video-client": "^0.0.12",
|
|
28
28
|
"react": ">=17.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@stream-io/i18n": "^0.0.3",
|
|
32
|
-
"@stream-io/video-client": "^0.0.
|
|
32
|
+
"@stream-io/video-client": "^0.0.12",
|
|
33
33
|
"@types/react": "^18.0.26",
|
|
34
34
|
"@types/rimraf": "^3.0.2",
|
|
35
35
|
"react": "^18.2.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"typedoc-plugin-markdown": "^3.15.3",
|
|
40
40
|
"typescript": "^4.9.5"
|
|
41
41
|
},
|
|
42
|
-
"version": "0.0.
|
|
42
|
+
"version": "0.0.13"
|
|
43
43
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
PropsWithChildren,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useRef,
|
|
7
|
+
} from 'react';
|
|
2
8
|
import { StreamVideoClient } from '@stream-io/video-client';
|
|
3
9
|
import {
|
|
4
10
|
StreamI18nProvider,
|
|
@@ -30,6 +36,26 @@ export const StreamVideo = ({
|
|
|
30
36
|
language,
|
|
31
37
|
translationsOverrides,
|
|
32
38
|
}: PropsWithChildren<StreamVideoProps>) => {
|
|
39
|
+
const prevClient = useRef<StreamVideoClient | undefined>(undefined);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (client.user) {
|
|
43
|
+
client
|
|
44
|
+
.connectUser()
|
|
45
|
+
.catch((error) =>
|
|
46
|
+
console.error('Failed to establish connection', error),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
prevClient.current = client;
|
|
51
|
+
|
|
52
|
+
return () => {
|
|
53
|
+
prevClient.current
|
|
54
|
+
?.disconnectUser()
|
|
55
|
+
.catch((error) => console.error(`Failed to disconnect`, error));
|
|
56
|
+
};
|
|
57
|
+
}, [client]);
|
|
58
|
+
|
|
33
59
|
return (
|
|
34
60
|
<StreamVideoContext.Provider value={client}>
|
|
35
61
|
<StreamI18nProvider
|
package/src/hooks/call.ts
CHANGED
|
@@ -81,30 +81,6 @@ export const useCalls = () => {
|
|
|
81
81
|
return useObservableValue(calls$);
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
/**
|
|
85
|
-
* Utility hook which provides a list of all incoming ring calls (somebody calls me).
|
|
86
|
-
*
|
|
87
|
-
* @deprecated derive from useCalls()/useCall() instead.
|
|
88
|
-
* @internal
|
|
89
|
-
* @category Client State
|
|
90
|
-
*/
|
|
91
|
-
export const useIncomingCalls = () => {
|
|
92
|
-
const { incomingCalls$ } = useStore();
|
|
93
|
-
return useObservableValue(incomingCalls$);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Utility hook which provides a list of all outgoing ring calls (I call somebody).
|
|
98
|
-
*
|
|
99
|
-
* @deprecated derive from useCalls()/useCall() instead.
|
|
100
|
-
* @internal
|
|
101
|
-
* @category Client State
|
|
102
|
-
*/
|
|
103
|
-
export const useOutgoingCalls = () => {
|
|
104
|
-
const { outgoingCalls$ } = useStore();
|
|
105
|
-
return useObservableValue(outgoingCalls$);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
84
|
/**
|
|
109
85
|
* Utility hook which provides call metadata (such as blocked users and own capabilities).
|
|
110
86
|
*
|