@stream-io/video-client 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,13 @@
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/client0.0.6...client0.0.7) (2023-06-08)
6
+
7
+
8
+ ### Features
9
+
10
+ * 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))
11
+
5
12
  ### [0.0.6](https://github.com/GetStream/stream-video-js/compare/client0.0.5...client0.0.6) (2023-06-07)
6
13
 
7
14
 
@@ -10993,7 +10993,7 @@ class StreamClient {
10993
10993
  }
10994
10994
  getUserAgent() {
10995
10995
  return (this.userAgent ||
10996
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.5"}`);
10996
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.6"}`);
10997
10997
  }
10998
10998
  setUserAgent(userAgent) {
10999
10999
  this.userAgent = userAgent;
@@ -11075,9 +11075,17 @@ class StreamVideoClient {
11075
11075
  * @param tokenOrProvider a token or a function that returns a token.
11076
11076
  */
11077
11077
  this.connectUser = (user, tokenOrProvider) => __awaiter(this, void 0, void 0, function* () {
11078
- const connectUserResponse = yield this.streamClient.connectUser(
11079
- // @ts-expect-error
11080
- user, tokenOrProvider);
11078
+ var _a;
11079
+ const connectUser = () => {
11080
+ return this.streamClient.connectUser(
11081
+ // @ts-expect-error
11082
+ user, tokenOrProvider);
11083
+ };
11084
+ this.connectionPromise = this.disconnectionPromise
11085
+ ? this.disconnectionPromise.then(() => connectUser())
11086
+ : connectUser();
11087
+ (_a = this.connectionPromise) === null || _a === void 0 ? void 0 : _a.finally(() => (this.connectionPromise = undefined));
11088
+ const connectUserResponse = yield this.connectionPromise;
11081
11089
  this.writeableStateStore.setConnectedUser(user);
11082
11090
  this.eventHandlersToUnregister.push(this.on('connection.changed', (e) => {
11083
11091
  const event = e;
@@ -11151,8 +11159,14 @@ class StreamVideoClient {
11151
11159
  * @param tokenOrProvider a token or a function that returns a token.
11152
11160
  */
11153
11161
  this.connectAnonymousUser = (user, tokenOrProvider) => __awaiter(this, void 0, void 0, function* () {
11162
+ const connectAnonymousUser = () =>
11154
11163
  // @ts-expect-error
11155
- return this.streamClient.connectAnonymousUser(user, tokenOrProvider);
11164
+ this.streamClient.connectAnonymousUser(user, tokenOrProvider);
11165
+ this.connectionPromise = this.disconnectionPromise
11166
+ ? this.disconnectionPromise.then(() => connectAnonymousUser())
11167
+ : connectAnonymousUser();
11168
+ this.connectionPromise.finally(() => (this.connectionPromise = undefined));
11169
+ return this.connectionPromise;
11156
11170
  });
11157
11171
  /**
11158
11172
  * Disconnects the currently connected user from the client.
@@ -11163,7 +11177,12 @@ class StreamVideoClient {
11163
11177
  * https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
11164
11178
  */
11165
11179
  this.disconnectUser = (timeout) => __awaiter(this, void 0, void 0, function* () {
11166
- yield this.streamClient.disconnectUser(timeout);
11180
+ const disconnectUser = () => this.streamClient.disconnectUser(timeout);
11181
+ this.disconnectionPromise = this.connectionPromise
11182
+ ? this.connectionPromise.then(() => disconnectUser())
11183
+ : disconnectUser();
11184
+ this.disconnectionPromise.finally(() => (this.disconnectionPromise = undefined));
11185
+ yield this.disconnectionPromise;
11167
11186
  this.eventHandlersToUnregister.forEach((unregister) => unregister());
11168
11187
  this.eventHandlersToUnregister = [];
11169
11188
  this.writeableStateStore.setConnectedUser(undefined);