@stream-io/video-client 0.0.36 → 0.0.38

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,25 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [0.0.38](https://github.com/GetStream/stream-video-js/compare/client0.0.37...client0.0.38) (2023-07-07)
6
+
7
+
8
+ ### Features
9
+
10
+ * respect user_session_id in call.session events ([#766](https://github.com/GetStream/stream-video-js/issues/766)) ([18c6ae0](https://github.com/GetStream/stream-video-js/commit/18c6ae0ea47060e18b3462c7a6a04cad59f5f94b))
11
+
12
+ ### [0.0.37](https://github.com/GetStream/stream-video-js/compare/client0.0.36...client0.0.37) (2023-07-06)
13
+
14
+
15
+ ### Features
16
+
17
+ * Remove ringing flag from call client ([#755](https://github.com/GetStream/stream-video-js/issues/755)) ([b78c605](https://github.com/GetStream/stream-video-js/commit/b78c60500e06b39fb4dce623bde6f7b10acdd8c1)), closes [/github.com/GetStream/stream-video-android/blob/develop/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/VideoPushDelegate.kt#L82](https://github.com/GetStream//github.com/GetStream/stream-video-android/blob/develop/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/VideoPushDelegate.kt/issues/L82)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * restore CallUserMuted event ([#759](https://github.com/GetStream/stream-video-js/issues/759)) ([caf43bb](https://github.com/GetStream/stream-video-js/commit/caf43bb0a8246aeb9c94ea2e0cc3d32e9a43fef1))
23
+
5
24
  ### [0.0.36](https://github.com/GetStream/stream-video-js/compare/client0.0.35...client0.0.36) (2023-07-05)
6
25
 
7
26
 
@@ -14,39 +14,16 @@ import { fromByteArray } from 'base64-js';
14
14
  /**
15
15
  * @export
16
16
  */
17
- const APIErrorCodeEnum = {
18
- INTERNAL_ERROR: 'internal-error',
19
- ACCESS_KEY_ERROR: 'access-key-error',
20
- INPUT_ERROR: 'input-error',
21
- AUTH_FAILED: 'auth-failed',
22
- DUPLICATE_USERNAME: 'duplicate-username',
23
- RATE_LIMITED: 'rate-limited',
24
- NOT_FOUND: 'not-found',
25
- NOT_ALLOWED: 'not-allowed',
26
- EVENT_NOT_SUPPORTED: 'event-not-supported',
27
- CHANNEL_FEATURE_NOT_SUPPORTED: 'channel-feature-not-supported',
28
- MESSAGE_TOO_LONG: 'message-too-long',
29
- MULTIPLE_NESTING_LEVEL: 'multiple-nesting-level',
30
- PAYLOAD_TOO_BIG: 'payload-too-big',
31
- EXPIRED_TOKEN: 'expired-token',
32
- TOKEN_NOT_VALID_YET: 'token-not-valid-yet',
33
- TOKEN_USED_BEFORE_IAT: 'token-used-before-iat',
34
- INVALID_TOKEN_SIGNATURE: 'invalid-token-signature',
35
- CUSTOM_COMMAND_ENDPOINT_MISSING: 'custom-command-endpoint-missing',
36
- CUSTOM_COMMAND_ENDPOINTCALL_ERROR: 'custom-command-endpoint=call-error',
37
- CONNECTION_ID_NOT_FOUND: 'connection-id-not-found',
38
- COOL_DOWN: 'cool-down',
39
- QUERY_CHANNEL_PERMISSIONS_MISMATCH: 'query-channel-permissions-mismatch',
40
- TOO_MANY_CONNECTIONS: 'too-many-connections',
41
- NOT_SUPPORTED_IN_PUSH_V1: 'not-supported-in-push-v1',
42
- MODERATION_FAILED: 'moderation-failed',
43
- VIDEO_PROVIDER_NOT_CONFIGURED: 'video-provider-not-configured',
44
- VIDEO_INVALID_CALL_ID: 'video-invalid-call-id',
45
- VIDEO_CREATE_CALL_FAILED: 'video-create-call-failed',
46
- APP_SUSPENDED: 'app-suspended',
47
- VIDEO_NO_DATACENTERS_AVAILABLE: 'video-no-datacenters-available',
48
- VIDEO_JOIN_CALL_FAILURE: 'video-join-call-failure',
49
- QUERY_CALLS_PERMISSIONS_MISMATCH: 'query-calls-permissions-mismatch',
17
+ const AudioSettingsDefaultDeviceEnum = {
18
+ SPEAKER: 'speaker',
19
+ EARPIECE: 'earpiece',
20
+ };
21
+ /**
22
+ * @export
23
+ */
24
+ const AudioSettingsRequestDefaultDeviceEnum = {
25
+ SPEAKER: 'speaker',
26
+ EARPIECE: 'earpiece',
50
27
  };
51
28
  /**
52
29
  * @export
@@ -8339,7 +8316,7 @@ const watchCallSessionParticipantJoined = (state) => {
8339
8316
  return function onCallParticipantJoined(event) {
8340
8317
  if (event.type !== 'call.session_participant_joined')
8341
8318
  return;
8342
- const { user } = event;
8319
+ const { user, user_session_id } = event;
8343
8320
  state.setMetadata((metadata) => {
8344
8321
  if (!metadata || !metadata.session) {
8345
8322
  state.logger('warn', `Received call.session_participant_joined event but the metadata structure is invalid.`, event);
@@ -8353,6 +8330,8 @@ const watchCallSessionParticipantJoined = (state) => {
8353
8330
  // FIXME OL: ideally, this comes from the backend
8354
8331
  joined_at: new Date().toISOString(),
8355
8332
  user,
8333
+ role: user.role,
8334
+ user_session_id,
8356
8335
  },
8357
8336
  ], participants_count_by_role: Object.assign(Object.assign({}, participants_count_by_role), { [user.role]: (participants_count_by_role[user.role] || 0) + 1 }) }) });
8358
8337
  });
@@ -8367,7 +8346,7 @@ const watchCallSessionParticipantLeft = (state) => {
8367
8346
  return function onCallParticipantLeft(event) {
8368
8347
  if (event.type !== 'call.session_participant_left')
8369
8348
  return;
8370
- const { user } = event;
8349
+ const { user, user_session_id } = event;
8371
8350
  state.setMetadata((metadata) => {
8372
8351
  if (!metadata || !metadata.session) {
8373
8352
  state.logger('warn', `Received call.session_participant_left event but the metadata structure is invalid.`, event);
@@ -8375,7 +8354,7 @@ const watchCallSessionParticipantLeft = (state) => {
8375
8354
  }
8376
8355
  const { session } = metadata;
8377
8356
  const { participants, participants_count_by_role } = session;
8378
- return Object.assign(Object.assign({}, metadata), { session: Object.assign(Object.assign({}, session), { participants: participants.filter((p) => p.user.id !== user.id), participants_count_by_role: Object.assign(Object.assign({}, participants_count_by_role), { [user.role]: Math.max(0, (participants_count_by_role[user.role] || 0) - 1) }) }) });
8357
+ return Object.assign(Object.assign({}, metadata), { session: Object.assign(Object.assign({}, session), { participants: participants.filter((p) => p.user_session_id !== user_session_id), participants_count_by_role: Object.assign(Object.assign({}, participants_count_by_role), { [user.role]: Math.max(0, (participants_count_by_role[user.role] || 0) - 1) }) }) });
8379
8358
  });
8380
8359
  };
8381
8360
  };
@@ -11835,7 +11814,7 @@ class StreamClient {
11835
11814
  }
11836
11815
  getUserAgent() {
11837
11816
  return (this.userAgent ||
11838
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.35"}`);
11817
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.37"}`);
11839
11818
  }
11840
11819
  setUserAgent(userAgent) {
11841
11820
  this.userAgent = userAgent;
@@ -11954,15 +11933,13 @@ class StreamVideoClient {
11954
11933
  *
11955
11934
  * @param type the type of the call.
11956
11935
  * @param id the id of the call, if not provided a unique random value is used
11957
- * @param {boolean} [ringing] whether the call should be created in the ringing state.
11958
11936
  */
11959
- this.call = (type, id, ringing) => {
11937
+ this.call = (type, id) => {
11960
11938
  return new Call({
11961
11939
  streamClient: this.streamClient,
11962
11940
  id: id,
11963
11941
  type: type,
11964
11942
  clientStore: this.writeableStateStore,
11965
- ringing,
11966
11943
  });
11967
11944
  };
11968
11945
  /**
@@ -12051,6 +12028,29 @@ class StreamVideoClient {
12051
12028
  this.removeDevice = (id, userID) => __awaiter(this, void 0, void 0, function* () {
12052
12029
  return yield this.streamClient.delete('/devices', Object.assign({ id }, (userID ? { user_id: userID } : {})));
12053
12030
  });
12031
+ /**
12032
+ * A callback that can be used to create ringing calls from push notifications. If the call already exists, it will do nothing.
12033
+ * @param call_cid
12034
+ * @returns
12035
+ */
12036
+ this.onRingingCall = (call_cid) => __awaiter(this, void 0, void 0, function* () {
12037
+ // if we find the call and is already ringing, we don't need to create a new call
12038
+ // as client would have received the call.ring state because the app had WS alive when receiving push notifications
12039
+ let call = this.readOnlyStateStore.calls.find((c) => c.cid === call_cid && c.ringing);
12040
+ if (!call) {
12041
+ // if not it means that WS is not alive when receiving the push notifications and we need to fetch the call
12042
+ const [callType, callId] = call_cid.split(':');
12043
+ call = new Call({
12044
+ streamClient: this.streamClient,
12045
+ type: callType,
12046
+ id: callId,
12047
+ clientStore: this.writeableStateStore,
12048
+ ringing: true,
12049
+ });
12050
+ yield call.get();
12051
+ }
12052
+ return call;
12053
+ });
12054
12054
  /**
12055
12055
  * Connects the given anonymous user to the client.
12056
12056
  *
@@ -12560,5 +12560,5 @@ var browsers = /*#__PURE__*/Object.freeze({
12560
12560
  isSafari: isSafari
12561
12561
  });
12562
12562
 
12563
- export { APIErrorCodeEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CreateDeviceRequestPushProviderEnum, DebounceType, ErrorFromResponse, OwnCapability, RecordSettingsModeEnum, RecordSettingsQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, events as SfuEvents, models as SfuModels, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
12563
+ export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CreateDeviceRequestPushProviderEnum, DebounceType, ErrorFromResponse, OwnCapability, RecordSettingsModeEnum, RecordSettingsQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, events as SfuEvents, models as SfuModels, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
12564
12564
  //# sourceMappingURL=index.browser.es.js.map