@vkontakte/calls-sdk 2.8.12-dev.c60cf16f.0 → 2.8.12-dev.c8b26761.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.
@@ -1,12 +1,22 @@
1
+ import type { OkUserId } from '../types/Participant';
1
2
  export default abstract class AuthData {
2
3
  private static _sessionKey;
3
4
  private static _sessionSecretKey;
4
5
  private static _accessToken;
6
+ private static _userId;
7
+ private static _reauthorizePromise;
5
8
  static get sessionKey(): string | undefined;
6
9
  static set sessionKey(value: string | undefined);
7
10
  static get sessionSecretKey(): string | undefined;
8
11
  static set sessionSecretKey(value: string | undefined);
9
12
  static get accessToken(): string | undefined;
10
13
  static set accessToken(value: string | undefined);
14
+ static get userId(): OkUserId | null;
15
+ static set userId(value: OkUserId | null);
11
16
  static isEmpty(): boolean;
17
+ /**
18
+ * Дедуплицирует одновременные попытки реавторизации из разных инстансов Api.
19
+ * Первый вызов выполняет authorizeFn, остальные ждут того же промиса.
20
+ */
21
+ static reauthorize(authorizeFn: () => Promise<void>): Promise<void>;
12
22
  }
@@ -637,6 +637,6 @@ declare namespace External {
637
637
  /**
638
638
  * Собеседник подключился к сигналлингу
639
639
  */
640
- function onPeerRegistered(conversationId?: string): void;
640
+ function onPeerRegistered(conversationId?: string, externalIds?: ExternalId[]): void;
641
641
  }
642
642
  export default External;
@@ -892,7 +892,7 @@ export type ParamsObject = {
892
892
  /**
893
893
  * Собеседник подключился к сигналлингу
894
894
  */
895
- onPeerRegistered?: (conversationId?: string) => void;
895
+ onPeerRegistered?: (conversationId?: string, externalIds?: ExternalId[]) => void;
896
896
  };
897
897
  export default abstract class Params {
898
898
  private static _params;
@@ -122,6 +122,10 @@ declare namespace WebRTCUtils {
122
122
  * Проверяет поддержку WebRTC браузером
123
123
  */
124
124
  function isBrowserSupported(): boolean;
125
+ /**
126
+ * Возвращает первую отсутствующую capability в стабильном порядке.
127
+ */
128
+ function getBrowserSupportFailure(): BrowserSupportFailure | null;
125
129
  /**
126
130
  * Проверяет поддержку шаринга экрана браузером
127
131
  */
@@ -0,0 +1,68 @@
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
+ * Fire-and-forget: `success` и ошибки логируются SDK и не влияют на teardown и `onHangup`.
62
+ *
63
+ * На `pagehide` не используется — SDK всегда отправляет `sendBeacon`.
64
+ *
65
+ * @param params Параметры запроса
66
+ * @param signal AbortSignal текущего звонка, если он ещё жив на момент вызова
67
+ */
68
+ 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';
@@ -1,33 +1,32 @@
1
1
  import { WebTransportOptions } from '@fails-components/webtransport';
2
2
  import { DebugLogger } from '../static/Debug';
3
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;
4
10
  private webTransport;
5
- private stream;
6
11
  private writer;
7
- private reader;
8
12
  private readonly url;
9
13
  private readonly options;
10
14
  private readonly compression;
11
- private closeRequested;
12
- private closeEventEmitted;
13
15
  private encoder;
14
16
  private decoder;
15
17
  private readonly _debug;
16
- onopen: ((this: WebTransportEventual, ev: Event) => any) | null;
17
- onmessage: ((this: WebTransportEventual, ev: MessageEvent) => any) | null;
18
- onerror: ((this: WebTransportEventual, ev: Event) => any) | null;
19
- onclose: ((this: WebTransportEventual, ev: CloseEvent) => any) | null;
20
- readyState: number;
21
18
  constructor(url: string, options?: WebTransportOptions, debug?: DebugLogger);
19
+ send(data: string): Promise<void>;
20
+ close(code?: number, reason?: string): void;
22
21
  private getCompressionTypeFromUrl;
23
22
  private connect;
24
- private readChunks;
23
+ private observeClosed;
25
24
  private readLoop;
26
- send(data: string): Promise<void>;
25
+ private fail;
26
+ private handleStreamError;
27
+ private requestNativeClose;
28
+ private finishClose;
29
+ private emitEvent;
27
30
  private createErrorEvent;
28
- close(code?: number, reason?: string): void;
29
- private closeConnectedTransport;
30
- private emitClose;
31
- static isBrowserSupported(): boolean;
32
31
  }
33
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[];