@stream-io/video-react-bindings 0.0.28 → 0.0.30
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,16 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.0.30](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.29...@stream-io/video-react-bindings-0.0.30) (2023-06-30)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `@stream-io/i18n` updated to version `0.0.7`
|
|
10
|
+
### [0.0.29](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.28...@stream-io/video-react-bindings-0.0.29) (2023-06-29)
|
|
11
|
+
|
|
12
|
+
### Dependency Updates
|
|
13
|
+
|
|
14
|
+
* `@stream-io/video-client` updated to version `0.0.1`
|
|
5
15
|
### [0.0.28](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.27...@stream-io/video-react-bindings-0.0.28) (2023-06-27)
|
|
6
16
|
|
|
7
17
|
### Dependency Updates
|
|
@@ -5,10 +5,6 @@ type RestrictedProps = PropsWithChildren<{
|
|
|
5
5
|
* Required grants for the component to be able to render supplied children elements
|
|
6
6
|
*/
|
|
7
7
|
requiredGrants: OwnCapability[];
|
|
8
|
-
/**
|
|
9
|
-
* OwnCapabilities of the participant - grants they have available
|
|
10
|
-
*/
|
|
11
|
-
availableGrants?: OwnCapability[];
|
|
12
8
|
/**
|
|
13
9
|
* Render children only if user can request capability, but does not have it
|
|
14
10
|
*/
|
|
@@ -23,5 +19,5 @@ type RestrictedProps = PropsWithChildren<{
|
|
|
23
19
|
*/
|
|
24
20
|
requireAll?: boolean;
|
|
25
21
|
}>;
|
|
26
|
-
export declare const Restricted: ({
|
|
22
|
+
export declare const Restricted: ({ canRequestOnly, hasPermissionsOnly, requiredGrants, requireAll, children, }: RestrictedProps) => JSX.Element | null;
|
|
27
23
|
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useCall } from '../contexts';
|
|
3
3
|
import { useOwnCapabilities } from '../hooks';
|
|
4
|
-
export const Restricted = ({
|
|
4
|
+
export const Restricted = ({ canRequestOnly, hasPermissionsOnly, requiredGrants, requireAll = true, children, }) => {
|
|
5
5
|
const call = useCall();
|
|
6
6
|
const ownCapabilities = useOwnCapabilities();
|
|
7
|
-
const
|
|
8
|
-
const hasPermissions = requiredGrants[requireAll ? 'every' : 'some']((capability) => availableGrants.includes(capability));
|
|
7
|
+
const hasPermissions = requiredGrants[requireAll ? 'every' : 'some']((capability) => ownCapabilities.includes(capability));
|
|
9
8
|
if (hasPermissionsOnly)
|
|
10
9
|
return hasPermissions ? _jsx(_Fragment, { children: children }) : null;
|
|
11
10
|
const canRequest = requiredGrants.some((capability) => !!call && call.permissionsContext.canRequest(capability));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Restricted.js","sourceRoot":"","sources":["../../../src/wrappers/Restricted.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Restricted.js","sourceRoot":"","sources":["../../../src/wrappers/Restricted.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAsB9C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,UAAU,GAAG,IAAI,EACjB,QAAQ,GACQ,EAAE,EAAE;IACpB,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;IAC7C,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAClE,CAAC,UAAU,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,CACrD,CAAC;IAEF,IAAI,kBAAkB;QAAE,OAAO,cAAc,CAAC,CAAC,CAAC,4BAAG,QAAQ,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAEvE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CACpC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CACzE,CAAC;IAEF,IAAI,cAAc;QAAE,OAAO,UAAU,CAAC,CAAC,CAAC,4BAAG,QAAQ,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAE/D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAO,4BAAG,QAAQ,GAAI,CAAC;IAEzD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"rxjs": "~7.8.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@stream-io/i18n": "^0.0.
|
|
26
|
-
"@stream-io/video-client": "^0.0.
|
|
25
|
+
"@stream-io/i18n": "^0.0.7",
|
|
26
|
+
"@stream-io/video-client": "^0.0.28",
|
|
27
27
|
"react": ">=17.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@stream-io/i18n": "^0.0.
|
|
31
|
-
"@stream-io/video-client": "^0.0.
|
|
30
|
+
"@stream-io/i18n": "^0.0.7",
|
|
31
|
+
"@stream-io/video-client": "^0.0.28",
|
|
32
32
|
"@types/react": "^18.0.26",
|
|
33
33
|
"@types/rimraf": "^3.0.2",
|
|
34
34
|
"react": "^18.2.0",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"rimraf": "^3.0.2",
|
|
37
37
|
"typescript": "^4.9.5"
|
|
38
38
|
},
|
|
39
|
-
"version": "0.0.
|
|
39
|
+
"version": "0.0.30"
|
|
40
40
|
}
|
|
@@ -9,10 +9,6 @@ type RestrictedProps = PropsWithChildren<{
|
|
|
9
9
|
* Required grants for the component to be able to render supplied children elements
|
|
10
10
|
*/
|
|
11
11
|
requiredGrants: OwnCapability[];
|
|
12
|
-
/**
|
|
13
|
-
* OwnCapabilities of the participant - grants they have available
|
|
14
|
-
*/
|
|
15
|
-
availableGrants?: OwnCapability[];
|
|
16
12
|
/**
|
|
17
13
|
* Render children only if user can request capability, but does not have it
|
|
18
14
|
*/
|
|
@@ -29,7 +25,6 @@ type RestrictedProps = PropsWithChildren<{
|
|
|
29
25
|
}>;
|
|
30
26
|
|
|
31
27
|
export const Restricted = ({
|
|
32
|
-
availableGrants: availableGrantsFromProps,
|
|
33
28
|
canRequestOnly,
|
|
34
29
|
hasPermissionsOnly,
|
|
35
30
|
requiredGrants,
|
|
@@ -38,9 +33,8 @@ export const Restricted = ({
|
|
|
38
33
|
}: RestrictedProps) => {
|
|
39
34
|
const call = useCall();
|
|
40
35
|
const ownCapabilities = useOwnCapabilities();
|
|
41
|
-
const availableGrants = availableGrantsFromProps ?? ownCapabilities;
|
|
42
36
|
const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](
|
|
43
|
-
(capability) =>
|
|
37
|
+
(capability) => ownCapabilities.includes(capability),
|
|
44
38
|
);
|
|
45
39
|
|
|
46
40
|
if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;
|