@stream-io/video-client 1.11.14 → 1.12.0

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,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.12.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.15...@stream-io/video-client-1.12.0) (2024-12-10)
6
+
7
+
8
+ ### Features
9
+
10
+ * Aggregate stats reports - request and response objects ([#1614](https://github.com/GetStream/stream-video-js/issues/1614)) ([8a47fea](https://github.com/GetStream/stream-video-js/commit/8a47fea491232e524b1de780c12c0d00e0f02bcd))
11
+
12
+ ## [1.11.15](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.14...@stream-io/video-client-1.11.15) (2024-12-09)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * avoid call.get in all call.ring events ([#1615](https://github.com/GetStream/stream-video-js/issues/1615)) ([c757370](https://github.com/GetStream/stream-video-js/commit/c7573701a20b4a29cd2b6fd08a55d4eff503f77f))
18
+
5
19
  ## [1.11.14](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.13...@stream-io/video-client-1.11.14) (2024-12-04)
6
20
 
7
21
 
@@ -8,6 +8,8 @@ import { UAParser } from 'ua-parser-js';
8
8
  import { ReplaySubject, combineLatest, BehaviorSubject, map, shareReplay, distinctUntilChanged, takeWhile, distinctUntilKeyChanged, fromEventPattern, startWith, concatMap, from, fromEvent, debounceTime, merge, pairwise, of } from 'rxjs';
9
9
  import * as SDP from 'sdp-transform';
10
10
 
11
+ /* tslint:disable */
12
+ /* eslint-disable */
11
13
  /**
12
14
  * @export
13
15
  */
@@ -3297,7 +3299,7 @@ const retryable = async (rpc, signal) => {
3297
3299
  return result;
3298
3300
  };
3299
3301
 
3300
- const version = "1.11.14";
3302
+ const version = "1.12.0";
3301
3303
  const [major, minor, patch] = version.split('.');
3302
3304
  let sdkInfo = {
3303
3305
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -10142,6 +10144,28 @@ class Call {
10142
10144
  await Promise.all(stopOnLeavePromises);
10143
10145
  });
10144
10146
  };
10147
+ /**
10148
+ * Update from the call response from the "call.ring" event
10149
+ * @internal
10150
+ */
10151
+ this.updateFromRingingEvent = async (event) => {
10152
+ await this.setup();
10153
+ // call.ring event excludes the call creator in the members list
10154
+ // as the creator does not get the ring event
10155
+ // so update the member list accordingly
10156
+ const creator = this.state.members.find((m) => m.user.id === event.call.created_by.id);
10157
+ if (!creator) {
10158
+ this.state.setMembers(event.members);
10159
+ }
10160
+ else {
10161
+ this.state.setMembers([creator, ...event.members]);
10162
+ }
10163
+ // update the call state with the latest event data
10164
+ this.state.updateFromCallResponse(event.call);
10165
+ this.ringingSubject.next(true);
10166
+ this.watching = true;
10167
+ await this.applyDeviceConfig(false);
10168
+ };
10145
10169
  /**
10146
10170
  * Loads the information about the call.
10147
10171
  *
@@ -12774,7 +12798,7 @@ class StreamClient {
12774
12798
  return await this.wsConnection.connect(this.defaultWSTimeout);
12775
12799
  };
12776
12800
  this.getUserAgent = () => {
12777
- const version = "1.11.14";
12801
+ const version = "1.12.0";
12778
12802
  return (this.userAgent ||
12779
12803
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12780
12804
  };
@@ -12967,24 +12991,25 @@ class StreamVideoClient {
12967
12991
  this.logger('debug', 'Received `call.ring` sent by the current user so ignoring the event');
12968
12992
  return;
12969
12993
  }
12970
- // The call might already be tracked by the client,
12971
12994
  // if `call.created` was received before `call.ring`.
12972
- // In that case, we cleanup the already tracked call.
12973
- const prevCall = this.writeableStateStore.findCall(call.type, call.id);
12974
- await prevCall?.leave({ reason: 'cleaning-up in call.ring' });
12975
- // we create a new call
12976
- const theCall = new Call({
12977
- streamClient: this.streamClient,
12978
- type: call.type,
12979
- id: call.id,
12980
- members,
12981
- clientStore: this.writeableStateStore,
12982
- ringing: true,
12983
- });
12984
- theCall.state.updateFromCallResponse(call);
12985
- // we fetch the latest metadata for the call from the server
12986
- await theCall.get();
12987
- this.writeableStateStore.registerCall(theCall);
12995
+ // the client already has the call instance and we just need to update the state
12996
+ const theCall = this.writeableStateStore.findCall(call.type, call.id);
12997
+ if (theCall) {
12998
+ await theCall.updateFromRingingEvent(event);
12999
+ }
13000
+ else {
13001
+ // if client doesn't have the call instance, create the instance and fetch the latest state
13002
+ // Note: related - we also have onRingingCall method to handle this case from push notifications
13003
+ const newCallInstance = new Call({
13004
+ streamClient: this.streamClient,
13005
+ type: call.type,
13006
+ id: call.id,
13007
+ members,
13008
+ clientStore: this.writeableStateStore,
13009
+ ringing: true,
13010
+ });
13011
+ await newCallInstance.get();
13012
+ }
12988
13013
  }));
12989
13014
  return connectUserResponse;
12990
13015
  };
@@ -13093,6 +13118,15 @@ class StreamVideoClient {
13093
13118
  this.queryCallStats = async (data = {}) => {
13094
13119
  return this.streamClient.post(`/call/stats`, data);
13095
13120
  };
13121
+ /**
13122
+ * Retrieve the list of available reports aggregated from the call stats.
13123
+ *
13124
+ * @param data Specify filter conditions like from and to (within last 30 days) and the report types
13125
+ * @returns Requested reports with (mostly) raw daily data for each report type requested
13126
+ */
13127
+ this.queryAggregateCallStats = async (data = {}) => {
13128
+ return this.streamClient.post(`/stats`, data);
13129
+ };
13096
13130
  /**
13097
13131
  * Returns a list of available data centers available for hosting calls.
13098
13132
  */