@koi-design/callkit 2.0.0-beta.8 → 2.0.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.
package/dist/index.d.ts CHANGED
@@ -44,7 +44,7 @@ declare class Logger {
44
44
  info(msg: string, extra: LogEntity): void;
45
45
  success(msg: string, extra: LogEntity): void;
46
46
  warn(msg: string, extra: LogEntity): void;
47
- error(msg: string | Error, extra: LogEntity): void;
47
+ error(msg: string | Error, extra: LogEntity, noTrigger?: boolean): void;
48
48
  private catchLog;
49
49
  }
50
50
 
@@ -80,7 +80,6 @@ declare class Socket {
80
80
  private confirmAck;
81
81
  private onMessage;
82
82
  send(event: SocketSendEventType, message?: any): void;
83
- sendMessage(event: SocketSendEventType, message?: any): Promise<void>;
84
83
  private ping;
85
84
  private checkPing;
86
85
  /**
@@ -102,11 +101,7 @@ interface IConfig {
102
101
  version: string;
103
102
  host: string;
104
103
  log: LoggerLevel;
105
- trackLogs: {
106
- enabled: boolean;
107
- interval: number;
108
- maxSize: number;
109
- };
104
+ trackLogs: TrackLogsConfig;
110
105
  audioRef?: HTMLAudioElement | (() => HTMLAudioElement);
111
106
  constrains: WebrtcConstranis;
112
107
  socket: string;
@@ -142,7 +137,8 @@ declare class Config {
142
137
  validate: () => boolean;
143
138
  isLogin: () => boolean;
144
139
  check(): boolean;
145
- isLogsEnabled(): boolean;
140
+ getTrackLogsConfig(): TrackLogsConfig;
141
+ enableTrackLogs(enabled: boolean): void;
146
142
  }
147
143
 
148
144
  declare const CallStatus: {
@@ -192,6 +188,10 @@ declare const KitEvent: {
192
188
  * Mute status change
193
189
  */
194
190
  KIT_SET_MUTE: string;
191
+ /**
192
+ * Call id change
193
+ */
194
+ KIT_CALL_ID_CHANGE: string;
195
195
  /**
196
196
  * Error
197
197
  */
@@ -308,7 +308,12 @@ type EncryptionMethodType = (typeof EncryptionMethod)[keyof typeof EncryptionMet
308
308
  declare const CallSourceType: {
309
309
  phoneNum: number;
310
310
  workOrderId: number;
311
- };
311
+ };
312
+ interface TrackLogsConfig {
313
+ enabled: boolean;
314
+ interval: number;
315
+ maxSize: number;
316
+ }
312
317
 
313
318
  interface CallParams {
314
319
  agentId: string;
@@ -344,42 +349,48 @@ type CallStatusType = (typeof CallStatus)[keyof typeof CallStatus];
344
349
  declare class Connect {
345
350
  callKit: CallKit;
346
351
  /**
347
- * connectStatus: init registered connecting calling
352
+ *@description Reconnect config
353
+ */
354
+ private reconnectConfig;
355
+ /**
356
+ *@description Whether muted
357
+ */
358
+ private isMute;
359
+ /**
360
+ *@description Whether registered
361
+ */
362
+ private isRegister;
363
+ /**
364
+ *@description Whether holding
365
+ */
366
+ private isHold;
367
+ /**
368
+ *@description Connect status: init registered connecting calling
348
369
  */
349
370
  connectStatus: number;
350
371
  currentSession?: Invitation;
351
372
  mediaStream?: MediaStream;
352
373
  userAgent?: UserAgent;
353
374
  registerer?: Registerer;
354
- currentCallId?: string;
355
375
  /**
356
- * Whether it's a re-connected
376
+ *@description Whether it's a re-connected
357
377
  */
358
378
  isReConnected: boolean;
359
- observeOptionsHeartbeatHandler: ReturnType<typeof setTimeout> | null;
360
379
  /**
361
- * Whether it's an outgoing call
380
+ *@description Whether it's an outgoing call
362
381
  */
363
382
  isOutgoing: boolean;
364
383
  /**
365
- * Whether it's an active hangup
384
+ *@description Whether it's an active hangup
366
385
  */
367
386
  isUnprompted: boolean;
368
- isCurrentSessionInvited: boolean;
369
- private reconnectConfig;
370
387
  /**
371
- * Whether muted
388
+ *@description Whether the current session is invited
372
389
  */
373
- private isMute;
374
- /**
375
- * Whether registered
376
- */
377
- private isRegister;
378
- /**
379
- * Whether holding
380
- */
381
- private isHold;
390
+ hasInvite: boolean;
382
391
  constructor(callKit: CallKit);
392
+ currentCallId: string | null;
393
+ setCallId(callId: string | null): void;
383
394
  reset(): Promise<void>;
384
395
  private getAduioReference;
385
396
  permission(): Promise<void>;
@@ -414,8 +425,9 @@ declare class Connect {
414
425
  * @returns
415
426
  */
416
427
  isInit(): boolean;
417
- clearObserveOptionsHeartbeatInterval(): void;
418
- heartbeatFlag: number;
428
+ private heartbeatInterval?;
429
+ private heartbeatFlag;
430
+ clearHeartbeat(): void;
419
431
  startHeartbeat(): void;
420
432
  socketTriggerHangup(callId: string): void;
421
433
  register(): Promise<void>;
@@ -500,7 +512,7 @@ declare class CallKit {
500
512
  on(event: kitEventType, callback: (...args: any[]) => void): void;
501
513
  off(event: kitEventType, callback?: (...args: any[]) => void): void;
502
514
  removeAllListeners(): void;
503
- trigger(event: kitEventType, data?: any): void;
515
+ trigger(event: kitEventType, data?: any, noLog?: boolean): void;
504
516
  }
505
517
 
506
518
  export { CallKit, CallKitConfig, ConfigEntity, kitEventType };