quickblox 2.21.1 → 2.21.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quickblox",
3
3
  "description": "QuickBlox JavaScript SDK",
4
- "version": "2.21.1",
4
+ "version": "2.21.2",
5
5
  "homepage": "https://quickblox.com/developers/Javascript",
6
6
  "main": "src/qbMain.js",
7
7
  "types": "quickblox.d.ts",
package/quickblox.d.ts CHANGED
@@ -116,6 +116,12 @@ export declare interface QBConfig {
116
116
  * Set the number of seconds for the statistical information to be received.
117
117
  */
118
118
  statsReportTimeInterval?: boolean
119
+ /**
120
+ * Transport policy for ICE candidate gathering.
121
+ * Mirrors RTCPeerConnection. Allowed: "all" | "relay".
122
+ * When "relay", only TURN-relayed candidates will be used.
123
+ */
124
+ iceTransportPolicy?: 'all' | 'relay'
119
125
  /**
120
126
  * You can customize a list of ICE servers. By default,
121
127
  * WebRTC module will use internal ICE servers that are usually enough,
@@ -268,7 +274,7 @@ export declare interface ChatMessageAttachment {
268
274
  duration?: string | number
269
275
  /* Custom parameters. Useful for storing metadata of attachment */
270
276
  data?: string
271
- [key: string]: string | undefined
277
+ [key: string]: string | number | undefined
272
278
  }
273
279
 
274
280
  declare enum QBChatDialogType {
@@ -411,7 +417,7 @@ export declare interface QBChatXMPPMessage {
411
417
  date_sent: string
412
418
  save_to_history: string
413
419
  attachments?: ChatMessageAttachment[]
414
- [custom_field_N: string]: string | ChatMessageAttachment[]
420
+ [custom_field_N: string]: string
415
421
  }
416
422
  }
417
423
 
@@ -1326,6 +1332,7 @@ export declare interface QBWebRTCModule {
1326
1332
  session: QBWebRTCSession,
1327
1333
  userId: QBUser['id'],
1328
1334
  stats: any,
1335
+ error?: unknown,
1329
1336
  ) => void
1330
1337
  onRejectCallListener?: (
1331
1338
  session: QBWebRTCSession,
package/quickblox.js CHANGED
@@ -54154,9 +54154,14 @@ WebRTCSession.prototype._createPeer = function (userId, polite) {
54154
54154
 
54155
54155
  this.startCallTime = new Date();
54156
54156
 
54157
- var pcConfig = {
54158
- iceServers: config.webrtc.iceServers,
54159
- };
54157
+ // var pcConfig = {
54158
+ // iceServers: config.webrtc.iceServers,
54159
+ // };
54160
+ const base = { iceServers: config.webrtc.iceServers };
54161
+ const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
54162
+ : { iceTransportPolicy: config.webrtc.iceTransportPolicy };
54163
+
54164
+ const pcConfig = Object.assign({}, base, extra);
54160
54165
 
54161
54166
  Helpers.trace("_createPeer configuration: " + JSON.stringify(pcConfig));
54162
54167
 
@@ -54321,9 +54326,14 @@ WebRTCSession.prototype._reconnect = function (peerConnection, negotiate) {
54321
54326
 
54322
54327
  peerConnection.release();
54323
54328
 
54324
- var pcConfig = {
54325
- iceServers: config.webrtc.iceServers,
54326
- };
54329
+ // var pcConfig = {
54330
+ // iceServers: config.webrtc.iceServers,
54331
+ // };
54332
+ const base = { iceServers: config.webrtc.iceServers };
54333
+ const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
54334
+ : { iceTransportPolicy: config.webrtc.iceTransportPolicy };
54335
+
54336
+ const pcConfig = Object.assign({}, base, extra);
54327
54337
 
54328
54338
  Helpers.trace("_reconnect peer configuration: " + JSON.stringify(pcConfig));
54329
54339
 
@@ -55118,8 +55128,8 @@ module.exports = StreamManagement;
55118
55128
  */
55119
55129
 
55120
55130
  var config = {
55121
- version: '2.21.1-alpha.1',
55122
- buildNumber: '1168',
55131
+ version: '2.21.2',
55132
+ buildNumber: '1169',
55123
55133
  creds: {
55124
55134
  'appId': 0,
55125
55135
  'authKey': '',
@@ -55153,6 +55163,12 @@ var config = {
55153
55163
  dialingTimeInterval: 5,
55154
55164
  disconnectTimeInterval: 30,
55155
55165
  statsReportTimeInterval: false,
55166
+ /**
55167
+ * ICE transport policy.
55168
+ * If undefined -> do not pass this option into RTCPeerConnection.
55169
+ * Allowed values when set: "all" | "relay".
55170
+ */
55171
+ iceTransportPolicy: undefined,
55156
55172
  iceServers: [
55157
55173
  {
55158
55174
  urls: ['turn:turn.quickblox.com', 'stun:turn.quickblox.com'],
@@ -55191,33 +55207,49 @@ var config = {
55191
55207
  callBackInterval: 30,
55192
55208
  };
55193
55209
 
55194
- config.set = function(options) {
55195
- if (typeof options.endpoints === 'object' && options.endpoints.chat) {
55196
- config.endpoints.muc = 'muc.'+options.endpoints.chat;
55197
- config.chatProtocol.bosh = 'https://'+options.endpoints.chat+':5281';
55198
- config.chatProtocol.websocket = 'wss://'+options.endpoints.chat+':5291';
55199
- }
55200
-
55201
- Object.keys(options).forEach(function(key) {
55202
- if(key !== 'set' && config.hasOwnProperty(key)) {
55203
- if(typeof options[key] !== 'object') {
55204
- config[key] = options[key];
55205
- } else {
55206
- Object.keys(options[key]).forEach(function(nextkey) {
55207
- if(config[key].hasOwnProperty(nextkey)){
55208
- config[key][nextkey] = options[key][nextkey];
55209
- }
55210
- });
55211
- }
55210
+ config.set = function (options) {
55211
+ // Update chat endpoints (same behavior as before)
55212
+ if (typeof options.endpoints === 'object' && options.endpoints.chat) {
55213
+ config.endpoints.muc = 'muc.' + options.endpoints.chat;
55214
+ config.chatProtocol.bosh = 'https://' + options.endpoints.chat + ':5281';
55215
+ config.chatProtocol.websocket = 'wss://' + options.endpoints.chat + ':5291';
55212
55216
  }
55213
55217
 
55214
- // backward compatibility: for config.iceServers
55215
- if(key === 'iceServers') {
55216
- config.webrtc.iceServers = options[key];
55217
- }
55218
- });
55218
+ // Shallow merge: copy only known keys; skip undefined values
55219
+ Object.keys(options).forEach(function (key) {
55220
+ if (key !== 'set' && Object.prototype.hasOwnProperty.call(config, key)) {
55221
+ if (typeof options[key] !== 'object' || options[key] === null) {
55222
+ // Primitive or null: assign as is
55223
+ if (typeof options[key] !== 'undefined') {
55224
+ config[key] = options[key];
55225
+ }
55226
+ } else {
55227
+ // Object: copy only known subkeys; skip undefined values
55228
+ Object.keys(options[key]).forEach(function (nextkey) {
55229
+ if (
55230
+ Object.prototype.hasOwnProperty.call(config[key], nextkey) &&
55231
+ typeof options[key][nextkey] !== 'undefined'
55232
+ ) {
55233
+ config[key][nextkey] = options[key][nextkey];
55234
+ }
55235
+ });
55236
+ }
55237
+ }
55238
+
55239
+ // Backward compatibility: allow top-level iceServers
55240
+ if (key === 'iceServers' && typeof options[key] !== 'undefined') {
55241
+ config.webrtc.iceServers = options[key];
55242
+ }
55243
+
55244
+ // Backward compatibility: allow top-level iceTransportPolicy
55245
+ if (key === 'iceTransportPolicy' && typeof options[key] !== 'undefined') {
55246
+ // Allowed values when set: "all" | "relay"
55247
+ config.webrtc.iceTransportPolicy = options[key];
55248
+ }
55249
+ });
55219
55250
  };
55220
55251
 
55252
+
55221
55253
  config.updateSessionExpirationDate = function (tokenExpirationDate, headerHasToken = false) {
55222
55254
  var connectionTimeLag = 1; // minute
55223
55255
  var newDate;
@@ -901,9 +901,14 @@ WebRTCSession.prototype._createPeer = function (userId, polite) {
901
901
 
902
902
  this.startCallTime = new Date();
903
903
 
904
- var pcConfig = {
905
- iceServers: config.webrtc.iceServers,
906
- };
904
+ // var pcConfig = {
905
+ // iceServers: config.webrtc.iceServers,
906
+ // };
907
+ const base = { iceServers: config.webrtc.iceServers };
908
+ const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
909
+ : { iceTransportPolicy: config.webrtc.iceTransportPolicy };
910
+
911
+ const pcConfig = Object.assign({}, base, extra);
907
912
 
908
913
  Helpers.trace("_createPeer configuration: " + JSON.stringify(pcConfig));
909
914
 
@@ -1068,9 +1073,14 @@ WebRTCSession.prototype._reconnect = function (peerConnection, negotiate) {
1068
1073
 
1069
1074
  peerConnection.release();
1070
1075
 
1071
- var pcConfig = {
1072
- iceServers: config.webrtc.iceServers,
1073
- };
1076
+ // var pcConfig = {
1077
+ // iceServers: config.webrtc.iceServers,
1078
+ // };
1079
+ const base = { iceServers: config.webrtc.iceServers };
1080
+ const extra = (typeof config.webrtc.iceTransportPolicy === 'undefined') ? {}
1081
+ : { iceTransportPolicy: config.webrtc.iceTransportPolicy };
1082
+
1083
+ const pcConfig = Object.assign({}, base, extra);
1074
1084
 
1075
1085
  Helpers.trace("_reconnect peer configuration: " + JSON.stringify(pcConfig));
1076
1086
 
package/src/qbConfig.js CHANGED
@@ -12,8 +12,8 @@
12
12
  */
13
13
 
14
14
  var config = {
15
- version: '2.21.1-alpha.1',
16
- buildNumber: '1168',
15
+ version: '2.21.2',
16
+ buildNumber: '1169',
17
17
  creds: {
18
18
  'appId': 0,
19
19
  'authKey': '',
@@ -47,6 +47,12 @@ var config = {
47
47
  dialingTimeInterval: 5,
48
48
  disconnectTimeInterval: 30,
49
49
  statsReportTimeInterval: false,
50
+ /**
51
+ * ICE transport policy.
52
+ * If undefined -> do not pass this option into RTCPeerConnection.
53
+ * Allowed values when set: "all" | "relay".
54
+ */
55
+ iceTransportPolicy: undefined,
50
56
  iceServers: [
51
57
  {
52
58
  urls: ['turn:turn.quickblox.com', 'stun:turn.quickblox.com'],
@@ -85,33 +91,49 @@ var config = {
85
91
  callBackInterval: 30,
86
92
  };
87
93
 
88
- config.set = function(options) {
89
- if (typeof options.endpoints === 'object' && options.endpoints.chat) {
90
- config.endpoints.muc = 'muc.'+options.endpoints.chat;
91
- config.chatProtocol.bosh = 'https://'+options.endpoints.chat+':5281';
92
- config.chatProtocol.websocket = 'wss://'+options.endpoints.chat+':5291';
93
- }
94
-
95
- Object.keys(options).forEach(function(key) {
96
- if(key !== 'set' && config.hasOwnProperty(key)) {
97
- if(typeof options[key] !== 'object') {
98
- config[key] = options[key];
99
- } else {
100
- Object.keys(options[key]).forEach(function(nextkey) {
101
- if(config[key].hasOwnProperty(nextkey)){
102
- config[key][nextkey] = options[key][nextkey];
103
- }
104
- });
105
- }
94
+ config.set = function (options) {
95
+ // Update chat endpoints (same behavior as before)
96
+ if (typeof options.endpoints === 'object' && options.endpoints.chat) {
97
+ config.endpoints.muc = 'muc.' + options.endpoints.chat;
98
+ config.chatProtocol.bosh = 'https://' + options.endpoints.chat + ':5281';
99
+ config.chatProtocol.websocket = 'wss://' + options.endpoints.chat + ':5291';
106
100
  }
107
101
 
108
- // backward compatibility: for config.iceServers
109
- if(key === 'iceServers') {
110
- config.webrtc.iceServers = options[key];
111
- }
112
- });
102
+ // Shallow merge: copy only known keys; skip undefined values
103
+ Object.keys(options).forEach(function (key) {
104
+ if (key !== 'set' && Object.prototype.hasOwnProperty.call(config, key)) {
105
+ if (typeof options[key] !== 'object' || options[key] === null) {
106
+ // Primitive or null: assign as is
107
+ if (typeof options[key] !== 'undefined') {
108
+ config[key] = options[key];
109
+ }
110
+ } else {
111
+ // Object: copy only known subkeys; skip undefined values
112
+ Object.keys(options[key]).forEach(function (nextkey) {
113
+ if (
114
+ Object.prototype.hasOwnProperty.call(config[key], nextkey) &&
115
+ typeof options[key][nextkey] !== 'undefined'
116
+ ) {
117
+ config[key][nextkey] = options[key][nextkey];
118
+ }
119
+ });
120
+ }
121
+ }
122
+
123
+ // Backward compatibility: allow top-level iceServers
124
+ if (key === 'iceServers' && typeof options[key] !== 'undefined') {
125
+ config.webrtc.iceServers = options[key];
126
+ }
127
+
128
+ // Backward compatibility: allow top-level iceTransportPolicy
129
+ if (key === 'iceTransportPolicy' && typeof options[key] !== 'undefined') {
130
+ // Allowed values when set: "all" | "relay"
131
+ config.webrtc.iceTransportPolicy = options[key];
132
+ }
133
+ });
113
134
  };
114
135
 
136
+
115
137
  config.updateSessionExpirationDate = function (tokenExpirationDate, headerHasToken = false) {
116
138
  var connectionTimeLag = 1; // minute
117
139
  var newDate;