@stream-io/video-client 0.4.9 → 0.4.10
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 +7 -0
- package/dist/index.browser.es.js +28 -4
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +28 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +28 -4
- package/dist/index.es.js.map +1 -1
- package/dist/src/StreamVideoServerClient.d.ts +5 -0
- package/package.json +1 -1
- package/src/StreamVideoServerClient.ts +5 -0
- package/src/store/CallState.ts +23 -3
- package/src/store/__tests__/CallState.test.ts +50 -0
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.4.10](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.4.9...@stream-io/video-client-0.4.10) (2023-11-27)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **session:** prevent duplication of session participants ([#1201](https://github.com/GetStream/stream-video-js/issues/1201)) ([2d0131e](https://github.com/GetStream/stream-video-js/commit/2d0131e8f97216b90d873b91282006e428e40ac0))
|
|
11
|
+
|
|
5
12
|
### [0.4.9](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.4.8...@stream-io/video-client-0.4.9) (2023-11-22)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -8394,13 +8394,32 @@ class CallState {
|
|
|
8394
8394
|
return session;
|
|
8395
8395
|
}
|
|
8396
8396
|
const { participants, participants_count_by_role } = session;
|
|
8397
|
-
const { user } = event.participant;
|
|
8397
|
+
const { user, user_session_id } = event.participant;
|
|
8398
|
+
// It could happen that the backend delivers the same participant more than once.
|
|
8399
|
+
// Once with the call.session_started event and once again with the
|
|
8400
|
+
// call.session_participant_joined event. In this case,
|
|
8401
|
+
// we should update the existing participant and prevent duplicating it.
|
|
8402
|
+
let shouldInsertParticipant = true;
|
|
8403
|
+
const updatedParticipants = participants.map((p) => {
|
|
8404
|
+
if (p.user_session_id === user_session_id) {
|
|
8405
|
+
shouldInsertParticipant = false;
|
|
8406
|
+
return event.participant;
|
|
8407
|
+
}
|
|
8408
|
+
return p;
|
|
8409
|
+
});
|
|
8410
|
+
if (shouldInsertParticipant) {
|
|
8411
|
+
// this is a new array, we can safely push the new participant
|
|
8412
|
+
updatedParticipants.push(event.participant);
|
|
8413
|
+
}
|
|
8414
|
+
// If we are updating an existing participant, we don't want to increment
|
|
8415
|
+
// the participant_by_role count.
|
|
8416
|
+
const increment = shouldInsertParticipant ? 1 : 0;
|
|
8398
8417
|
return {
|
|
8399
8418
|
...session,
|
|
8400
|
-
participants:
|
|
8419
|
+
participants: updatedParticipants,
|
|
8401
8420
|
participants_count_by_role: {
|
|
8402
8421
|
...participants_count_by_role,
|
|
8403
|
-
[user.role]: (participants_count_by_role[user.role] || 0) +
|
|
8422
|
+
[user.role]: (participants_count_by_role[user.role] || 0) + increment,
|
|
8404
8423
|
},
|
|
8405
8424
|
};
|
|
8406
8425
|
});
|
|
@@ -14013,7 +14032,7 @@ class StreamClient {
|
|
|
14013
14032
|
});
|
|
14014
14033
|
};
|
|
14015
14034
|
this.getUserAgent = () => {
|
|
14016
|
-
const version = "0.4.
|
|
14035
|
+
const version = "0.4.10" ;
|
|
14017
14036
|
return (this.userAgent ||
|
|
14018
14037
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
14019
14038
|
};
|
|
@@ -14513,6 +14532,11 @@ class StreamVideoClient {
|
|
|
14513
14532
|
}
|
|
14514
14533
|
}
|
|
14515
14534
|
|
|
14535
|
+
/**
|
|
14536
|
+
* @deprecated Please use the `@stream-io/node-sdk` package instead.
|
|
14537
|
+
*
|
|
14538
|
+
* @see https://getstream.io/video/docs/api/
|
|
14539
|
+
*/
|
|
14516
14540
|
class StreamVideoServerClient extends StreamVideoClient {
|
|
14517
14541
|
constructor(apiKey, options) {
|
|
14518
14542
|
super({ apiKey, options });
|