@easemob-community/callkit-vue3 2.0.1

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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +208 -0
  3. package/dist/callkit-vue3.css +1 -0
  4. package/dist/components/EasemobChatCallKitProvider.vue.d.ts +18 -0
  5. package/dist/components/EasemobChatMiniWindow.vue.d.ts +11 -0
  6. package/dist/components/InvitationNotification.vue.d.ts +2 -0
  7. package/dist/components/multiCall/EasemobChatGroupMemberList.vue.d.ts +19 -0
  8. package/dist/components/multiCall/EasemobChatMultiCall.vue.d.ts +69 -0
  9. package/dist/components/singleCall/CallControls.vue.d.ts +18 -0
  10. package/dist/components/singleCall/CallInfoBar.vue.d.ts +5 -0
  11. package/dist/components/singleCall/EasemobChatCallStream.vue.d.ts +12 -0
  12. package/dist/components/singleCall/EasemobChatCallWaiting.vue.d.ts +10 -0
  13. package/dist/components/singleCall/EasemobChatSingleCall.vue.d.ts +28 -0
  14. package/dist/composables/useAnswerCall.d.ts +10 -0
  15. package/dist/composables/useCallKit.d.ts +2 -0
  16. package/dist/composables/useCallKitCore.d.ts +998 -0
  17. package/dist/composables/useCallKitEvents.d.ts +42 -0
  18. package/dist/composables/useDraggable.d.ts +90 -0
  19. package/dist/composables/useEndCall.d.ts +15 -0
  20. package/dist/composables/useParticipants.d.ts +15 -0
  21. package/dist/composables/useRtcService.d.ts +80 -0
  22. package/dist/config/assets.d.ts +43 -0
  23. package/dist/core/events/CallKitEventBus.d.ts +40 -0
  24. package/dist/core/events/helpers.d.ts +59 -0
  25. package/dist/core/events/types.d.ts +264 -0
  26. package/dist/core/sdk/imSDK/index.d.ts +4 -0
  27. package/dist/index.d.ts +33 -0
  28. package/dist/index.js +7806 -0
  29. package/dist/index.umd.js +72 -0
  30. package/dist/modules/groupCall/components/CallKitIcon.vue.d.ts +12 -0
  31. package/dist/modules/groupCall/components/GroupCallShell.vue.d.ts +34 -0
  32. package/dist/modules/groupCall/components/MainVideoLayout.vue.d.ts +32 -0
  33. package/dist/modules/groupCall/components/ParticipantTile.vue.d.ts +12 -0
  34. package/dist/modules/groupCall/components/VideoGrid.vue.d.ts +29 -0
  35. package/dist/modules/groupCall/components/iconRegistry.d.ts +2 -0
  36. package/dist/modules/groupCall/index.d.ts +7 -0
  37. package/dist/modules/groupCall/media/RtcMediaBridge.d.ts +26 -0
  38. package/dist/modules/groupCall/signaling/GroupCallSignalingAdapter.d.ts +29 -0
  39. package/dist/modules/groupCall/types.d.ts +37 -0
  40. package/dist/modules/groupCall/viewModel/GroupCallStore.d.ts +345 -0
  41. package/dist/modules/groupCall/viewModel/useGroupCallViewModel.d.ts +35 -0
  42. package/dist/services/CallService.d.ts +15 -0
  43. package/dist/services/RtcAdapter.d.ts +11 -0
  44. package/dist/services/RtcService.d.ts +187 -0
  45. package/dist/services/UserProfileService.d.ts +38 -0
  46. package/dist/store/callTimer.d.ts +33 -0
  47. package/dist/store/chatClient.d.ts +5335 -0
  48. package/dist/store/globalCall.d.ts +34 -0
  49. package/dist/store/index.d.ts +1 -0
  50. package/dist/store/rtcChannel.d.ts +42 -0
  51. package/dist/store/types.d.ts +50 -0
  52. package/dist/types/callstate.types.d.ts +61 -0
  53. package/dist/types/signal.types.d.ts +187 -0
  54. package/dist/types.d.ts +103 -0
  55. package/dist/utils/callUtils.d.ts +15 -0
  56. package/dist/utils/imSdkAdapter.d.ts +29 -0
  57. package/dist/utils/index.d.ts +2 -0
  58. package/dist/utils/logger.d.ts +122 -0
  59. package/dist/utils/loggerDb.d.ts +41 -0
  60. package/dist/utils/ringtone.d.ts +20 -0
  61. package/dist/vite-env.d.ts +12 -0
  62. package/package.json +60 -0
@@ -0,0 +1,998 @@
1
+ import { DeepReadonly } from 'vue';
2
+ import { CALL_STATUS, CALL_TYPE, CallKitEvent, InviteCallParams, AnswerCallParams, HangupParams, InviteGroupCallParams, RtcReport } from '../../../../../callkit-core/src/index.ts';
3
+ export interface ReactiveCallState {
4
+ status: CALL_STATUS;
5
+ callId: string;
6
+ channel: string;
7
+ token: string;
8
+ type: CALL_TYPE;
9
+ callerDevId: string;
10
+ calleeDevId: string;
11
+ callerUserId: string;
12
+ calleeUserId: string;
13
+ audioEnabled: boolean;
14
+ videoEnabled: boolean;
15
+ startTime: number | null;
16
+ }
17
+ export interface CallEventLog {
18
+ type: string;
19
+ payload: any;
20
+ timestamp: number;
21
+ }
22
+ export declare function useCallKitCore(): {
23
+ callState: DeepReadonly<ReactiveCallState>;
24
+ groupSession: Readonly<import('vue').Ref<{
25
+ readonly sessionId: string;
26
+ readonly groupId: string;
27
+ readonly groupName: string;
28
+ readonly callType: "audio" | "video";
29
+ readonly status: "inviting" | "inCall" | "ended";
30
+ readonly callerUserId: string;
31
+ readonly startTime: number;
32
+ }, {
33
+ readonly sessionId: string;
34
+ readonly groupId: string;
35
+ readonly groupName: string;
36
+ readonly callType: "audio" | "video";
37
+ readonly status: "inviting" | "inCall" | "ended";
38
+ readonly callerUserId: string;
39
+ readonly startTime: number;
40
+ }>>;
41
+ groupParticipants: Readonly<import('vue').Ref<readonly {
42
+ readonly userId: string;
43
+ readonly nickname: string;
44
+ readonly avatarUrl?: string;
45
+ readonly state: "invited" | "accepted" | "joinedRtc" | "left";
46
+ readonly isLocal: boolean;
47
+ readonly isMuted: boolean;
48
+ readonly isCameraOn: boolean;
49
+ readonly isSpeaking: boolean;
50
+ }[], readonly {
51
+ readonly userId: string;
52
+ readonly nickname: string;
53
+ readonly avatarUrl?: string;
54
+ readonly state: "invited" | "accepted" | "joinedRtc" | "left";
55
+ readonly isLocal: boolean;
56
+ readonly isMuted: boolean;
57
+ readonly isCameraOn: boolean;
58
+ readonly isSpeaking: boolean;
59
+ }[]>>;
60
+ lastEvent: Readonly<import('vue').Ref<{
61
+ readonly type: "incomingCall";
62
+ readonly payload: {
63
+ readonly callId: string;
64
+ readonly callType: CALL_TYPE;
65
+ readonly callerUserId: string;
66
+ readonly callerDevId: string;
67
+ readonly channel: string;
68
+ readonly calleeUserId: string;
69
+ readonly token?: string;
70
+ readonly groupId?: string;
71
+ readonly groupName?: string;
72
+ readonly invitedMembers?: readonly string[];
73
+ readonly callerInfo?: {
74
+ readonly nickname?: string;
75
+ readonly avatarURL?: string;
76
+ };
77
+ };
78
+ } | {
79
+ readonly type: "callInvited";
80
+ readonly payload: {
81
+ readonly callId: string;
82
+ readonly channel: string;
83
+ readonly callType: CALL_TYPE;
84
+ readonly callerUserId: string;
85
+ readonly calleeUserId?: string;
86
+ readonly groupId?: string;
87
+ readonly isCaller: boolean;
88
+ };
89
+ } | {
90
+ readonly type: "singleCallInvited";
91
+ readonly payload: {
92
+ readonly callId: string;
93
+ readonly channel: string;
94
+ readonly callType: CALL_TYPE;
95
+ readonly callerUserId: string;
96
+ readonly calleeUserId?: string;
97
+ readonly groupId?: string;
98
+ readonly isCaller: boolean;
99
+ };
100
+ } | {
101
+ readonly type: "groupCallInvited";
102
+ readonly payload: {
103
+ readonly callId: string;
104
+ readonly channel: string;
105
+ readonly callType: CALL_TYPE;
106
+ readonly callerUserId: string;
107
+ readonly calleeUserId?: string;
108
+ readonly groupId?: string;
109
+ readonly isCaller: boolean;
110
+ };
111
+ } | {
112
+ readonly type: "callStarted";
113
+ readonly payload: {
114
+ readonly callId: string;
115
+ readonly channel: string;
116
+ readonly callType: CALL_TYPE;
117
+ readonly callerUserId: string;
118
+ readonly calleeUserId?: string;
119
+ readonly groupId?: string;
120
+ readonly isCaller: boolean;
121
+ readonly startTime: number;
122
+ };
123
+ } | {
124
+ readonly type: "callAccepted";
125
+ readonly payload: {
126
+ readonly callId: string;
127
+ readonly channel: string;
128
+ readonly callType: CALL_TYPE;
129
+ readonly callerUserId: string;
130
+ readonly calleeUserId?: string;
131
+ readonly groupId?: string;
132
+ readonly isCaller: boolean;
133
+ };
134
+ } | {
135
+ readonly type: "callConnected";
136
+ readonly payload: {
137
+ readonly callId: string;
138
+ readonly channel: string;
139
+ readonly callType: CALL_TYPE;
140
+ readonly callerUserId: string;
141
+ readonly calleeUserId?: string;
142
+ readonly groupId?: string;
143
+ };
144
+ } | {
145
+ readonly type: "callEnded";
146
+ readonly payload: {
147
+ readonly callId: string;
148
+ readonly channel: string;
149
+ readonly callType: CALL_TYPE;
150
+ readonly callerUserId: string;
151
+ readonly calleeUserId?: string;
152
+ readonly groupId?: string;
153
+ readonly reason: "hangup" | "cancel" | "refuse" | "busy" | "timeout" | "remoteHangup" | "remoteCancel";
154
+ readonly duration?: number;
155
+ };
156
+ } | {
157
+ readonly type: "callTimeout";
158
+ readonly payload: {
159
+ readonly callId: string;
160
+ readonly channel: string;
161
+ readonly callType: CALL_TYPE;
162
+ readonly callerUserId: string;
163
+ readonly calleeUserId?: string;
164
+ readonly groupId?: string;
165
+ };
166
+ } | {
167
+ readonly type: "singleCallStarted";
168
+ readonly payload: {
169
+ readonly callId: string;
170
+ readonly channel: string;
171
+ readonly callType: CALL_TYPE;
172
+ readonly callerUserId: string;
173
+ readonly calleeUserId?: string;
174
+ readonly groupId?: string;
175
+ readonly isCaller: boolean;
176
+ readonly startTime: number;
177
+ };
178
+ } | {
179
+ readonly type: "singleCallAccepted";
180
+ readonly payload: {
181
+ readonly callId: string;
182
+ readonly channel: string;
183
+ readonly callType: CALL_TYPE;
184
+ readonly callerUserId: string;
185
+ readonly calleeUserId?: string;
186
+ readonly groupId?: string;
187
+ readonly isCaller: boolean;
188
+ };
189
+ } | {
190
+ readonly type: "singleCallConnected";
191
+ readonly payload: {
192
+ readonly callId: string;
193
+ readonly channel: string;
194
+ readonly callType: CALL_TYPE;
195
+ readonly callerUserId: string;
196
+ readonly calleeUserId?: string;
197
+ readonly groupId?: string;
198
+ };
199
+ } | {
200
+ readonly type: "singleCallEnded";
201
+ readonly payload: {
202
+ readonly callId: string;
203
+ readonly channel: string;
204
+ readonly callType: CALL_TYPE;
205
+ readonly callerUserId: string;
206
+ readonly calleeUserId?: string;
207
+ readonly groupId?: string;
208
+ readonly reason: "hangup" | "cancel" | "refuse" | "busy" | "timeout" | "remoteHangup" | "remoteCancel";
209
+ readonly duration?: number;
210
+ };
211
+ } | {
212
+ readonly type: "singleCallTimeout";
213
+ readonly payload: {
214
+ readonly callId: string;
215
+ readonly channel: string;
216
+ readonly callType: CALL_TYPE;
217
+ readonly callerUserId: string;
218
+ readonly calleeUserId?: string;
219
+ readonly groupId?: string;
220
+ };
221
+ } | {
222
+ readonly type: "singleCallRefused";
223
+ readonly payload: {
224
+ readonly callId: string;
225
+ readonly channel: string;
226
+ readonly callType: CALL_TYPE;
227
+ readonly callerUserId: string;
228
+ readonly calleeUserId?: string;
229
+ readonly groupId?: string;
230
+ readonly isRemote: boolean;
231
+ };
232
+ } | {
233
+ readonly type: "singleCallBusy";
234
+ readonly payload: {
235
+ readonly callId: string;
236
+ readonly channel: string;
237
+ readonly callType: CALL_TYPE;
238
+ readonly callerUserId: string;
239
+ readonly calleeUserId?: string;
240
+ readonly groupId?: string;
241
+ };
242
+ } | {
243
+ readonly type: "singleCallCanceled";
244
+ readonly payload: {
245
+ readonly callId: string;
246
+ readonly channel: string;
247
+ readonly callType: CALL_TYPE;
248
+ readonly callerUserId: string;
249
+ readonly calleeUserId?: string;
250
+ readonly groupId?: string;
251
+ readonly isRemote: boolean;
252
+ };
253
+ } | {
254
+ readonly type: "groupCallStarted";
255
+ readonly payload: {
256
+ readonly callId: string;
257
+ readonly channel: string;
258
+ readonly callType: CALL_TYPE;
259
+ readonly callerUserId: string;
260
+ readonly calleeUserId?: string;
261
+ readonly groupId?: string;
262
+ readonly isCaller: boolean;
263
+ readonly startTime: number;
264
+ };
265
+ } | {
266
+ readonly type: "groupCallAccepted";
267
+ readonly payload: {
268
+ readonly callId: string;
269
+ readonly channel: string;
270
+ readonly callType: CALL_TYPE;
271
+ readonly callerUserId: string;
272
+ readonly calleeUserId?: string;
273
+ readonly groupId?: string;
274
+ readonly isCaller: boolean;
275
+ };
276
+ } | {
277
+ readonly type: "groupCallConnected";
278
+ readonly payload: {
279
+ readonly callId: string;
280
+ readonly channel: string;
281
+ readonly callType: CALL_TYPE;
282
+ readonly callerUserId: string;
283
+ readonly calleeUserId?: string;
284
+ readonly groupId?: string;
285
+ };
286
+ } | {
287
+ readonly type: "groupCallEnded";
288
+ readonly payload: {
289
+ readonly callId: string;
290
+ readonly channel: string;
291
+ readonly callType: CALL_TYPE;
292
+ readonly callerUserId: string;
293
+ readonly calleeUserId?: string;
294
+ readonly groupId?: string;
295
+ readonly reason: "hangup" | "cancel" | "refuse" | "busy" | "timeout" | "remoteHangup" | "remoteCancel";
296
+ readonly duration?: number;
297
+ };
298
+ } | {
299
+ readonly type: "groupCallTimeout";
300
+ readonly payload: {
301
+ readonly callId: string;
302
+ readonly channel: string;
303
+ readonly callType: CALL_TYPE;
304
+ readonly callerUserId: string;
305
+ readonly calleeUserId?: string;
306
+ readonly groupId?: string;
307
+ };
308
+ } | {
309
+ readonly type: "groupCallRefused";
310
+ readonly payload: {
311
+ readonly callId: string;
312
+ readonly channel: string;
313
+ readonly callType: CALL_TYPE;
314
+ readonly callerUserId: string;
315
+ readonly calleeUserId?: string;
316
+ readonly groupId?: string;
317
+ readonly isRemote: boolean;
318
+ };
319
+ } | {
320
+ readonly type: "groupCallBusy";
321
+ readonly payload: {
322
+ readonly callId: string;
323
+ readonly channel: string;
324
+ readonly callType: CALL_TYPE;
325
+ readonly callerUserId: string;
326
+ readonly calleeUserId?: string;
327
+ readonly groupId?: string;
328
+ };
329
+ } | {
330
+ readonly type: "groupCallCanceled";
331
+ readonly payload: {
332
+ readonly callId: string;
333
+ readonly channel: string;
334
+ readonly callType: CALL_TYPE;
335
+ readonly callerUserId: string;
336
+ readonly calleeUserId?: string;
337
+ readonly groupId?: string;
338
+ readonly isRemote: boolean;
339
+ };
340
+ } | {
341
+ readonly type: "statusChanged";
342
+ readonly payload: {
343
+ readonly callId: string;
344
+ readonly channel: string;
345
+ readonly callType: CALL_TYPE;
346
+ readonly callerUserId: string;
347
+ readonly calleeUserId?: string;
348
+ readonly groupId?: string;
349
+ readonly from: string;
350
+ readonly to: string;
351
+ };
352
+ } | {
353
+ readonly type: "callRefused";
354
+ readonly payload: {
355
+ readonly callId: string;
356
+ readonly channel: string;
357
+ readonly callType: CALL_TYPE;
358
+ readonly callerUserId: string;
359
+ readonly calleeUserId?: string;
360
+ readonly groupId?: string;
361
+ readonly isRemote: boolean;
362
+ };
363
+ } | {
364
+ readonly type: "callBusy";
365
+ readonly payload: {
366
+ readonly callId: string;
367
+ readonly channel: string;
368
+ readonly callType: CALL_TYPE;
369
+ readonly callerUserId: string;
370
+ readonly calleeUserId?: string;
371
+ readonly groupId?: string;
372
+ };
373
+ } | {
374
+ readonly type: "callCanceled";
375
+ readonly payload: {
376
+ readonly callId: string;
377
+ readonly channel: string;
378
+ readonly callType: CALL_TYPE;
379
+ readonly callerUserId: string;
380
+ readonly calleeUserId?: string;
381
+ readonly groupId?: string;
382
+ readonly isRemote: boolean;
383
+ };
384
+ } | {
385
+ readonly type: "groupCallInit";
386
+ readonly payload: {
387
+ readonly callId: string;
388
+ readonly groupId: string;
389
+ readonly groupName: string;
390
+ readonly channel: string;
391
+ readonly callType: "audio" | "video";
392
+ readonly callerUserId: string;
393
+ readonly invitedMembers: readonly string[];
394
+ };
395
+ } | {
396
+ readonly type: "participantStateChanged";
397
+ readonly payload: {
398
+ readonly callId: string;
399
+ readonly userId: string;
400
+ readonly state: "invited" | "accepted" | "joinedRtc" | "left";
401
+ readonly groupId?: string;
402
+ };
403
+ } | {
404
+ readonly type: "participantJoined";
405
+ readonly payload: {
406
+ readonly callId: string;
407
+ readonly channel: string;
408
+ readonly callType: CALL_TYPE;
409
+ readonly callerUserId: string;
410
+ readonly calleeUserId?: string;
411
+ readonly groupId?: string;
412
+ readonly userId: string;
413
+ };
414
+ } | {
415
+ readonly type: "participantLeft";
416
+ readonly payload: {
417
+ readonly callId: string;
418
+ readonly channel: string;
419
+ readonly callType: CALL_TYPE;
420
+ readonly callerUserId: string;
421
+ readonly calleeUserId?: string;
422
+ readonly groupId?: string;
423
+ readonly userId: string;
424
+ readonly reason: string;
425
+ };
426
+ } | {
427
+ readonly type: "rtcReport";
428
+ readonly payload: {
429
+ readonly type: string;
430
+ readonly payload: {
431
+ readonly [x: string]: any;
432
+ };
433
+ };
434
+ } | {
435
+ readonly type: "callDurationUpdated";
436
+ readonly payload: {
437
+ readonly callId: string;
438
+ readonly channel: string;
439
+ readonly callType: CALL_TYPE;
440
+ readonly callerUserId: string;
441
+ readonly calleeUserId?: string;
442
+ readonly groupId?: string;
443
+ readonly duration: number;
444
+ };
445
+ } | {
446
+ readonly type: "callError";
447
+ readonly payload: {
448
+ readonly type: string;
449
+ readonly error: string;
450
+ readonly callId?: string;
451
+ readonly context?: {
452
+ readonly [x: string]: any;
453
+ };
454
+ };
455
+ } | {
456
+ readonly type: "shouldJoinRtc";
457
+ readonly payload: {
458
+ readonly callId: string;
459
+ readonly channel: string;
460
+ readonly callType: CALL_TYPE;
461
+ readonly callerUserId: string;
462
+ readonly calleeUserId?: string;
463
+ readonly groupId?: string;
464
+ readonly token: string;
465
+ readonly uid: number | string;
466
+ readonly appId?: string;
467
+ readonly role: "caller" | "callee";
468
+ };
469
+ } | {
470
+ readonly type: "shouldLeaveRtc";
471
+ readonly payload: {
472
+ readonly callId: string;
473
+ readonly channel: string;
474
+ readonly callType: CALL_TYPE;
475
+ readonly callerUserId: string;
476
+ readonly calleeUserId?: string;
477
+ readonly groupId?: string;
478
+ readonly reason: string;
479
+ };
480
+ } | {
481
+ readonly type: "shouldPublishTracks";
482
+ readonly payload: {
483
+ readonly callId: string;
484
+ readonly channel: string;
485
+ readonly callType: CALL_TYPE;
486
+ readonly callerUserId: string;
487
+ readonly calleeUserId?: string;
488
+ readonly groupId?: string;
489
+ readonly trackTypes: readonly ("audio" | "video")[];
490
+ };
491
+ } | {
492
+ readonly type: "localAudioChanged";
493
+ readonly payload: {
494
+ readonly enabled: boolean;
495
+ };
496
+ } | {
497
+ readonly type: "localVideoChanged";
498
+ readonly payload: {
499
+ readonly enabled: boolean;
500
+ };
501
+ }, {
502
+ readonly type: "incomingCall";
503
+ readonly payload: {
504
+ readonly callId: string;
505
+ readonly callType: CALL_TYPE;
506
+ readonly callerUserId: string;
507
+ readonly callerDevId: string;
508
+ readonly channel: string;
509
+ readonly calleeUserId: string;
510
+ readonly token?: string;
511
+ readonly groupId?: string;
512
+ readonly groupName?: string;
513
+ readonly invitedMembers?: readonly string[];
514
+ readonly callerInfo?: {
515
+ readonly nickname?: string;
516
+ readonly avatarURL?: string;
517
+ };
518
+ };
519
+ } | {
520
+ readonly type: "callInvited";
521
+ readonly payload: {
522
+ readonly callId: string;
523
+ readonly channel: string;
524
+ readonly callType: CALL_TYPE;
525
+ readonly callerUserId: string;
526
+ readonly calleeUserId?: string;
527
+ readonly groupId?: string;
528
+ readonly isCaller: boolean;
529
+ };
530
+ } | {
531
+ readonly type: "singleCallInvited";
532
+ readonly payload: {
533
+ readonly callId: string;
534
+ readonly channel: string;
535
+ readonly callType: CALL_TYPE;
536
+ readonly callerUserId: string;
537
+ readonly calleeUserId?: string;
538
+ readonly groupId?: string;
539
+ readonly isCaller: boolean;
540
+ };
541
+ } | {
542
+ readonly type: "groupCallInvited";
543
+ readonly payload: {
544
+ readonly callId: string;
545
+ readonly channel: string;
546
+ readonly callType: CALL_TYPE;
547
+ readonly callerUserId: string;
548
+ readonly calleeUserId?: string;
549
+ readonly groupId?: string;
550
+ readonly isCaller: boolean;
551
+ };
552
+ } | {
553
+ readonly type: "callStarted";
554
+ readonly payload: {
555
+ readonly callId: string;
556
+ readonly channel: string;
557
+ readonly callType: CALL_TYPE;
558
+ readonly callerUserId: string;
559
+ readonly calleeUserId?: string;
560
+ readonly groupId?: string;
561
+ readonly isCaller: boolean;
562
+ readonly startTime: number;
563
+ };
564
+ } | {
565
+ readonly type: "callAccepted";
566
+ readonly payload: {
567
+ readonly callId: string;
568
+ readonly channel: string;
569
+ readonly callType: CALL_TYPE;
570
+ readonly callerUserId: string;
571
+ readonly calleeUserId?: string;
572
+ readonly groupId?: string;
573
+ readonly isCaller: boolean;
574
+ };
575
+ } | {
576
+ readonly type: "callConnected";
577
+ readonly payload: {
578
+ readonly callId: string;
579
+ readonly channel: string;
580
+ readonly callType: CALL_TYPE;
581
+ readonly callerUserId: string;
582
+ readonly calleeUserId?: string;
583
+ readonly groupId?: string;
584
+ };
585
+ } | {
586
+ readonly type: "callEnded";
587
+ readonly payload: {
588
+ readonly callId: string;
589
+ readonly channel: string;
590
+ readonly callType: CALL_TYPE;
591
+ readonly callerUserId: string;
592
+ readonly calleeUserId?: string;
593
+ readonly groupId?: string;
594
+ readonly reason: "hangup" | "cancel" | "refuse" | "busy" | "timeout" | "remoteHangup" | "remoteCancel";
595
+ readonly duration?: number;
596
+ };
597
+ } | {
598
+ readonly type: "callTimeout";
599
+ readonly payload: {
600
+ readonly callId: string;
601
+ readonly channel: string;
602
+ readonly callType: CALL_TYPE;
603
+ readonly callerUserId: string;
604
+ readonly calleeUserId?: string;
605
+ readonly groupId?: string;
606
+ };
607
+ } | {
608
+ readonly type: "singleCallStarted";
609
+ readonly payload: {
610
+ readonly callId: string;
611
+ readonly channel: string;
612
+ readonly callType: CALL_TYPE;
613
+ readonly callerUserId: string;
614
+ readonly calleeUserId?: string;
615
+ readonly groupId?: string;
616
+ readonly isCaller: boolean;
617
+ readonly startTime: number;
618
+ };
619
+ } | {
620
+ readonly type: "singleCallAccepted";
621
+ readonly payload: {
622
+ readonly callId: string;
623
+ readonly channel: string;
624
+ readonly callType: CALL_TYPE;
625
+ readonly callerUserId: string;
626
+ readonly calleeUserId?: string;
627
+ readonly groupId?: string;
628
+ readonly isCaller: boolean;
629
+ };
630
+ } | {
631
+ readonly type: "singleCallConnected";
632
+ readonly payload: {
633
+ readonly callId: string;
634
+ readonly channel: string;
635
+ readonly callType: CALL_TYPE;
636
+ readonly callerUserId: string;
637
+ readonly calleeUserId?: string;
638
+ readonly groupId?: string;
639
+ };
640
+ } | {
641
+ readonly type: "singleCallEnded";
642
+ readonly payload: {
643
+ readonly callId: string;
644
+ readonly channel: string;
645
+ readonly callType: CALL_TYPE;
646
+ readonly callerUserId: string;
647
+ readonly calleeUserId?: string;
648
+ readonly groupId?: string;
649
+ readonly reason: "hangup" | "cancel" | "refuse" | "busy" | "timeout" | "remoteHangup" | "remoteCancel";
650
+ readonly duration?: number;
651
+ };
652
+ } | {
653
+ readonly type: "singleCallTimeout";
654
+ readonly payload: {
655
+ readonly callId: string;
656
+ readonly channel: string;
657
+ readonly callType: CALL_TYPE;
658
+ readonly callerUserId: string;
659
+ readonly calleeUserId?: string;
660
+ readonly groupId?: string;
661
+ };
662
+ } | {
663
+ readonly type: "singleCallRefused";
664
+ readonly payload: {
665
+ readonly callId: string;
666
+ readonly channel: string;
667
+ readonly callType: CALL_TYPE;
668
+ readonly callerUserId: string;
669
+ readonly calleeUserId?: string;
670
+ readonly groupId?: string;
671
+ readonly isRemote: boolean;
672
+ };
673
+ } | {
674
+ readonly type: "singleCallBusy";
675
+ readonly payload: {
676
+ readonly callId: string;
677
+ readonly channel: string;
678
+ readonly callType: CALL_TYPE;
679
+ readonly callerUserId: string;
680
+ readonly calleeUserId?: string;
681
+ readonly groupId?: string;
682
+ };
683
+ } | {
684
+ readonly type: "singleCallCanceled";
685
+ readonly payload: {
686
+ readonly callId: string;
687
+ readonly channel: string;
688
+ readonly callType: CALL_TYPE;
689
+ readonly callerUserId: string;
690
+ readonly calleeUserId?: string;
691
+ readonly groupId?: string;
692
+ readonly isRemote: boolean;
693
+ };
694
+ } | {
695
+ readonly type: "groupCallStarted";
696
+ readonly payload: {
697
+ readonly callId: string;
698
+ readonly channel: string;
699
+ readonly callType: CALL_TYPE;
700
+ readonly callerUserId: string;
701
+ readonly calleeUserId?: string;
702
+ readonly groupId?: string;
703
+ readonly isCaller: boolean;
704
+ readonly startTime: number;
705
+ };
706
+ } | {
707
+ readonly type: "groupCallAccepted";
708
+ readonly payload: {
709
+ readonly callId: string;
710
+ readonly channel: string;
711
+ readonly callType: CALL_TYPE;
712
+ readonly callerUserId: string;
713
+ readonly calleeUserId?: string;
714
+ readonly groupId?: string;
715
+ readonly isCaller: boolean;
716
+ };
717
+ } | {
718
+ readonly type: "groupCallConnected";
719
+ readonly payload: {
720
+ readonly callId: string;
721
+ readonly channel: string;
722
+ readonly callType: CALL_TYPE;
723
+ readonly callerUserId: string;
724
+ readonly calleeUserId?: string;
725
+ readonly groupId?: string;
726
+ };
727
+ } | {
728
+ readonly type: "groupCallEnded";
729
+ readonly payload: {
730
+ readonly callId: string;
731
+ readonly channel: string;
732
+ readonly callType: CALL_TYPE;
733
+ readonly callerUserId: string;
734
+ readonly calleeUserId?: string;
735
+ readonly groupId?: string;
736
+ readonly reason: "hangup" | "cancel" | "refuse" | "busy" | "timeout" | "remoteHangup" | "remoteCancel";
737
+ readonly duration?: number;
738
+ };
739
+ } | {
740
+ readonly type: "groupCallTimeout";
741
+ readonly payload: {
742
+ readonly callId: string;
743
+ readonly channel: string;
744
+ readonly callType: CALL_TYPE;
745
+ readonly callerUserId: string;
746
+ readonly calleeUserId?: string;
747
+ readonly groupId?: string;
748
+ };
749
+ } | {
750
+ readonly type: "groupCallRefused";
751
+ readonly payload: {
752
+ readonly callId: string;
753
+ readonly channel: string;
754
+ readonly callType: CALL_TYPE;
755
+ readonly callerUserId: string;
756
+ readonly calleeUserId?: string;
757
+ readonly groupId?: string;
758
+ readonly isRemote: boolean;
759
+ };
760
+ } | {
761
+ readonly type: "groupCallBusy";
762
+ readonly payload: {
763
+ readonly callId: string;
764
+ readonly channel: string;
765
+ readonly callType: CALL_TYPE;
766
+ readonly callerUserId: string;
767
+ readonly calleeUserId?: string;
768
+ readonly groupId?: string;
769
+ };
770
+ } | {
771
+ readonly type: "groupCallCanceled";
772
+ readonly payload: {
773
+ readonly callId: string;
774
+ readonly channel: string;
775
+ readonly callType: CALL_TYPE;
776
+ readonly callerUserId: string;
777
+ readonly calleeUserId?: string;
778
+ readonly groupId?: string;
779
+ readonly isRemote: boolean;
780
+ };
781
+ } | {
782
+ readonly type: "statusChanged";
783
+ readonly payload: {
784
+ readonly callId: string;
785
+ readonly channel: string;
786
+ readonly callType: CALL_TYPE;
787
+ readonly callerUserId: string;
788
+ readonly calleeUserId?: string;
789
+ readonly groupId?: string;
790
+ readonly from: string;
791
+ readonly to: string;
792
+ };
793
+ } | {
794
+ readonly type: "callRefused";
795
+ readonly payload: {
796
+ readonly callId: string;
797
+ readonly channel: string;
798
+ readonly callType: CALL_TYPE;
799
+ readonly callerUserId: string;
800
+ readonly calleeUserId?: string;
801
+ readonly groupId?: string;
802
+ readonly isRemote: boolean;
803
+ };
804
+ } | {
805
+ readonly type: "callBusy";
806
+ readonly payload: {
807
+ readonly callId: string;
808
+ readonly channel: string;
809
+ readonly callType: CALL_TYPE;
810
+ readonly callerUserId: string;
811
+ readonly calleeUserId?: string;
812
+ readonly groupId?: string;
813
+ };
814
+ } | {
815
+ readonly type: "callCanceled";
816
+ readonly payload: {
817
+ readonly callId: string;
818
+ readonly channel: string;
819
+ readonly callType: CALL_TYPE;
820
+ readonly callerUserId: string;
821
+ readonly calleeUserId?: string;
822
+ readonly groupId?: string;
823
+ readonly isRemote: boolean;
824
+ };
825
+ } | {
826
+ readonly type: "groupCallInit";
827
+ readonly payload: {
828
+ readonly callId: string;
829
+ readonly groupId: string;
830
+ readonly groupName: string;
831
+ readonly channel: string;
832
+ readonly callType: "audio" | "video";
833
+ readonly callerUserId: string;
834
+ readonly invitedMembers: readonly string[];
835
+ };
836
+ } | {
837
+ readonly type: "participantStateChanged";
838
+ readonly payload: {
839
+ readonly callId: string;
840
+ readonly userId: string;
841
+ readonly state: "invited" | "accepted" | "joinedRtc" | "left";
842
+ readonly groupId?: string;
843
+ };
844
+ } | {
845
+ readonly type: "participantJoined";
846
+ readonly payload: {
847
+ readonly callId: string;
848
+ readonly channel: string;
849
+ readonly callType: CALL_TYPE;
850
+ readonly callerUserId: string;
851
+ readonly calleeUserId?: string;
852
+ readonly groupId?: string;
853
+ readonly userId: string;
854
+ };
855
+ } | {
856
+ readonly type: "participantLeft";
857
+ readonly payload: {
858
+ readonly callId: string;
859
+ readonly channel: string;
860
+ readonly callType: CALL_TYPE;
861
+ readonly callerUserId: string;
862
+ readonly calleeUserId?: string;
863
+ readonly groupId?: string;
864
+ readonly userId: string;
865
+ readonly reason: string;
866
+ };
867
+ } | {
868
+ readonly type: "rtcReport";
869
+ readonly payload: {
870
+ readonly type: string;
871
+ readonly payload: {
872
+ readonly [x: string]: any;
873
+ };
874
+ };
875
+ } | {
876
+ readonly type: "callDurationUpdated";
877
+ readonly payload: {
878
+ readonly callId: string;
879
+ readonly channel: string;
880
+ readonly callType: CALL_TYPE;
881
+ readonly callerUserId: string;
882
+ readonly calleeUserId?: string;
883
+ readonly groupId?: string;
884
+ readonly duration: number;
885
+ };
886
+ } | {
887
+ readonly type: "callError";
888
+ readonly payload: {
889
+ readonly type: string;
890
+ readonly error: string;
891
+ readonly callId?: string;
892
+ readonly context?: {
893
+ readonly [x: string]: any;
894
+ };
895
+ };
896
+ } | {
897
+ readonly type: "shouldJoinRtc";
898
+ readonly payload: {
899
+ readonly callId: string;
900
+ readonly channel: string;
901
+ readonly callType: CALL_TYPE;
902
+ readonly callerUserId: string;
903
+ readonly calleeUserId?: string;
904
+ readonly groupId?: string;
905
+ readonly token: string;
906
+ readonly uid: number | string;
907
+ readonly appId?: string;
908
+ readonly role: "caller" | "callee";
909
+ };
910
+ } | {
911
+ readonly type: "shouldLeaveRtc";
912
+ readonly payload: {
913
+ readonly callId: string;
914
+ readonly channel: string;
915
+ readonly callType: CALL_TYPE;
916
+ readonly callerUserId: string;
917
+ readonly calleeUserId?: string;
918
+ readonly groupId?: string;
919
+ readonly reason: string;
920
+ };
921
+ } | {
922
+ readonly type: "shouldPublishTracks";
923
+ readonly payload: {
924
+ readonly callId: string;
925
+ readonly channel: string;
926
+ readonly callType: CALL_TYPE;
927
+ readonly callerUserId: string;
928
+ readonly calleeUserId?: string;
929
+ readonly groupId?: string;
930
+ readonly trackTypes: readonly ("audio" | "video")[];
931
+ };
932
+ } | {
933
+ readonly type: "localAudioChanged";
934
+ readonly payload: {
935
+ readonly enabled: boolean;
936
+ };
937
+ } | {
938
+ readonly type: "localVideoChanged";
939
+ readonly payload: {
940
+ readonly enabled: boolean;
941
+ };
942
+ }>>;
943
+ eventLog: Readonly<import('vue').Ref<readonly {
944
+ readonly type: string;
945
+ readonly payload: any;
946
+ readonly timestamp: number;
947
+ }[], readonly {
948
+ readonly type: string;
949
+ readonly payload: any;
950
+ readonly timestamp: number;
951
+ }[]>>;
952
+ error: Readonly<import('vue').Ref<string, string>>;
953
+ isInitialized: Readonly<import('vue').Ref<boolean, boolean>>;
954
+ init: (config: {
955
+ imClient: any;
956
+ userProfile?: {
957
+ userId: string;
958
+ nickname?: string;
959
+ avatarURL?: string;
960
+ };
961
+ inviteTimeout?: number;
962
+ }) => Promise<void>;
963
+ inviteCall: (params: InviteCallParams) => Promise<void>;
964
+ answerCall: (params: AnswerCallParams) => Promise<void>;
965
+ hangup: (params?: HangupParams) => Promise<void>;
966
+ inviteGroupCall: (params: InviteGroupCallParams) => Promise<void>;
967
+ inviteMoreParticipants: (participantIds: string[]) => Promise<void>;
968
+ toggleAudio: () => void;
969
+ toggleVideo: () => void;
970
+ reportRtcEvent: (report: RtcReport) => void;
971
+ destroy: () => Promise<void>;
972
+ onCallEvent: (handler: (event: CallKitEvent) => void) => () => void;
973
+ canAccept: () => boolean;
974
+ canReject: () => boolean;
975
+ canHangup: () => boolean;
976
+ isWaitingCalleeAction: () => boolean;
977
+ isInActiveCall: () => boolean;
978
+ isInCall: () => boolean;
979
+ isCalling: () => boolean;
980
+ isIdle: () => boolean;
981
+ CALL_STATUS: {
982
+ readonly IDLE: 0;
983
+ readonly INVITING: 1;
984
+ readonly ALERTING: 2;
985
+ readonly CONFIRM_RING: 3;
986
+ readonly RECEIVED_CONFIRM_RING: 4;
987
+ readonly ANSWER_CALL: 5;
988
+ readonly CONFIRM_CALLEE: 6;
989
+ readonly IN_CALL: 7;
990
+ };
991
+ CALL_TYPE: {
992
+ readonly AUDIO_1V1: 0;
993
+ readonly VIDEO_1V1: 1;
994
+ readonly VIDEO_MULTI: 2;
995
+ readonly AUDIO_MULTI: 3;
996
+ };
997
+ };
998
+ export type UseCallKitCoreReturn = ReturnType<typeof useCallKitCore>;