@stream-io/video-react-bindings 0.0.1-alpha.93 → 0.0.1-alpha.95
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
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.1-alpha.95](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.1-alpha.94...@stream-io/video-react-bindings-0.0.1-alpha.95) (2023-05-31)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [0.0.1-alpha.94](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.1-alpha.93...@stream-io/video-react-bindings-0.0.1-alpha.94) (2023-05-31)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* Adjust OwnCapabilities handling ([#574](https://github.com/GetStream/stream-video-js/issues/574)) ([d9e27db](https://github.com/GetStream/stream-video-js/commit/d9e27db65e641241d5ec5a9a72a94f118ece284d))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
## [0.0.1-alpha.93](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.1-alpha.92...@stream-io/video-react-bindings-0.0.1-alpha.93) (2023-05-31)
|
|
6
19
|
|
|
7
20
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useCallMetadata } from './call';
|
|
2
1
|
import { useCallState } from './store';
|
|
3
2
|
import { useObservableValue } from './helpers/useObservableValue';
|
|
4
3
|
/**
|
|
@@ -9,10 +8,8 @@ import { useObservableValue } from './helpers/useObservableValue';
|
|
|
9
8
|
* @category Call State
|
|
10
9
|
*/
|
|
11
10
|
export const useHasPermissions = (...permissions) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
return false;
|
|
15
|
-
return permissions.every((permission) => metadata.own_capabilities.includes(permission));
|
|
11
|
+
const capabilities = useOwnCapabilities();
|
|
12
|
+
return permissions.every((permission) => capabilities.includes(permission));
|
|
16
13
|
};
|
|
17
14
|
/**
|
|
18
15
|
* A hook which returns the current user's own capabilities.
|
|
@@ -20,8 +17,8 @@ export const useHasPermissions = (...permissions) => {
|
|
|
20
17
|
* @category Call State
|
|
21
18
|
*/
|
|
22
19
|
export const useOwnCapabilities = () => {
|
|
23
|
-
const
|
|
24
|
-
return (
|
|
20
|
+
const { ownCapabilities$ } = useCallState();
|
|
21
|
+
return useObservableValue(ownCapabilities$);
|
|
25
22
|
};
|
|
26
23
|
/**
|
|
27
24
|
* A hook which returns the latest call permission request.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/hooks/permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/hooks/permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,WAA4B,EAAW,EAAE;IAC5E,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAC;IAC1C,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAoB,EAAE;IACtD,MAAM,EAAE,gBAAgB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC5C,OAAO,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAE1B,EAAE;IACd,MAAM,EAAE,sBAAsB,EAAE,GAAG,YAAY,EAAE,CAAC;IAClD,OAAO,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"rxjs": "~7.8.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@stream-io/i18n": "^0.0.1-alpha.
|
|
27
|
-
"@stream-io/video-client": "^0.0.2-alpha.
|
|
26
|
+
"@stream-io/i18n": "^0.0.1-alpha.84",
|
|
27
|
+
"@stream-io/video-client": "^0.0.2-alpha.13",
|
|
28
28
|
"react": ">=17.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@stream-io/i18n": "^0.0.1-alpha.
|
|
32
|
-
"@stream-io/video-client": "^0.0.2-alpha.
|
|
31
|
+
"@stream-io/i18n": "^0.0.1-alpha.84",
|
|
32
|
+
"@stream-io/video-client": "^0.0.2-alpha.13",
|
|
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.1-alpha.
|
|
42
|
+
"version": "0.0.1-alpha.95"
|
|
43
43
|
}
|
package/src/hooks/permissions.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OwnCapability, PermissionRequestEvent } from '@stream-io/video-client';
|
|
2
|
-
import { useCallMetadata } from './call';
|
|
3
2
|
import { useCallState } from './store';
|
|
4
3
|
import { useObservableValue } from './helpers/useObservableValue';
|
|
5
4
|
|
|
@@ -10,12 +9,9 @@ import { useObservableValue } from './helpers/useObservableValue';
|
|
|
10
9
|
*
|
|
11
10
|
* @category Call State
|
|
12
11
|
*/
|
|
13
|
-
export const useHasPermissions = (...permissions: OwnCapability[]) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
return permissions.every((permission) =>
|
|
17
|
-
metadata.own_capabilities.includes(permission),
|
|
18
|
-
);
|
|
12
|
+
export const useHasPermissions = (...permissions: OwnCapability[]): boolean => {
|
|
13
|
+
const capabilities = useOwnCapabilities();
|
|
14
|
+
return permissions.every((permission) => capabilities.includes(permission));
|
|
19
15
|
};
|
|
20
16
|
|
|
21
17
|
/**
|
|
@@ -24,8 +20,8 @@ export const useHasPermissions = (...permissions: OwnCapability[]) => {
|
|
|
24
20
|
* @category Call State
|
|
25
21
|
*/
|
|
26
22
|
export const useOwnCapabilities = (): OwnCapability[] => {
|
|
27
|
-
const
|
|
28
|
-
return
|
|
23
|
+
const { ownCapabilities$ } = useCallState();
|
|
24
|
+
return useObservableValue(ownCapabilities$);
|
|
29
25
|
};
|
|
30
26
|
|
|
31
27
|
/**
|