@vkontakte/calls-sdk 2.8.13-dev.9872d43d.0 → 2.8.13-dev.a049e4ee.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/calls-sdk.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @vkontakte/calls-sdk v2.8.13-dev.9872d43d.0
3
- * Wed, 11 Nov 2026 10:08:55 GMT
2
+ * @vkontakte/calls-sdk v2.8.13-dev.a049e4ee.0
3
+ * Fri, 13 Nov 2026 14:09:25 GMT
4
4
  * https://calls-sdk.cdn-vk.ru/doc/latest/index.html
5
5
  */
6
6
 
@@ -2306,7 +2306,7 @@ var Tn = wn.getInstance(), M = class e {
2306
2306
  return 1.1;
2307
2307
  }
2308
2308
  static get sdkVersion() {
2309
- return "2.8.13-dev.9872d43d.0";
2309
+ return "2.8.13-dev.a049e4ee.0";
2310
2310
  }
2311
2311
  static get debug() {
2312
2312
  return e._params.debug;
@@ -2338,6 +2338,9 @@ var Tn = wn.getInstance(), M = class e {
2338
2338
  static set clientType(t) {
2339
2339
  e._params.clientType = t;
2340
2340
  }
2341
+ static get useSelfExternalUserId() {
2342
+ return e._params.useSelfExternalUserId;
2343
+ }
2341
2344
  static get externalUserType() {
2342
2345
  return e._params.externalUserType;
2343
2346
  }
@@ -2766,6 +2769,7 @@ h(M, "_params", {
2766
2769
  autoStartStats: !0,
2767
2770
  statQueueEnabled: !1,
2768
2771
  clientType: "PORTAL",
2772
+ useSelfExternalUserId: !1,
2769
2773
  externalUserType: "",
2770
2774
  device: "browser",
2771
2775
  apiKey: "",
@@ -7778,7 +7782,7 @@ var ho = new Set([
7778
7782
  return this._send(B.HOLD, {
7779
7783
  hold: e,
7780
7784
  capabilities: e ? void 0 : t
7781
- });
7785
+ }, !0, uo);
7782
7786
  }
7783
7787
  async putHandsDown() {
7784
7788
  return this._send(B.PUT_HANDS_DOWN);
@@ -11153,14 +11157,14 @@ var Ic = 15, $ = class e extends Xe {
11153
11157
  let n = { rooms: this._extractExternalRooms(e) };
11154
11158
  return t && (n.roomId = t), n;
11155
11159
  }
11156
- async onPush(e, t = A.USER, n, r, i, a) {
11160
+ async onPush(e, t = A.USER, n, r, i, a, o) {
11157
11161
  this._registerPending(e), this._serverConversationId = e, a && this._api.setUserId(a), this._stats.lifecycle.markInitializationStarted({
11158
11162
  source: "incoming",
11159
11163
  conversationId: e
11160
11164
  }), this._debug.setConversationId(e), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
11161
11165
  try {
11162
11166
  this._mediaSource = this._createMediaSource();
11163
- let a = await this._prepareConversation(e, t, n, r, i);
11167
+ let a = await this._prepareConversation(e, t, n, r, i, o);
11164
11168
  if (this._throwIfClosed(), !this._conversation) throw new O(p.UNKNOWN_ERROR, { callError: {
11165
11169
  scope: "internal",
11166
11170
  code: "conversation",
@@ -11459,9 +11463,9 @@ var Ic = 15, $ = class e extends Xe {
11459
11463
  _setConversationParams({ turn_server: e, stun_server: t, endpoint: n, wt_endpoint: r, token: i, client_type: a }) {
11460
11464
  M.iceServers = Ho(t, e), M.wssBase = n, M.wssToken = i, r && (M.wtsBase = r), a && (M.clientType = a);
11461
11465
  }
11462
- _buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
11463
- let s = new URL(e), c = s.searchParams;
11464
- return c.set("userId", String(t)), c.set("entityType", n), c.set("deviceIdx", String(r)), c.set("conversationId", i), c.set("token", a), o?.isp_as_no && c.set("ispAsNo", String(o.isp_as_no)), o?.isp_as_org && c.set("ispAsOrg", o.isp_as_org), o?.loc_cc && c.set("locCc", o.loc_cc), o?.loc_reg && c.set("locReg", o.loc_reg), s.toString();
11466
+ _buildSignalingEndpoint({ baseEndpoint: e, userId: t, externalUserId: n, type: r, deviceIdx: i, conversationId: a, token: o, conversationParams: s }) {
11467
+ let c = new URL(e), l = c.searchParams;
11468
+ return t != null && l.set("userId", String(t)), n && (l.set("externalUserId", n), M.useSelfExternalUserId && (l.delete("userId"), l.delete("entityId"))), l.set("entityType", r), l.set("deviceIdx", String(i)), l.set("conversationId", a), l.set("token", o), s?.isp_as_no && l.set("ispAsNo", String(s.isp_as_no)), s?.isp_as_org && l.set("ispAsOrg", s.isp_as_org), s?.loc_cc && l.set("locCc", s.loc_cc), s?.loc_reg && l.set("locReg", s.loc_reg), c.toString();
11465
11469
  }
11466
11470
  _clearCalleeUnavailableWatchdog() {
11467
11471
  this._calleeUnavailableTimer !== null && (window.clearTimeout(this._calleeUnavailableTimer), this._calleeUnavailableTimer = null);
@@ -11517,10 +11521,27 @@ var Ic = 15, $ = class e extends Xe {
11517
11521
  throw Fc(p.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
11518
11522
  }
11519
11523
  } else m = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", m), ee = "startConversation";
11520
- qo(m, ee), this._applyServerConversation(m.id), this._pendingId = m.id, this._setConversationParams(m), this._stats.lifecycle.bindConversationId(m.id);
11524
+ qo(m, ee), this._applyServerConversation(m.id), this._pendingId = m.id, this._addSelfExternalUserId(m), this._setConversationParams(m), this._stats.lifecycle.bindConversationId(m.id);
11521
11525
  let te = await this._connectSignaling(Cr.START, m);
11522
11526
  return this._throwIfClosed(), this._setConversation(m, te, n), this._stats.lifecycle.markCallStarted(), te;
11523
11527
  }
11528
+ _addSelfExternalUserId(e) {
11529
+ let t = v.selfExternalId?.externalId.id;
11530
+ if (!t) {
11531
+ if (M.useSelfExternalUserId) throw new O(p.UNKNOWN_ERROR, { callError: {
11532
+ scope: "internal",
11533
+ code: "outgoing",
11534
+ description: "user-id-missing"
11535
+ } });
11536
+ return;
11537
+ }
11538
+ e.endpoint = this._addExternalUserIdToEndpoint(e.endpoint, t), e.wt_endpoint = this._addExternalUserIdToEndpoint(e.wt_endpoint, t);
11539
+ }
11540
+ _addExternalUserIdToEndpoint(e, t) {
11541
+ if (!e) return e;
11542
+ let n = new URL(e);
11543
+ return n.searchParams.set("externalUserId", t), M.useSelfExternalUserId && (n.searchParams.delete("userId"), n.searchParams.delete("entityId")), n.toString();
11544
+ }
11524
11545
  async _joinConversation(e) {
11525
11546
  W.setMark(H.SIGNALING_CONNECTED);
11526
11547
  let { conversationId: t, mediaOptions: n, chatId: r, joinLink: i, observedIds: a, payload: o, onFastJoin: s } = e;
@@ -11571,7 +11592,7 @@ var Ic = 15, $ = class e extends Xe {
11571
11592
  code: "join",
11572
11593
  description: "target-missing"
11573
11594
  } });
11574
- if (this._applyServerConversation(l.id), this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), qo(l, u), l.id) {
11595
+ if (this._applyServerConversation(l.id), this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), qo(l, u), this._addSelfExternalUserId(l), l.id) {
11575
11596
  if (z.has(l.id, this)) throw new O(p.HAS_ACTIVE_CALL);
11576
11597
  this._pendingId = l.id;
11577
11598
  }
@@ -11579,23 +11600,23 @@ var Ic = 15, $ = class e extends Xe {
11579
11600
  let d = await this._connectSignaling(Cr.JOIN, l);
11580
11601
  return this._throwIfClosed(), this._setConversation(l, d, _o.JOINING), this._stats.lifecycle.markCallStarted(), d;
11581
11602
  }
11582
- async _prepareConversation(e, t = A.USER, n, r, i) {
11603
+ async _prepareConversation(e, t = A.USER, n, r, i, a) {
11583
11604
  W.setMark(H.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
11584
11605
  conversationId: e,
11585
11606
  type: t,
11586
11607
  peerId: n
11587
11608
  });
11588
- let a = this._api.getUserId();
11589
- if (!a) throw new O(p.UNKNOWN_ERROR, { callError: {
11609
+ let o = M.useSelfExternalUserId ? void 0 : this._api.getUserId();
11610
+ if (!o && !a) throw new O(p.UNKNOWN_ERROR, { callError: {
11590
11611
  scope: "internal",
11591
11612
  code: "incoming",
11592
11613
  description: "user-id-missing"
11593
11614
  } });
11594
- let o = 0, s = "", c = "", l = {
11615
+ let s = 0, c = "", l = "", u = {
11595
11616
  id: e,
11596
11617
  peerId: n,
11597
- endpoint: s,
11598
- wt_endpoint: c,
11618
+ endpoint: c,
11619
+ wt_endpoint: l,
11599
11620
  is_concurrent: !1,
11600
11621
  p2p_forbidden: !1,
11601
11622
  device_idx: 0,
@@ -11603,43 +11624,48 @@ var Ic = 15, $ = class e extends Xe {
11603
11624
  };
11604
11625
  if (r) {
11605
11626
  let n = this._decodeExternalConversationParams(r);
11606
- this._setConversationParams(n), s = i ?? this._buildSignalingEndpoint({
11627
+ this._setConversationParams(n), c = i ?? this._buildSignalingEndpoint({
11607
11628
  baseEndpoint: M.wssBase,
11608
- userId: a,
11629
+ userId: o,
11630
+ externalUserId: a,
11609
11631
  type: t,
11610
- deviceIdx: o,
11632
+ deviceIdx: s,
11611
11633
  conversationId: e,
11612
11634
  token: M.wssToken
11613
- }), l.token = n.token, l.endpoint = s, M.wtsBase && (c = this._buildSignalingEndpoint({
11635
+ }), u.token = n.token, u.endpoint = c, M.wtsBase && (l = this._buildSignalingEndpoint({
11614
11636
  baseEndpoint: M.wtsBase,
11615
- userId: a,
11637
+ userId: o,
11638
+ externalUserId: a,
11616
11639
  type: t,
11617
- deviceIdx: o,
11640
+ deviceIdx: s,
11618
11641
  conversationId: e,
11619
11642
  token: M.wssToken
11620
- }), l.wt_endpoint = c);
11643
+ }), u.wt_endpoint = l);
11621
11644
  } else {
11622
11645
  let n = await this._getConversationParams(e);
11623
- o = n.device_idx || 0, s = i ?? this._buildSignalingEndpoint({
11646
+ s = n.device_idx || 0, c = i ?? this._buildSignalingEndpoint({
11624
11647
  baseEndpoint: M.wssBase,
11625
- userId: a,
11648
+ userId: o,
11649
+ externalUserId: a,
11626
11650
  type: t,
11627
- deviceIdx: o,
11651
+ deviceIdx: s,
11628
11652
  conversationId: e,
11629
11653
  token: M.wssToken,
11630
11654
  conversationParams: n
11631
- }), l.token = n.token, l.endpoint = s, l.device_idx = o, M.wtsBase && (c = this._buildSignalingEndpoint({
11655
+ }), u.token = n.token, u.endpoint = c, u.device_idx = s, M.wtsBase && (l = this._buildSignalingEndpoint({
11632
11656
  baseEndpoint: M.wtsBase,
11633
- userId: a,
11657
+ userId: o,
11658
+ externalUserId: a,
11634
11659
  type: t,
11635
- deviceIdx: o,
11660
+ deviceIdx: s,
11636
11661
  conversationId: e,
11637
11662
  token: M.wssToken,
11638
11663
  conversationParams: n
11639
- }), l.wt_endpoint = c);
11664
+ }), u.wt_endpoint = l);
11640
11665
  }
11641
- let u = await this._connectSignaling(Cr.ACCEPT, l);
11642
- return this._throwIfClosed(), this._setConversation(l, u, _o.INCOMING, t), u;
11666
+ i && a && (u.endpoint = this._addExternalUserIdToEndpoint(u.endpoint, a));
11667
+ let d = await this._connectSignaling(Cr.ACCEPT, u);
11668
+ return this._throwIfClosed(), this._setConversation(u, d, _o.INCOMING, t), d;
11643
11669
  }
11644
11670
  _createParticipant(e, t, n = !0) {
11645
11671
  let r = Object.assign({
@@ -12965,7 +12991,7 @@ var Ic = 15, $ = class e extends Xe {
12965
12991
  Jt(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
12966
12992
  let r = j.mapParticipantState(n), o = a.participantState;
12967
12993
  if (!j.isEqualParticipantState(r, o) && (await this._changeRemoteParticipantState(e, r), !this._conversation)) return;
12968
- ko(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? N.ONHOLD : N.CONNECTED));
12994
+ ko(i, a.roles) || this._onRolesChanged(a.id, i), this._reconcileParticipantHold(a, n);
12969
12995
  } else if (await this._onJoinedParticipant({
12970
12996
  participantId: n.id,
12971
12997
  participant: n,
@@ -13061,11 +13087,10 @@ var Ic = 15, $ = class e extends Xe {
13061
13087
  this._setSessionState(n, { connected: e.connected });
13062
13088
  }
13063
13089
  async _reconcileParticipantSessionStates(e) {
13064
- if (!M.enableSessionStateUpdates || !e.length) return;
13065
13090
  let t = this._participants;
13066
13091
  for (let n of e) {
13067
13092
  let e = j.composeId(n), r = t[e];
13068
- r && !this._isMe(e) && (this._updateParticipantExternalId(r, X.fromSignalingParticipant(n, !0, !0)), this._updateParticipantSessionState(r, e, n.sessionState));
13093
+ r && !this._isMe(e) && (this._reconcileParticipantHold(r, n), M.enableSessionStateUpdates && (this._updateParticipantExternalId(r, X.fromSignalingParticipant(n, !0, !0)), this._updateParticipantSessionState(r, e, n.sessionState)));
13069
13094
  }
13070
13095
  }
13071
13096
  _updateParticipantExternalId(e, t) {
@@ -13835,17 +13860,23 @@ var Ic = 15, $ = class e extends Xe {
13835
13860
  _onVideoSuspendSuggest(e) {
13836
13861
  !this._conversation || this._conversation.topology !== q.SERVER || (this._debug.debug("Video suspend suggested", e), L.onVideoSuspendSuggest(e.bandwidth, this.id));
13837
13862
  }
13838
- async _onParticipantHold(e) {
13863
+ _reconcileParticipantHold(e, t) {
13864
+ !!e.isOnHold != !!t.onHold && this._applyParticipantHold(e, !!t.onHold);
13865
+ }
13866
+ _onParticipantHold(e) {
13839
13867
  this._debug.debug("Participant hold suggested", e);
13840
13868
  let t = this._getParticipant(e.participantId);
13841
13869
  if (!t) {
13842
13870
  this._warnParticipantNotInConversation(e.participantId);
13843
13871
  return;
13844
13872
  }
13845
- if (t.isOnHold = e.hold, this._specListener?.onParticipantHoldChanged(), this._transport?.setRemoteHold(e.hold), e.hold) this._setParticipantsStatus([t], N.ONHOLD), this._transport?.getTopology() === q.DIRECT && this._audioOutput.destroy();
13873
+ this._applyParticipantHold(t, e.hold);
13874
+ }
13875
+ _applyParticipantHold(e, t) {
13876
+ if (e.isOnHold = t, this._specListener?.onParticipantHoldChanged(), this._transport?.setRemoteHold(t), t) this._setParticipantsStatus([e], N.ONHOLD), this._transport?.getTopology() === q.DIRECT && this._audioOutput.destroy();
13846
13877
  else {
13847
- let e = this._transport?.getTopology() === q.DIRECT ? N.CONNECTING : N.CONNECTED;
13848
- this._setParticipantsStatus([t], e);
13878
+ let t = this._transport?.getTopology() === q.DIRECT ? N.CONNECTING : N.CONNECTED;
13879
+ this._setParticipantsStatus([e], t);
13849
13880
  }
13850
13881
  }
13851
13882
  _isMe(e) {
@@ -14473,12 +14504,12 @@ async function hl(e, t = vo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
14473
14504
  conversationId: l
14474
14505
  });
14475
14506
  }
14476
- async function gl(e, t) {
14477
- return _l(e, A.USER, void 0, t);
14507
+ async function gl(e, t, n) {
14508
+ return _l(e, A.USER, void 0, t, void 0, void 0, n);
14478
14509
  }
14479
- async function _l(e, t = A.USER, n, r, i, a) {
14510
+ async function _l(e, t = A.USER, n, r, i, a, o) {
14480
14511
  if (e === $.id()) throw Error("Push has already been processed");
14481
- return new $(new qc(), rl).onPush(e, t, n, r, i, a);
14512
+ return new $(new qc(), rl).onPush(e, t, n, r, i, a, o);
14482
14513
  }
14483
14514
  async function vl() {
14484
14515
  return nl.getInbounds();
@@ -111,7 +111,7 @@ export default class Conversation extends EventEmitter {
111
111
  private _onJoinPart2;
112
112
  private _extractExternalRooms;
113
113
  private _extractExternalRoomsData;
114
- onPush(conversationId: string, type?: UserType, peerId?: number, conversationParams?: string, wsEndpoint?: string, userId?: number): Promise<void>;
114
+ onPush(conversationId: string, type?: UserType, peerId?: number, conversationParams?: string, wsEndpoint?: string, userId?: number, externalUserId?: string): Promise<void>;
115
115
  private _isInWaitingHall;
116
116
  private _isWaitForAdmin;
117
117
  private _isRestricted;
@@ -151,6 +151,8 @@ export default class Conversation extends EventEmitter {
151
151
  * @throws ErrorEvent
152
152
  */
153
153
  private _startConversation;
154
+ private _addSelfExternalUserId;
155
+ private _addExternalUserIdToEndpoint;
154
156
  /**
155
157
  * @throws ErrorEvent
156
158
  */
@@ -465,7 +467,9 @@ export default class Conversation extends EventEmitter {
465
467
  private _onFeedback;
466
468
  private _onDecorativeParticipantIdChanged;
467
469
  private _onVideoSuspendSuggest;
470
+ private _reconcileParticipantHold;
468
471
  private _onParticipantHold;
472
+ private _applyParticipantHold;
469
473
  private _isMe;
470
474
  /**
471
475
  * Сколько человек сейчас в звонке. Считаем только принявших: приглашенные,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/calls-sdk",
3
- "version": "2.8.13-dev.9872d43d.0",
3
+ "version": "2.8.13-dev.a049e4ee.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",
@@ -62,6 +62,8 @@ export type ParamsObject = {
62
62
  /** @hidden */
63
63
  clientType: string;
64
64
  /** @hidden */
65
+ useSelfExternalUserId: boolean;
66
+ /** @hidden */
65
67
  externalUserType: string;
66
68
  /** @hidden */
67
69
  device: string;
@@ -1021,6 +1023,7 @@ export default abstract class Params {
1021
1023
  static get statQueueEnabled(): boolean;
1022
1024
  static get clientType(): string;
1023
1025
  static set clientType(value: string);
1026
+ static get useSelfExternalUserId(): boolean;
1024
1027
  static get externalUserType(): string;
1025
1028
  static set externalUserType(value: string);
1026
1029
  static get device(): string;