@vkontakte/calls-sdk 2.8.12-dev.26c45af4.0 → 2.8.12-dev.2e0e572e.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 (47) hide show
  1. package/CallsSDK.d.ts +31 -7
  2. package/abstract/BaseApi.d.ts +10 -10
  3. package/abstract/BaseSignaling.d.ts +6 -5
  4. package/calls-sdk.cjs.js +10 -10
  5. package/calls-sdk.esm.js +3318 -2383
  6. package/classes/CallRegistry.d.ts +5 -1
  7. package/classes/ExternalIdCache.d.ts +11 -12
  8. package/classes/MediaSource.d.ts +4 -0
  9. package/classes/StatsLogger.d.ts +17 -2
  10. package/classes/{Conversation.d.ts → conversation/Conversation.d.ts} +57 -48
  11. package/classes/conversation/Conversation.testUtils.d.ts +150 -0
  12. package/classes/{ConversationResponseValidator.d.ts → conversation/ConversationResponseValidator.d.ts} +1 -1
  13. package/classes/{DisplayLayoutRequester.d.ts → conversation/DisplayLayoutRequester.d.ts} +7 -5
  14. package/classes/conversation/index.d.ts +1 -0
  15. package/classes/stat/CallFinishClassifier.d.ts +11 -0
  16. package/classes/stat/CallLifecycleStats.d.ts +42 -0
  17. package/classes/stat/ConversationStats.d.ts +5 -4
  18. package/classes/stat/FirstMediaSentProbe.d.ts +13 -0
  19. package/classes/stat/StatAggregator.d.ts +4 -0
  20. package/classes/stat/StatPings.d.ts +1 -2
  21. package/classes/stat/StatSignalingCommands.d.ts +1 -2
  22. package/classes/transport/BaseTransport.d.ts +7 -1
  23. package/classes/transport/DirectTransport.d.ts +2 -1
  24. package/classes/transport/ServerTransport.d.ts +2 -1
  25. package/classes/transport/Transport.d.ts +9 -1
  26. package/default/Api.d.ts +12 -12
  27. package/default/ApiExternal.d.ts +2 -1
  28. package/default/Signaling.d.ts +12 -15
  29. package/default/SignalingTransport.d.ts +10 -2
  30. package/enums/ClientHangupReason.d.ts +7 -0
  31. package/enums/HangupType.d.ts +0 -1
  32. package/enums/Stat.d.ts +5 -1
  33. package/package.json +3 -3
  34. package/static/ApiTransport.d.ts +3 -0
  35. package/static/AuthData.d.ts +10 -0
  36. package/static/Debug.d.ts +1 -0
  37. package/static/External.d.ts +11 -1
  38. package/static/Params.d.ts +35 -11
  39. package/static/Utils.d.ts +1 -1
  40. package/static/WebRTCUtils.d.ts +8 -7
  41. package/types/Api.d.ts +9 -0
  42. package/types/Conversation.d.ts +12 -2
  43. package/types/FastHangup.d.ts +66 -0
  44. package/types/SignalingMessage.d.ts +5 -1
  45. package/types/WebTransport.d.ts +17 -16
  46. package/utils/IceServers.d.ts +2 -0
  47. package/utils/NavigatorPermissions.d.ts +2 -2
@@ -0,0 +1,66 @@
1
+ import type ClientHangupReason from '../enums/ClientHangupReason';
2
+ import type HangupType from '../enums/HangupType';
3
+ /**
4
+ * Параметры запроса завершения звонка через внешнего партнёра (fast hangup).
5
+ *
6
+ * SDK генерирует объект и передаёт его в {@link FastHangupHandler}.
7
+ * Хост и backend партнёра пробрасывают `internalParams` как есть, без парсинга.
8
+ */
9
+ export interface FastHangupParams {
10
+ /**
11
+ * ID звонка
12
+ */
13
+ conversationId: string;
14
+ /**
15
+ * Причина завершения звонка
16
+ */
17
+ reason: HangupType;
18
+ /**
19
+ * Внутренние параметры звонка (JSON-строка). Генерируется SDK.
20
+ */
21
+ internalParams?: string | null;
22
+ }
23
+ /**
24
+ * Ответ внешнего партнёра на завершение звонка.
25
+ */
26
+ export interface FastHangupResponse {
27
+ /**
28
+ * true — участие в звонке завершено
29
+ */
30
+ success: boolean;
31
+ }
32
+ /**
33
+ * Параметры публичных методов {@link hangup} / {@link declineCall}.
34
+ *
35
+ * `reason` и `conversationId` идут в signaling hangup.
36
+ * `onFastHangup` заменяет Calls API `vchat.hangupConversation`, если обработчик передан
37
+ * (явный hangup/decline или delayed hangup во время init).
38
+ * Если обработчик не передан, API hangup не вызывается — кроме закрытия вкладки (`pagehide`),
39
+ * где SDK всегда шлёт beacon, и delayed hangup без handler.
40
+ */
41
+ export interface HangupParams {
42
+ /**
43
+ * ID звонка. Если опущен — завершается текущий активный звонок.
44
+ */
45
+ conversationId?: string;
46
+ /**
47
+ * Причина завершения для проброса в сигналинг. См. {@link ClientHangupReason}.
48
+ */
49
+ reason?: ClientHangupReason;
50
+ /**
51
+ * Обработчик fast hangup — завершение звонка через внешнего партнёра.
52
+ */
53
+ onFastHangup?: FastHangupHandler;
54
+ }
55
+ /**
56
+ * Функция-обработчик fast hangup.
57
+ *
58
+ * Если передана в {@link HangupParams.onFastHangup} при `hangup` / `declineCall`,
59
+ * SDK вызывает её вместо API `vchat.hangupConversation`.
60
+ *
61
+ * На `pagehide` не используется — SDK всегда отправляет `sendBeacon`.
62
+ *
63
+ * @param params Параметры запроса
64
+ * @param signal AbortSignal текущего звонка, если он ещё жив на момент вызова
65
+ */
66
+ export type FastHangupHandler = (params: FastHangupParams, signal?: AbortSignal) => Promise<FastHangupResponse>;
@@ -34,8 +34,11 @@ export type RecordInfo = {
34
34
  recordExternalOwnerId?: string;
35
35
  };
36
36
  export interface SignalingResponse extends SignalingMessage {
37
- response?: SignalingCommandType;
38
37
  error?: string;
38
+ errorCode?: string;
39
+ errorMessage?: string;
40
+ message?: string;
41
+ response?: SignalingCommandType;
39
42
  reason?: HangupType | FatalError;
40
43
  sequence?: number;
41
44
  type: 'response' | 'error' | 'timeout';
@@ -185,6 +188,7 @@ declare namespace SignalingMessage {
185
188
  peerId: PeerId;
186
189
  mediaSettings: Partial<MediaSettings>;
187
190
  capabilities?: string;
191
+ externalId?: ExternalId;
188
192
  }
189
193
  export interface Hungup extends Notification {
190
194
  participantId: OkUserId;
@@ -1,31 +1,32 @@
1
1
  import { WebTransportOptions } from '@fails-components/webtransport';
2
+ import { DebugLogger } from '../static/Debug';
2
3
  declare class WebTransportEventual {
4
+ static isBrowserSupported(): boolean;
5
+ onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
6
+ onmessage: ((this: WebTransportEventual, ev: MessageEvent) => any) | null;
7
+ onerror: ((this: WebTransportEventual, ev: Event) => any) | null;
8
+ onclose: ((this: WebTransportEventual, ev: CloseEvent) => any) | null;
9
+ readyState: number;
3
10
  private webTransport;
4
- private stream;
5
11
  private writer;
6
- private reader;
7
12
  private readonly url;
8
13
  private readonly options;
9
14
  private readonly compression;
10
- private closeRequested;
11
- private closeEventEmitted;
12
15
  private encoder;
13
16
  private decoder;
14
- onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
15
- onmessage: ((this: WebTransportEventual, ev: MessageEvent) => any) | null;
16
- onerror: ((this: WebTransportEventual, ev: Event) => any) | null;
17
- onclose: ((this: WebTransportEventual, ev: CloseEvent) => any) | null;
18
- readyState: number;
19
- constructor(url: string, options?: WebTransportOptions);
17
+ private readonly _debug;
18
+ constructor(url: string, options?: WebTransportOptions, debug?: DebugLogger);
19
+ send(data: string): Promise<void>;
20
+ close(code?: number, reason?: string): void;
20
21
  private getCompressionTypeFromUrl;
21
22
  private connect;
22
- private readChunks;
23
+ private observeClosed;
23
24
  private readLoop;
24
- send(data: string): Promise<void>;
25
+ private fail;
26
+ private handleStreamError;
27
+ private requestNativeClose;
28
+ private finishClose;
29
+ private emitEvent;
25
30
  private createErrorEvent;
26
- close(code?: number, reason?: string): void;
27
- private closeConnectedTransport;
28
- private emitClose;
29
- static isBrowserSupported(): boolean;
30
31
  }
31
32
  export { WebTransportEventual as WebTransport };
@@ -0,0 +1,2 @@
1
+ import IceServer from '../types/IceServer';
2
+ export declare function createIceServers(stunServer?: IceServer, turnServer?: IceServer): IceServer[];
@@ -2,8 +2,8 @@ type Device = 'camera' | 'microphone';
2
2
  type PermissionStatusState = typeof PermissionStatus.prototype.state;
3
3
  type EventListener = (name: Device, state: PermissionStatusState) => void;
4
4
  export declare class NavigatorPermissions {
5
- private _cameraPermissionStatus;
6
- private _microphonePermissionStatus;
5
+ private _cameraPermissionStatus?;
6
+ private _microphonePermissionStatus?;
7
7
  private _listener;
8
8
  static isSupported(): boolean;
9
9
  init(listener: EventListener): Promise<void>;