@vonage/client-sdk 2.7.2 → 2.7.4

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.
@@ -129,12 +129,6 @@ function requireKotlinKotlinStdlib () {
129
129
  };
130
130
  }(Math.log, Math.LN2);
131
131
  }
132
- if (typeof String.prototype.startsWith === 'undefined') {
133
- Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
134
- position = position || 0;
135
- return this.lastIndexOf(searchString, position) === position;
136
- }});
137
- }
138
132
  if (typeof String.prototype.endsWith === 'undefined') {
139
133
  Object.defineProperty(String.prototype, 'endsWith', {value: function (searchString, position) {
140
134
  var subjectString = this.toString();
@@ -146,6 +140,12 @@ function requireKotlinKotlinStdlib () {
146
140
  return lastIndex !== -1 && lastIndex === position;
147
141
  }});
148
142
  }
143
+ if (typeof String.prototype.startsWith === 'undefined') {
144
+ Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
145
+ position = position || 0;
146
+ return this.lastIndexOf(searchString, position) === position;
147
+ }});
148
+ }
149
149
  //endregion
150
150
  (function (factory) {
151
151
  factory(module.exports);
@@ -25107,9 +25107,6 @@ function requireClientsdkClientcore () {
25107
25107
  initMetadataForCompanion(Companion_150);
25108
25108
  initMetadataForObject($serializer_173, '$serializer', VOID, VOID, [GeneratedSerializer]);
25109
25109
  initMetadataForClass(SessionTerminatedEvent, 'SessionTerminatedEvent', VOID, VOID, [SocketEvent], VOID, VOID, {0: $serializer_getInstance_173});
25110
- function onConversationEvent(event) {
25111
- }
25112
- initMetadataForInterface(ConversationEventListener, 'ConversationEventListener');
25113
25110
  function onRTCHangup(conversationId, legId, hangup) {
25114
25111
  }
25115
25112
  function onRTCTransfer(conversationId, legId) {
@@ -25126,7 +25123,10 @@ function requireClientsdkClientcore () {
25126
25123
  function onAudioDTMFUpdate(conversationId, legId, digits) {
25127
25124
  }
25128
25125
  initMetadataForInterface(AudioEventListener, 'AudioEventListener');
25129
- initMetadataForClass(ChatAPIImpl$1, VOID, VOID, VOID, [ConversationEventListener, RTCEventListener, AudioEventListener]);
25126
+ function onConversationEvent(event) {
25127
+ }
25128
+ initMetadataForInterface(ConversationEventListener, 'ConversationEventListener');
25129
+ initMetadataForClass(ChatAPIImpl$1, VOID, VOID, VOID, [RTCEventListener, AudioEventListener, ConversationEventListener]);
25130
25130
  initMetadataForClass(ChatAPIImpl, 'ChatAPIImpl', VOID, VOID, [ChatAPI]);
25131
25131
  initMetadataForClass(LoggingLevel, 'LoggingLevel', VOID, Enum);
25132
25132
  initMetadataForObject(DefaultConfig, 'DefaultConfig');
@@ -25265,7 +25265,7 @@ function requireClientsdkClientcore () {
25265
25265
  initMetadataForClass(HangupReason, 'HangupReason', VOID, Enum);
25266
25266
  initMetadataForClass(LegStatus, 'LegStatus', VOID, Enum);
25267
25267
  initMetadataForClass(CallDisconnectReason, 'CallDisconnectReason', VOID, Enum);
25268
- initMetadataForClass(VoiceAPIImpl$1, VOID, VOID, VOID, [ConversationEventListener, RTCEventListener, AudioEventListener]);
25268
+ initMetadataForClass(VoiceAPIImpl$1, VOID, VOID, VOID, [RTCEventListener, AudioEventListener, ConversationEventListener]);
25269
25269
  initMetadataForClass(VoiceAPIImpl, 'VoiceAPIImpl');
25270
25270
  initMetadataForInterface(CallEvent, 'CallEvent');
25271
25271
  initMetadataForClass(SetupOutboundCall, 'SetupOutboundCall', VOID, VOID, [CallEvent]);
@@ -25494,7 +25494,7 @@ function requireClientsdkClientcore () {
25494
25494
  initMetadataForClass(runAfterDelay$1);
25495
25495
  //endregion
25496
25496
  function BuildKonfig() {
25497
- this.i1i_1 = '2.7.2';
25497
+ this.i1i_1 = '2.7.4';
25498
25498
  }
25499
25499
  var BuildKonfig_instance;
25500
25500
  function EmergencyCallOptions(ringbackTone) {
@@ -61904,6 +61904,16 @@ function requireClientsdkClientcore () {
61904
61904
  return Unit_instance;
61905
61905
  };
61906
61906
  }
61907
+ function VoiceAPIImpl$serverCall$lambda(this$0, $context, $callback) {
61908
+ return function () {
61909
+ var session = this$0.k3q_1.e1j(getKClass(SessionReducer)).a2c_1.c2();
61910
+ if (!(session instanceof Active_0)) {
61911
+ return false;
61912
+ }
61913
+ attemptOutboundCall(this$0, session.a36_1.y3c_1, session.z35_1, $context, 1, null, $callback);
61914
+ return true;
61915
+ };
61916
+ }
61907
61917
  function VoiceAPIImpl$attemptOutboundCall$lambda$lambda$lambda$lambda(this$0, $call, $callback, $legId, $sessionId) {
61908
61918
  return function (it) {
61909
61919
  if (it instanceof Exception) {
@@ -63169,12 +63179,10 @@ function requireClientsdkClientcore () {
63169
63179
  return withCoreLock(VoiceAPIImpl$getCallLegs$lambda(this, callback, callId, parameters));
63170
63180
  };
63171
63181
  protoOf(VoiceAPIImpl).t1q = function (context, callback) {
63172
- var session = this.k3q_1.e1j(getKClass(SessionReducer)).a2c_1.c2();
63173
- if (!(session instanceof Active_0)) {
63182
+ var started = withCoreLock(VoiceAPIImpl$serverCall$lambda(this, context, callback));
63183
+ if (!started) {
63174
63184
  invokeCallbackWithError(new SessionNoActiveSessionError(), callback);
63175
- return Unit_instance;
63176
63185
  }
63177
- attemptOutboundCall(this, session.a36_1.y3c_1, session.z35_1, context, 1, null, callback);
63178
63186
  };
63179
63187
  protoOf(VoiceAPIImpl).u1q = function (callId, callback) {
63180
63188
  return withCoreLock(VoiceAPIImpl$reconnectCall$lambda(this, callback, callId));
@@ -86118,6 +86126,11 @@ function pcSetupEventOfSignalingState(state) {
86118
86126
  class MediaClient {
86119
86127
  constructor() {
86120
86128
  this.pcs = new Map();
86129
+ /**
86130
+ * Per leg, so a second leg (a transfer) collects stats too and one leg ending cannot stop
86131
+ * collection for the others.
86132
+ */
86133
+ this.statsTimers = new Map();
86121
86134
  this.pcListeners = new WeakMap();
86122
86135
  this.audio = undefined;
86123
86136
  }
@@ -86142,18 +86155,28 @@ class MediaClient {
86142
86155
  if (!pc) {
86143
86156
  return closure(new clientsdkClientcore_jsExports.vonage.PeerConnectionNotFoundJS(id));
86144
86157
  }
86145
- this.intervalId = setInterval(() => {
86158
+ if (this.statsTimers.has(id)) {
86159
+ return closure(null);
86160
+ }
86161
+ this.statsTimers.set(id, setInterval(() => {
86146
86162
  if (pc.connectionState != 'connected') {
86147
- clearTimeout(this.intervalId);
86163
+ this.stopRtcStatsCollection(id);
86148
86164
  return;
86149
86165
  }
86150
86166
  pc.getStats().then((result) => {
86151
86167
  var _a;
86152
86168
  (_a = this.delegate) === null || _a === void 0 ? void 0 : _a.onRawRtcStats(id, toRawRtcStats(result));
86153
86169
  });
86154
- }, interval);
86170
+ }, interval));
86155
86171
  closure(null);
86156
86172
  }
86173
+ stopRtcStatsCollection(id) {
86174
+ const timer = this.statsTimers.get(id);
86175
+ if (timer !== undefined) {
86176
+ clearInterval(timer);
86177
+ this.statsTimers.delete(id);
86178
+ }
86179
+ }
86157
86180
  enableMediaInbound(rtcId, offerSDP, closure) {
86158
86181
  return __awaiter(this, void 0, void 0, function* () {
86159
86182
  try {
@@ -86325,6 +86348,7 @@ class MediaClient {
86325
86348
  return closure(null);
86326
86349
  }
86327
86350
  this.pcs.delete(id); // Remove from map before closing connection so size check in closePeerConnection is accurate
86351
+ this.stopRtcStatsCollection(id);
86328
86352
  // trigger state change manually
86329
86353
  (_a = this.delegate) === null || _a === void 0 ? void 0 : _a.onConnectionChange(id, 'closed');
86330
86354
  this.closePeerConnection(pc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vonage/client-sdk",
3
- "version": "2.7.2",
3
+ "version": "2.7.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "dist/client/index.mjs",