zcw-shared 2.17.0 → 2.18.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.
Files changed (2) hide show
  1. package/package.json +2 -1
  2. package/types/im-call.d.ts +44 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcw-shared",
3
- "version": "2.17.0",
3
+ "version": "2.18.0",
4
4
  "files": [
5
5
  "references",
6
6
  "dist",
@@ -435,6 +435,7 @@
435
435
  "./types/geometry": "./types/geometry.d.ts",
436
436
  "./types/hybrid": "./types/hybrid.d.ts",
437
437
  "./types/im-api": "./types/im-api.d.ts",
438
+ "./types/im-call": "./types/im-call.d.ts",
438
439
  "./types/im-chat": "./types/im-chat.d.ts",
439
440
  "./types/im-forward": "./types/im-forward.d.ts",
440
441
  "./types/im-message-display": "./types/im-message-display.d.ts",
@@ -0,0 +1,44 @@
1
+ /** IM 实时通话媒体类型(WebRTC,非文件消息) */
2
+ export type ImCallMedia = 'audio' | 'video'
3
+
4
+ /** WebRTC 信令类型 */
5
+ export type ImCallSignalType = 'offer' | 'answer' | 'ice-candidate'
6
+
7
+ export interface ImCallSignalPayload {
8
+ callId: string
9
+ type: ImCallSignalType
10
+ sdp?: RTCSessionDescriptionInit
11
+ candidate?: RTCIceCandidateInit
12
+ }
13
+
14
+ export interface ImCallInviteSentPayload {
15
+ callId: string
16
+ conversationId: string
17
+ media: ImCallMedia
18
+ }
19
+
20
+ export interface ImCallIncomingPayload {
21
+ callId: string
22
+ conversationId: string
23
+ media: ImCallMedia
24
+ callerId: string
25
+ }
26
+
27
+ export interface ImCallAcceptedPayload {
28
+ callId: string
29
+ conversationId: string
30
+ }
31
+
32
+ export interface ImCallEndedPayload {
33
+ callId: string
34
+ conversationId?: string
35
+ reason?: 'rejected' | 'cancelled' | 'ended' | 'busy' | 'timeout'
36
+ }
37
+
38
+ export interface ImCallSignalEventPayload extends ImCallSignalPayload {
39
+ fromUserId: string
40
+ }
41
+
42
+ export interface ImCallIceServersResponse {
43
+ iceServers: RTCIceServer[]
44
+ }