@vkontakte/calls-sdk 2.8.4-dev.c1b325f.0 → 2.8.4-dev.c289e55.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.
@@ -112,7 +112,6 @@ export default class Conversation extends EventEmitter {
112
112
  private _createMediaSource;
113
113
  private _connectSignaling;
114
114
  private _processConnection;
115
- private _prepareParticipants;
116
115
  private _onConversationParticipantListChunk;
117
116
  private _createParticipantListChunk;
118
117
  private _participantListChunkToExternalChunk;
@@ -365,6 +364,7 @@ export default class Conversation extends EventEmitter {
365
364
  private _refreshRooms;
366
365
  /** получили из сингналинга сообщение о реакции пользователей */
367
366
  private _onFeedback;
367
+ private _onDecorativeParticipantIdChanged;
368
368
  private _isMe;
369
369
  private _getMuteStatesForRoomId;
370
370
  private _getMuteStatesForCurrentRoom;
package/default/Api.d.ts CHANGED
@@ -8,10 +8,11 @@ export default class Api extends BaseApi {
8
8
  private _userId;
9
9
  private _uuid;
10
10
  private _externalUidsCache;
11
+ private _decorativeIdToInitialId;
12
+ private _initialIdToDecorativeId;
11
13
  private _callUnsafe;
12
14
  protected _call(method: string, data?: any, noSession?: boolean): Promise<any>;
13
- userId(compositeUserId: ParticipantId): Promise<ExternalParticipantId>;
14
- prepareUserIds(ids: OkUserId[]): Promise<void>;
15
+ userId(participantId: ParticipantId): Promise<ExternalParticipantId>;
15
16
  authorize(): Promise<void>;
16
17
  log(items: LogItem[]): void;
17
18
  init(): void;
@@ -48,7 +49,10 @@ export default class Api extends BaseApi {
48
49
  */
49
50
  getExternalIdsByOkIds(uids: OkUserId[]): Promise<ExternalParticipantId[]>;
50
51
  getCachedOkIdByExternalId(externalId: ExternalId): ParticipantId | null;
51
- cacheExternalId(participantId: CompositeUserId, externalId: ExternalParticipantId): void;
52
+ cacheExternalId(participantId: OkUserId | CompositeUserId | ParticipantId, externalId: ExternalParticipantId): void;
53
+ mapDecorativeId(decorativeId: OkUserId | CompositeUserId | ParticipantId, initialId: OkUserId | CompositeUserId | ParticipantId): void;
54
+ getDecorativeIdByInitialId(initialId: OkUserId | CompositeUserId | ParticipantId): OkUserId | undefined;
55
+ replaceByInitialIdIdIfExists(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
52
56
  getConversationParams(conversationId?: string): Promise<ConversationParams>;
53
57
  getUserId(): OkUserId | null;
54
58
  setUserId(userId: OkUserId): void;
@@ -20,9 +20,8 @@ import ParticipantLayout, { RequestKeyFrame, StopStream } from '../types/Partici
20
20
  import { ParticipantListChunkParameters } from '../types/ParticipantListChunk';
21
21
  import { StreamDescriptionString } from '../types/ParticipantStreamDescription';
22
22
  import { PerfStatReport } from '../types/PerfStatReporter';
23
- import SignalingMessage, { GetRoomsSignalingResponse, SignalingSuccessResponse } from '../types/SignalingMessage';
23
+ import SignalingMessage, { GetParticipantsSignalingResponse, GetRoomsSignalingResponse, SignalingSuccessResponse } from '../types/SignalingMessage';
24
24
  import { IPublishStreamData, IRecordConfData, IStartStreamData, IStopStreamData } from '../types/Streams';
25
- import { WaitingParticipantId } from '../types/WaitingHall';
26
25
  export default class Signaling extends BaseSignaling {
27
26
  private socket;
28
27
  protected sequence: number;
@@ -73,7 +72,7 @@ export default class Signaling extends BaseSignaling {
73
72
  /**
74
73
  * Send a command to a signaling server
75
74
  */
76
- protected _send(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<SignalingMessage>;
75
+ protected _send<T extends SignalingSuccessResponse>(command: SignalingCommandType, params?: any, needResponse?: boolean, retryCount?: number): Promise<T>;
77
76
  /**
78
77
  * Send a raw command to a signaling server
79
78
  */
@@ -135,7 +134,7 @@ export default class Signaling extends BaseSignaling {
135
134
  changeOptions(changes: {
136
135
  [key in ConversationOption]?: boolean;
137
136
  }): Promise<SignalingMessage>;
138
- getWaitingHall(fromId?: WaitingParticipantId | null, count?: number, backward?: boolean): Promise<SignalingMessage>;
137
+ getWaitingHall(fromId?: SignalingMessage.WaitingParticipantId | null, count?: number, backward?: boolean): Promise<SignalingMessage>;
139
138
  promoteParticipant(participantId: CompositeUserId, demote?: boolean): Promise<SignalingMessage>;
140
139
  requestPromotion(unrequest?: boolean): Promise<SignalingMessage>;
141
140
  acceptPromotion(reject?: boolean): Promise<SignalingMessage>;
@@ -153,7 +152,7 @@ export default class Signaling extends BaseSignaling {
153
152
  */
154
153
  readyToSend(isReady?: boolean): void;
155
154
  getParticipantListChunk(participantListChunkParameters: ParticipantListChunkParameters): Promise<SignalingMessage>;
156
- getParticipants(externalIds: SignalingMessage.ExternalId[]): Promise<SignalingMessage>;
155
+ getParticipants(externalIds: SignalingMessage.ExternalId[]): Promise<GetParticipantsSignalingResponse>;
157
156
  startAsr(params: IAsrStartParams): Promise<SignalingMessage>;
158
157
  stopAsr(params?: IAsrStopParams): Promise<SignalingMessage>;
159
158
  requestAsr(request: boolean): Promise<SignalingMessage>;
@@ -47,6 +47,7 @@ declare enum SignalingNotification {
47
47
  FEATURES_PER_ROLE_CHANGED = "features-per-role-changed",
48
48
  PARTICIPANT_ANIMOJI_CHANGED = "participant-animoji-changed",
49
49
  ASR_STARTED = "asr-started",
50
- ASR_STOPPED = "asr-stopped"
50
+ ASR_STOPPED = "asr-stopped",
51
+ DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed"
51
52
  }
52
53
  export default SignalingNotification;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.4-dev.c1b325f.0",
3
+ "version": "2.8.4-dev.c289e55.0",
4
4
  "author": "vk.com",
5
5
  "description": "Library for video calls based on the vk.com platform",
6
6
  "homepage": "https://vk.com",
@@ -531,6 +531,12 @@ declare namespace External {
531
531
  */
532
532
  function onAsrStopped(roomId: number | null): void;
533
533
  function onAsrTranscription(id: ExternalParticipantId, text: string, timestamp: number, duration: number): void;
534
+ /**
535
+ * Изменился id участника (деанонимизация)
536
+ * @param prevId
537
+ * @param newId
538
+ */
539
+ function onDecorativeParticipantIdChanged(prevId: ExternalParticipantId, newId: ExternalParticipantId): void;
534
540
  /**
535
541
  * Одобрено повышение пользователя в зеле ожидания/зале в режиме Audience
536
542
  *
@@ -324,6 +324,12 @@ export type ParamsObject = {
324
324
  movieShare: boolean;
325
325
  /** @hidden */
326
326
  breakVideoPayloadTypes: boolean;
327
+ /**
328
+ * Включить звонки контактам
329
+ *
330
+ * _По умолчанию: `false`_
331
+ */
332
+ useCallsToContacts: boolean;
327
333
  /**
328
334
  * Включить постраничный вывод участников. Работает только если включено videoTracksCount (слоты)
329
335
  *
@@ -777,7 +783,13 @@ export type ParamsObject = {
777
783
  */
778
784
  onRemoteSharedUrl?: (userId: ExternalParticipantId, sharedUrl: string | undefined, roomId: IRoomId) => void;
779
785
  /**
780
- * Одобрено повышение пользователя в зеле ожидания/зале в режиме Audience
786
+ * Изменился id участника (деанонимизация)
787
+ * @param prevId
788
+ * @param newId
789
+ */
790
+ onDecorativeParticipantIdChanged?: (prevId: ExternalParticipantId, newId: ExternalParticipantId) => void;
791
+ /**
792
+ * Одобрено повышение пользователя в зале ожидания/зале в режиме Audience
781
793
  *
782
794
  * @param adminParticipantId админ, одобривший повышение
783
795
  */
@@ -898,6 +910,7 @@ export default abstract class Params {
898
910
  static get movieShare(): boolean;
899
911
  static get videoTracksCount(): number;
900
912
  static get breakVideoPayloadTypes(): boolean;
913
+ static get useCallsToContacts(): boolean;
901
914
  static get useParticipantListChunk(): boolean;
902
915
  static get useRooms(): boolean;
903
916
  static get participantListChunkInitIndex(): number;
package/static/Utils.d.ts CHANGED
@@ -15,11 +15,13 @@ declare namespace Utils {
15
15
  local: any;
16
16
  remote: any;
17
17
  }>;
18
- function composeUserId(id: CompositeUserId | OkUserId, type: UserType): CompositeUserId;
18
+ function composeUserId(id: CompositeUserId | OkUserId, type?: UserType): CompositeUserId;
19
19
  function composeParticipantId(id: CompositeUserId | OkUserId, type: UserType, deviceIdx?: number): ParticipantId;
20
20
  function compose(compositeId: CompositeUserId, deviceIdx?: number): ParticipantId;
21
21
  function composeId(participant: SignalingMessage.Participant): ParticipantId;
22
+ function composeDecorativeId(participant: SignalingMessage.Participant): ParticipantId | undefined;
22
23
  function composeMessageId(message: SignalingMessage): ParticipantId;
24
+ function extractOkId(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
23
25
  function decomposeId(compositeId: CompositeUserId | OkUserId): {
24
26
  id: OkUserId;
25
27
  type: UserType;
@@ -17,6 +17,7 @@ export type ExternalUserId = string;
17
17
  export declare namespace ExternalIdUtils {
18
18
  function fromIds(ids: ExternalUserId[] | ExternalId[]): ExternalId[];
19
19
  function fromId(id: ExternalUserId, type?: ExternalIdType, deviceIdx?: number): ExternalParticipantId;
20
+ function fromSignalingParticipant(participant: SignalingMessage.Participant, useDecorative?: boolean): ExternalParticipantId | undefined;
20
21
  function fromSignaling(signalingId: SignalingMessage.ExternalId, deviceIdx?: number): ExternalParticipantId;
21
22
  function toString(externalId: ExternalId): ExternalIdString;
22
23
  function fromIdToString(id: ExternalUserId, type?: ExternalIdType, deviceIdx?: number): ExternalIdString;
@@ -15,6 +15,7 @@ export type CompositeUserId = string;
15
15
  /**
16
16
  * Уникально идентифицирует участника звонка
17
17
  * (одному пользователю могут соответствовать несколько участников, в случае если пользователь зашёл в звонок с нескольких устройств)
18
+ * Включает композитный id и постфикс с номером устройства, если он не равен 0
18
19
  */
19
20
  export type ParticipantId = string;
20
21
  export type OkUserId = number;
@@ -44,7 +45,13 @@ export interface ParticipantStateMapped {
44
45
  };
45
46
  }
46
47
  export interface Participant {
48
+ /**
49
+ * string representation
50
+ */
47
51
  id: ParticipantId;
52
+ /**
53
+ * If user has 'decorative external id' it will be set as externalId
54
+ */
48
55
  externalId: ExternalParticipantId;
49
56
  mediaSettings: MediaSettings;
50
57
  state: ParticipantState;
@@ -48,6 +48,9 @@ export interface GetRoomsSignalingResponse extends SignalingSuccessResponse {
48
48
  roomId?: number;
49
49
  };
50
50
  }
51
+ export interface GetParticipantsSignalingResponse extends SignalingSuccessResponse {
52
+ participants: SignalingMessage.Participant[];
53
+ }
51
54
  declare namespace SignalingMessage {
52
55
  export interface ExternalId {
53
56
  type: 'UNKNOWN' | 'VK' | 'ANONYM';
@@ -70,6 +73,8 @@ declare namespace SignalingMessage {
70
73
  export interface Participant {
71
74
  id: OkUserId;
72
75
  idType?: UserType;
76
+ decorativeUserId?: CompositeUserId;
77
+ decorativeExternalUserId?: ExternalId;
73
78
  deviceIdx?: number;
74
79
  externalId?: ExternalId;
75
80
  state: ParticipantState;
@@ -97,6 +102,14 @@ declare namespace SignalingMessage {
97
102
  countAfter: number;
98
103
  markerFound: boolean;
99
104
  }
105
+ export interface WaitingParticipantId {
106
+ addedTs: number;
107
+ id: CompositeUserId;
108
+ }
109
+ export interface WaitingParticipant {
110
+ id: WaitingParticipantId;
111
+ externalId?: ExternalId;
112
+ }
100
113
  export interface RoomUrlSharingInfo {
101
114
  sharedUrl: string;
102
115
  initiatorId: CompositeUserId;
@@ -407,6 +420,11 @@ declare namespace SignalingMessage {
407
420
  export interface ParticipantSourcesUpdateNotification extends Notification {
408
421
  participantUpdateInfos: ParticipantUpdateInfo[];
409
422
  }
423
+ export interface DecorativeParticipantIdChanged extends Notification {
424
+ participantId: CompositeUserId;
425
+ decorativeParticipantId?: CompositeUserId;
426
+ decorativeExternalParticipantId?: ExternalId;
427
+ }
410
428
  export {};
411
429
  }
412
430
  export default SignalingMessage;
@@ -1,18 +1,9 @@
1
1
  import { ExternalId } from './ExternalId';
2
- import { CompositeUserId } from './Participant';
3
2
  import SignalingMessage from './SignalingMessage';
4
3
  import { IFeedback } from './Feedback';
5
- export type WaitingParticipantId = {
6
- addedTs: number;
7
- id: CompositeUserId;
8
- };
9
- export type WaitingParticipant = {
10
- id: WaitingParticipantId;
11
- externalId?: SignalingMessage.ExternalId;
12
- };
13
4
  export type ChatRoom = {
14
5
  totalCount: number;
15
- firstParticipants?: WaitingParticipant[];
6
+ firstParticipants?: SignalingMessage.WaitingParticipant[];
16
7
  handCount?: number;
17
8
  feedback?: IFeedback[];
18
9
  };
@@ -24,5 +15,5 @@ export type WaitingHallResponse = {
24
15
  pageMarker: string | null;
25
16
  totalCount: number;
26
17
  };
27
- export declare function waitingParticipantIdToString(id: WaitingParticipantId): string | null;
28
- export declare function waitingParticipantIdFromString(id: string): WaitingParticipantId | null;
18
+ export declare function waitingParticipantIdToString(id: SignalingMessage.WaitingParticipantId): string | null;
19
+ export declare function waitingParticipantIdFromString(id: string): SignalingMessage.WaitingParticipantId | null;