@stream-io/video-client 0.0.1-alpha.176 → 0.0.1-alpha.178

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,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.1-alpha.178](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.177...client0.0.1-alpha.178) (2023-05-23)
6
+
7
+
8
+
9
+ ## [0.0.1-alpha.177](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.176...client0.0.1-alpha.177) (2023-05-23)
10
+
11
+
12
+
5
13
  ## [0.0.1-alpha.176](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.175...client0.0.1-alpha.176) (2023-05-23)
6
14
 
7
15
 
@@ -7585,6 +7585,8 @@ const registerEventHandlers = (call, state, dispatcher) => {
7585
7585
  'call.session_started': (event) => console.log(`Received ${event.type} event`, event),
7586
7586
  'call.unblocked_user': watchUnblockedUser(state),
7587
7587
  'call.updated': watchCallUpdated(state),
7588
+ 'call.notification': (event) => console.log(`Received ${event.type} event`, event),
7589
+ 'call.ring': (event) => console.log(`Received ${event.type} event`, event),
7588
7590
  };
7589
7591
  const eventHandlers = [
7590
7592
  watchChangePublishQuality(dispatcher, call),
@@ -8254,8 +8256,8 @@ class Call {
8254
8256
  /**
8255
8257
  * Loads the information about the call.
8256
8258
  */
8257
- this.get = () => __awaiter(this, void 0, void 0, function* () {
8258
- const response = yield this.streamClient.get(this.streamClientBasePath);
8259
+ this.get = (params) => __awaiter(this, void 0, void 0, function* () {
8260
+ const response = yield this.streamClient.get(this.streamClientBasePath, params);
8259
8261
  this.state.setMetadata(response.call);
8260
8262
  this.state.setMembers(response.members);
8261
8263
  if (this.streamClient._hasConnectionID()) {
@@ -8271,9 +8273,6 @@ class Call {
8271
8273
  */
8272
8274
  this.getOrCreate = (data) => __awaiter(this, void 0, void 0, function* () {
8273
8275
  const response = yield this.streamClient.post(this.streamClientBasePath, data);
8274
- if ((data === null || data === void 0 ? void 0 : data.ring) && !this.ringing) {
8275
- this.ringingSubject.next(true);
8276
- }
8277
8276
  this.state.setMetadata(response.call);
8278
8277
  this.state.setMembers(response.members);
8279
8278
  if (this.streamClient._hasConnectionID()) {
@@ -8282,6 +8281,12 @@ class Call {
8282
8281
  }
8283
8282
  return response;
8284
8283
  });
8284
+ this.ring = () => __awaiter(this, void 0, void 0, function* () {
8285
+ return yield this.get({ ring: true });
8286
+ });
8287
+ this.notify = () => __awaiter(this, void 0, void 0, function* () {
8288
+ return yield this.get({ notify: true });
8289
+ });
8285
8290
  /**
8286
8291
  * Will start to watch for call related WebSocket events and initiate a call session with the server.
8287
8292
  *
@@ -8294,14 +8299,6 @@ class Call {
8294
8299
  }
8295
8300
  const previousCallingState = this.state.callingState;
8296
8301
  this.state.setCallingState(CallingState.JOINING);
8297
- if ((data === null || data === void 0 ? void 0 : data.ring) && !this.ringing) {
8298
- this.ringingSubject.next(true);
8299
- }
8300
- if (this.ringing && !this.isCreatedByMe) {
8301
- // Signals other users that I have accepted the incoming call.
8302
- // Causes the `call.accepted` event to be emitted to all the call members.
8303
- yield this.sendEvent({ type: 'call.accepted' });
8304
- }
8305
8302
  let sfuServer;
8306
8303
  let sfuToken;
8307
8304
  let connectionConfig;
@@ -9050,6 +9047,12 @@ class Call {
9050
9047
  this.sendEvent = (event) => __awaiter(this, void 0, void 0, function* () {
9051
9048
  return this.streamClient.post(`${this.streamClientBasePath}/event`, event);
9052
9049
  });
9050
+ this.accept = () => __awaiter(this, void 0, void 0, function* () {
9051
+ return this.streamClient.post(`${this.streamClientBasePath}/accept`);
9052
+ });
9053
+ this.reject = () => __awaiter(this, void 0, void 0, function* () {
9054
+ return this.streamClient.post(`${this.streamClientBasePath}/reject`);
9055
+ });
9053
9056
  this.type = type;
9054
9057
  this.id = id;
9055
9058
  this.cid = `${type}:${id}`;
@@ -10796,7 +10799,7 @@ class StreamClient {
10796
10799
  }
10797
10800
  getUserAgent() {
10798
10801
  return (this.userAgent ||
10799
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.175"}`);
10802
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.177"}`);
10800
10803
  }
10801
10804
  setUserAgent(userAgent) {
10802
10805
  this.userAgent = userAgent;
@@ -10878,7 +10881,7 @@ class StreamVideoClient {
10878
10881
  this.on('call.created', (event) => {
10879
10882
  if (event.type !== 'call.created')
10880
10883
  return;
10881
- const { call, members, ringing } = event;
10884
+ const { call, members } = event;
10882
10885
  if (user.id === call.created_by.id) {
10883
10886
  console.warn('Received `call.created` sent by the current user');
10884
10887
  return;
@@ -10889,7 +10892,7 @@ class StreamVideoClient {
10889
10892
  id: call.id,
10890
10893
  metadata: call,
10891
10894
  members,
10892
- ringing,
10895
+ ringing: false,
10893
10896
  clientStore: this.writeableStateStore,
10894
10897
  }));
10895
10898
  });
@@ -10943,13 +10946,13 @@ class StreamVideoClient {
10943
10946
  * Creates a new call.
10944
10947
  *
10945
10948
  * @param type the type of the call.
10946
- * @param id the id of the call.
10949
+ * @param id the id of the call, if not provided a unique random value is used
10947
10950
  */
10948
10951
  this.call = (type, id) => {
10949
10952
  return new Call({
10950
10953
  streamClient: this.streamClient,
10951
- id,
10952
- type,
10954
+ id: id,
10955
+ type: type,
10953
10956
  clientStore: this.writeableStateStore,
10954
10957
  });
10955
10958
  };