@stream-io/video-client 1.1.0 → 1.2.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.
@@ -7,7 +7,7 @@ import { VideoLayerSetting } from './gen/video/sfu/event/events';
7
7
  import { DynascaleManager } from './helpers/DynascaleManager';
8
8
  import { PermissionsContext } from './permissions';
9
9
  import { StreamClient } from './coordinator/connection/client';
10
- import { CallEventListener, Logger } from './coordinator/connection/types';
10
+ import { CallEventListener, Logger, RejectReason } from './coordinator/connection/types';
11
11
  import { CameraManager, MicrophoneManager, ScreenShareManager, SpeakerManager } from './devices';
12
12
  /**
13
13
  * An object representation of a `Call`.
@@ -177,8 +177,10 @@ export declare class Call {
177
177
  * This method should be used only for "ringing" call flows.
178
178
  * {@link Call.leave} invokes this method automatically for you when you leave or reject this call.
179
179
  * Unless you are implementing a custom "ringing" flow, you should not use this method.
180
+ *
181
+ * @param reason the reason for rejecting the call.
180
182
  */
181
- reject: () => Promise<RejectCallResponse>;
183
+ reject: (reason?: RejectReason) => Promise<RejectCallResponse>;
182
184
  /**
183
185
  * Will start to watch for call related WebSocket events and initiate a call session with the server.
184
186
  *
@@ -113,3 +113,5 @@ export type StreamClientOptions = Partial<AxiosRequestConfig> & {
113
113
  };
114
114
  export type TokenProvider = () => Promise<string>;
115
115
  export type TokenOrProvider = null | string | TokenProvider | undefined;
116
+ export type BuiltInRejectReason = 'busy' | 'decline' | 'cancel';
117
+ export type RejectReason = BuiltInRejectReason | string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
package/src/Call.ts CHANGED
@@ -119,6 +119,7 @@ import {
119
119
  AllCallEvents,
120
120
  CallEventListener,
121
121
  Logger,
122
+ RejectReason,
122
123
  StreamCallEvent,
123
124
  } from './coordinator/connection/types';
124
125
  import { getClientDetails } from './client-details';
@@ -680,10 +681,13 @@ export class Call {
680
681
  * This method should be used only for "ringing" call flows.
681
682
  * {@link Call.leave} invokes this method automatically for you when you leave or reject this call.
682
683
  * Unless you are implementing a custom "ringing" flow, you should not use this method.
684
+ *
685
+ * @param reason the reason for rejecting the call.
683
686
  */
684
- reject = async () => {
687
+ reject = async (reason?: RejectReason): Promise<RejectCallResponse> => {
685
688
  return this.streamClient.post<RejectCallResponse>(
686
689
  `${this.streamClientBasePath}/reject`,
690
+ { reason: reason },
687
691
  );
688
692
  };
689
693
 
@@ -142,3 +142,6 @@ export type StreamClientOptions = Partial<AxiosRequestConfig> & {
142
142
 
143
143
  export type TokenProvider = () => Promise<string>;
144
144
  export type TokenOrProvider = null | string | TokenProvider | undefined;
145
+
146
+ export type BuiltInRejectReason = 'busy' | 'decline' | 'cancel';
147
+ export type RejectReason = BuiltInRejectReason | string;
@@ -29,7 +29,7 @@ import {
29
29
 
30
30
  type RingCallEvents = Extract<
31
31
  AllClientCallEvents,
32
- 'call.accepted' | 'call.rejected'
32
+ 'call.accepted' | 'call.rejected' | 'call.missed'
33
33
  >;
34
34
 
35
35
  /**