@stream-io/video-react-bindings 0.0.6 → 0.0.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.
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.7](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.6...@stream-io/video-react-bindings-0.0.7) (2023-06-08)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@stream-io/video-client` updated to version `0.0.1`
10
+
11
+ ### Features
12
+
13
+ * StreamCall signature, video client creation ([#596](https://github.com/GetStream/stream-video-js/issues/596)) ([5c3000c](https://github.com/GetStream/stream-video-js/commit/5c3000cc6fc3f8b7904609d7b11fa025b7458cad))
14
+
5
15
  ### [0.0.6](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.0.5...@stream-io/video-react-bindings-0.0.6) (2023-06-07)
6
16
 
7
17
  ### Dependency Updates
@@ -1,5 +1,4 @@
1
1
  export * from './call';
2
- export * from './client';
3
2
  export * from './participants';
4
3
  export * from './permissions';
5
4
  export * from './store';
@@ -1,5 +1,4 @@
1
1
  export * from './call';
2
- export * from './client';
3
2
  export * from './participants';
4
3
  export * from './permissions';
5
4
  export * from './store';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
package/package.json CHANGED
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@stream-io/i18n": "^0.0.2",
27
- "@stream-io/video-client": "^0.0.6",
27
+ "@stream-io/video-client": "^0.0.7",
28
28
  "react": ">=17.0.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@stream-io/i18n": "^0.0.2",
32
- "@stream-io/video-client": "^0.0.6",
32
+ "@stream-io/video-client": "^0.0.7",
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.6"
42
+ "version": "0.0.7"
43
43
  }
@@ -1,5 +1,4 @@
1
1
  export * from './call';
2
- export * from './client';
3
2
  export * from './participants';
4
3
  export * from './permissions';
5
4
  export * from './store';
@@ -1,33 +0,0 @@
1
- import { StreamClientOptions, StreamVideoClient, TokenOrProvider, User } from '@stream-io/video-client';
2
- /**
3
- * Exclude types from documentation site, but we should still add doc comments
4
- * @internal
5
- */
6
- export type StreamVideoClientInit = {
7
- /**
8
- * The Stream API key.
9
- */
10
- apiKey: string;
11
- /**
12
- * The token or token provider.
13
- */
14
- tokenOrProvider: TokenOrProvider;
15
- /**
16
- * The client options.
17
- */
18
- options?: StreamClientOptions;
19
- /**
20
- * The user to connect.
21
- */
22
- user: User;
23
- /**
24
- * Whether the user is anonymous. Defaults to `false`.
25
- */
26
- isAnonymous?: boolean;
27
- };
28
- /**
29
- * Creates a new `StreamVideoClient` instance and connects the given user.
30
- *
31
- * @category Client State
32
- */
33
- export declare const useCreateStreamVideoClient: ({ apiKey, tokenOrProvider, user, options, isAnonymous, }: StreamVideoClientInit) => StreamVideoClient;
@@ -1,36 +0,0 @@
1
- import { StreamVideoClient, } from '@stream-io/video-client';
2
- import { useEffect, useRef, useState } from 'react';
3
- /**
4
- * Creates a new `StreamVideoClient` instance and connects the given user.
5
- *
6
- * @category Client State
7
- */
8
- export const useCreateStreamVideoClient = ({ apiKey, tokenOrProvider, user, options, isAnonymous = false, }) => {
9
- const [client] = useState(() => new StreamVideoClient(apiKey, options));
10
- const disconnectRef = useRef(Promise.resolve());
11
- useEffect(() => {
12
- const connectionPromise = disconnectRef.current.then(() => {
13
- if (isAnonymous) {
14
- return client
15
- .connectAnonymousUser(user, tokenOrProvider)
16
- .catch((err) => {
17
- console.error(`Failed to establish connection`, err);
18
- });
19
- }
20
- return client.connectUser(user, tokenOrProvider).catch((err) => {
21
- console.error(`Failed to establish connection`, err);
22
- });
23
- });
24
- return () => {
25
- disconnectRef.current = connectionPromise
26
- .then(() => client.disconnectUser())
27
- .catch((err) => {
28
- console.error(`Failed to disconnect`, err);
29
- });
30
- };
31
- // we want to re-run this effect only in some special cases
32
- // eslint-disable-next-line react-hooks/exhaustive-deps
33
- }, [apiKey, tokenOrProvider, client, isAnonymous, user === null || user === void 0 ? void 0 : user.id]);
34
- return client;
35
- };
36
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/hooks/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,GAGlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA6BpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACzC,MAAM,EACN,eAAe,EACf,IAAI,EACJ,OAAO,EACP,WAAW,GAAG,KAAK,GACG,EAAE,EAAE;IAC1B,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAExE,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAChD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,iBAAiB,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YACxD,IAAI,WAAW,EAAE;gBACf,OAAO,MAAM;qBACV,oBAAoB,CAAC,IAAI,EAAE,eAAe,CAAC;qBAC3C,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACb,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;gBACvD,CAAC,CAAC,CAAC;aACN;YACD,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC7D,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,OAAO,GAAG,iBAAiB;iBACtC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;iBACnC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QACF,2DAA2D;QAC3D,uDAAuD;IACzD,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAC,CAAC,CAAC;IAE7D,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -1,77 +0,0 @@
1
- import {
2
- StreamClientOptions,
3
- StreamVideoClient,
4
- TokenOrProvider,
5
- User,
6
- } from '@stream-io/video-client';
7
- import { useEffect, useRef, useState } from 'react';
8
-
9
- /**
10
- * Exclude types from documentation site, but we should still add doc comments
11
- * @internal
12
- */
13
- export type StreamVideoClientInit = {
14
- /**
15
- * The Stream API key.
16
- */
17
- apiKey: string;
18
- /**
19
- * The token or token provider.
20
- */
21
- tokenOrProvider: TokenOrProvider;
22
- /**
23
- * The client options.
24
- */
25
- options?: StreamClientOptions;
26
- /**
27
- * The user to connect.
28
- */
29
- user: User;
30
- /**
31
- * Whether the user is anonymous. Defaults to `false`.
32
- */
33
- isAnonymous?: boolean;
34
- };
35
-
36
- /**
37
- * Creates a new `StreamVideoClient` instance and connects the given user.
38
- *
39
- * @category Client State
40
- */
41
- export const useCreateStreamVideoClient = ({
42
- apiKey,
43
- tokenOrProvider,
44
- user,
45
- options,
46
- isAnonymous = false,
47
- }: StreamVideoClientInit) => {
48
- const [client] = useState(() => new StreamVideoClient(apiKey, options));
49
-
50
- const disconnectRef = useRef(Promise.resolve());
51
- useEffect(() => {
52
- const connectionPromise = disconnectRef.current.then(() => {
53
- if (isAnonymous) {
54
- return client
55
- .connectAnonymousUser(user, tokenOrProvider)
56
- .catch((err) => {
57
- console.error(`Failed to establish connection`, err);
58
- });
59
- }
60
- return client.connectUser(user, tokenOrProvider).catch((err) => {
61
- console.error(`Failed to establish connection`, err);
62
- });
63
- });
64
-
65
- return () => {
66
- disconnectRef.current = connectionPromise
67
- .then(() => client.disconnectUser())
68
- .catch((err) => {
69
- console.error(`Failed to disconnect`, err);
70
- });
71
- };
72
- // we want to re-run this effect only in some special cases
73
- // eslint-disable-next-line react-hooks/exhaustive-deps
74
- }, [apiKey, tokenOrProvider, client, isAnonymous, user?.id]);
75
-
76
- return client;
77
- };