@wazo/sdk 0.38.8 → 0.38.11

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.
Files changed (78) hide show
  1. package/dist/wazo-sdk.js +2 -2
  2. package/esm/__tests__/api-client.test.js +21 -0
  3. package/esm/__tests__/web-rtc-client.test.js +31 -6
  4. package/esm/api/auth.js +12 -0
  5. package/esm/api/ctid-ng.js +1 -0
  6. package/esm/api-client.js +21 -0
  7. package/esm/checker/Checker.js +31 -6
  8. package/esm/checker/checks/aor.js +21 -0
  9. package/esm/checker/checks/api.js +21 -0
  10. package/esm/checker/checks/index.js +31 -6
  11. package/esm/checker/checks/webrtc-transport.js +31 -6
  12. package/esm/checker/checks/webrtc.js +31 -6
  13. package/esm/domain/AdHocAPIConference.js +28 -2
  14. package/esm/domain/Features.js +28 -2
  15. package/esm/domain/Phone/CTIPhone.js +28 -2
  16. package/esm/domain/Phone/WebRTCPhone.js +4 -5
  17. package/esm/index.js +86 -17
  18. package/esm/service/CallApi.js +28 -2
  19. package/esm/service/getApiClient.js +34 -3
  20. package/esm/simple/Auth.js +87 -18
  21. package/esm/simple/Configuration.js +86 -17
  22. package/esm/simple/Directory.js +28 -2
  23. package/esm/simple/Phone.js +86 -17
  24. package/esm/simple/Softphone.js +5 -0
  25. package/esm/simple/index.js +86 -17
  26. package/esm/simple/room/LocalParticipant.js +86 -17
  27. package/esm/simple/room/Participant.js +86 -17
  28. package/esm/simple/room/RemoteParticipant.js +86 -17
  29. package/esm/simple/room/Room.js +86 -17
  30. package/esm/simple/room/SipRoom.js +86 -17
  31. package/esm/simple/room/Stream.js +86 -17
  32. package/esm/simple/room/__tests__/Participant.test.js +86 -17
  33. package/esm/simple/room/__tests__/RemoteParticipant.test.js +86 -17
  34. package/esm/simple/utils.js +86 -17
  35. package/esm/web-rtc-client.js +31 -6
  36. package/lib/__tests__/api-client.test.js +21 -0
  37. package/lib/__tests__/web-rtc-client.test.js +31 -6
  38. package/lib/api/auth.js +12 -0
  39. package/lib/api/ctid-ng.js +1 -0
  40. package/lib/api-client.js +21 -0
  41. package/lib/checker/Checker.js +31 -6
  42. package/lib/checker/checks/aor.js +21 -0
  43. package/lib/checker/checks/api.js +21 -0
  44. package/lib/checker/checks/index.js +31 -6
  45. package/lib/checker/checks/webrtc-transport.js +31 -6
  46. package/lib/checker/checks/webrtc.js +31 -6
  47. package/lib/domain/AdHocAPIConference.js +28 -2
  48. package/lib/domain/Features.js +28 -2
  49. package/lib/domain/Phone/CTIPhone.js +28 -2
  50. package/lib/domain/Phone/WebRTCPhone.js +4 -5
  51. package/lib/index.js +86 -17
  52. package/lib/service/CallApi.js +28 -2
  53. package/lib/service/getApiClient.js +34 -2
  54. package/lib/simple/Auth.js +87 -17
  55. package/lib/simple/Configuration.js +86 -17
  56. package/lib/simple/Directory.js +28 -2
  57. package/lib/simple/Phone.js +86 -17
  58. package/lib/simple/Softphone.js +5 -0
  59. package/lib/simple/index.js +86 -17
  60. package/lib/simple/room/LocalParticipant.js +86 -17
  61. package/lib/simple/room/Participant.js +86 -17
  62. package/lib/simple/room/RemoteParticipant.js +86 -17
  63. package/lib/simple/room/Room.js +86 -17
  64. package/lib/simple/room/SipRoom.js +86 -17
  65. package/lib/simple/room/Stream.js +86 -17
  66. package/lib/simple/room/__tests__/Participant.test.js +86 -17
  67. package/lib/simple/room/__tests__/RemoteParticipant.test.js +86 -17
  68. package/lib/simple/utils.js +86 -17
  69. package/lib/web-rtc-client.js +31 -6
  70. package/package.json +2 -2
  71. package/src/api/auth.js +12 -0
  72. package/src/api-client.js +8 -0
  73. package/src/domain/Phone/WebRTCPhone.js +3 -5
  74. package/src/service/getApiClient.js +13 -2
  75. package/src/simple/Auth.js +35 -4
  76. package/src/simple/Softphone.js +5 -0
  77. package/src/simple/index.js +2 -1
  78. package/src/web-rtc-client.js +10 -6
@@ -2795,6 +2795,7 @@ var authMethods = (client , baseUrl ) => ({
2795
2795
 
2796
2796
 
2797
2797
 
2798
+
2798
2799
  ) {
2799
2800
  const body = {
2800
2801
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2815,9 +2816,14 @@ var authMethods = (client , baseUrl ) => ({
2815
2816
  }
2816
2817
 
2817
2818
  if (params.tenantId) {
2819
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2818
2820
  body.tenant_id = params.tenantId;
2819
2821
  }
2820
2822
 
2823
+ if (params.domainName) {
2824
+ body.domain_name = params.domainName;
2825
+ }
2826
+
2821
2827
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2822
2828
  },
2823
2829
 
@@ -2830,6 +2836,7 @@ var authMethods = (client , baseUrl ) => ({
2830
2836
  expiration ,
2831
2837
  isMobile = false,
2832
2838
  tenantId ,
2839
+ domainName ,
2833
2840
  ) => {
2834
2841
  const body = {
2835
2842
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2839,9 +2846,14 @@ var authMethods = (client , baseUrl ) => ({
2839
2846
  };
2840
2847
 
2841
2848
  if (tenantId) {
2849
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2842
2850
  body.tenant_id = tenantId;
2843
2851
  }
2844
2852
 
2853
+ if (domainName) {
2854
+ body.domain_name = domainName;
2855
+ }
2856
+
2845
2857
  const headers = {
2846
2858
  'Content-Type': 'application/json',
2847
2859
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4268,6 +4280,7 @@ global.wazoClientId = global.wazoClientId || {};
4268
4280
  global.wazoClientToken = global.wazoClientToken || {};
4269
4281
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4270
4282
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4283
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4271
4284
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4272
4285
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4273
4286
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -5327,6 +5340,7 @@ class ApiClient {
5327
5340
 
5328
5341
 
5329
5342
 
5343
+
5330
5344
 
5331
5345
 
5332
5346
 
@@ -5368,6 +5382,7 @@ class ApiClient {
5368
5382
  refreshToken: this.refreshToken,
5369
5383
  refreshBackend: this.refreshBackend,
5370
5384
  refreshTenantId: this.refreshTenantId,
5385
+ refreshDomainName: this.refreshDomainName,
5371
5386
  refreshExpiration: this.refreshExpiration,
5372
5387
  isMobile: this.isMobile,
5373
5388
  });
@@ -5383,6 +5398,7 @@ class ApiClient {
5383
5398
  this.refreshExpiration,
5384
5399
  this.isMobile,
5385
5400
  this.refreshTenantId,
5401
+ this.refreshDomainName,
5386
5402
  );
5387
5403
 
5388
5404
  logger$1.info('token refreshed', { token: session.token });
@@ -5436,9 +5452,14 @@ class ApiClient {
5436
5452
  }
5437
5453
 
5438
5454
  setRefreshTenantId(tenantId ) {
5455
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
5439
5456
  this.refreshTenantId = tenantId;
5440
5457
  }
5441
5458
 
5459
+ setRefreshDomainName(domainName ) {
5460
+ this.refreshDomainName = domainName;
5461
+ }
5462
+
5442
5463
  setIsMobile(isMobile ) {
5443
5464
  this.isMobile = isMobile;
5444
5465
  }
@@ -6397,9 +6418,11 @@ class WebRTCClient extends Emitter {
6397
6418
  const videoTracks = localStream.getVideoTracks();
6398
6419
 
6399
6420
  // Remove video senders
6400
- pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
6401
- videoSender.replaceTrack(null);
6402
- });
6421
+ if (pc.getSenders) {
6422
+ pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
6423
+ videoSender.replaceTrack(null);
6424
+ });
6425
+ }
6403
6426
 
6404
6427
  videoTracks.forEach(videoTrack => {
6405
6428
  videoTrack.enabled = false;
@@ -6632,7 +6655,8 @@ class WebRTCClient extends Emitter {
6632
6655
  const constraints = { audio: { deviceId: { exact: deviceId } } };
6633
6656
  const stream = await navigator.mediaDevices.getUserMedia(constraints);
6634
6657
  const audioTrack = stream.getAudioTracks()[0];
6635
- const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
6658
+ const sender = pc && pc.getSenders
6659
+ && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
6636
6660
 
6637
6661
  if (sender) {
6638
6662
  if (sender.track) {
@@ -6695,10 +6719,11 @@ class WebRTCClient extends Emitter {
6695
6719
  // $FlowFixMe
6696
6720
  return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
6697
6721
  const videoTrack = stream.getVideoTracks()[0];
6698
- let sender = pc && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
6722
+ let sender = pc && pc.getSenders
6723
+ && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
6699
6724
  let wasTrackEnabled = false;
6700
6725
  if (!sender) {
6701
- sender = pc && pc.getSenders().find(s => !s.track);
6726
+ sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
6702
6727
  }
6703
6728
 
6704
6729
  if (sender) {
@@ -2430,6 +2430,7 @@ var authMethods = (client , baseUrl ) => ({
2430
2430
 
2431
2431
 
2432
2432
 
2433
+
2433
2434
  ) {
2434
2435
  const body = {
2435
2436
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2450,9 +2451,14 @@ var authMethods = (client , baseUrl ) => ({
2450
2451
  }
2451
2452
 
2452
2453
  if (params.tenantId) {
2454
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2453
2455
  body.tenant_id = params.tenantId;
2454
2456
  }
2455
2457
 
2458
+ if (params.domainName) {
2459
+ body.domain_name = params.domainName;
2460
+ }
2461
+
2456
2462
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2457
2463
  },
2458
2464
 
@@ -2465,6 +2471,7 @@ var authMethods = (client , baseUrl ) => ({
2465
2471
  expiration ,
2466
2472
  isMobile = false,
2467
2473
  tenantId ,
2474
+ domainName ,
2468
2475
  ) => {
2469
2476
  const body = {
2470
2477
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2474,9 +2481,14 @@ var authMethods = (client , baseUrl ) => ({
2474
2481
  };
2475
2482
 
2476
2483
  if (tenantId) {
2484
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2477
2485
  body.tenant_id = tenantId;
2478
2486
  }
2479
2487
 
2488
+ if (domainName) {
2489
+ body.domain_name = domainName;
2490
+ }
2491
+
2480
2492
  const headers = {
2481
2493
  'Content-Type': 'application/json',
2482
2494
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4730,6 +4742,7 @@ class ApiClient {
4730
4742
 
4731
4743
 
4732
4744
 
4745
+
4733
4746
 
4734
4747
 
4735
4748
 
@@ -4771,6 +4784,7 @@ class ApiClient {
4771
4784
  refreshToken: this.refreshToken,
4772
4785
  refreshBackend: this.refreshBackend,
4773
4786
  refreshTenantId: this.refreshTenantId,
4787
+ refreshDomainName: this.refreshDomainName,
4774
4788
  refreshExpiration: this.refreshExpiration,
4775
4789
  isMobile: this.isMobile,
4776
4790
  });
@@ -4786,6 +4800,7 @@ class ApiClient {
4786
4800
  this.refreshExpiration,
4787
4801
  this.isMobile,
4788
4802
  this.refreshTenantId,
4803
+ this.refreshDomainName,
4789
4804
  );
4790
4805
 
4791
4806
  logger.info('token refreshed', { token: session.token });
@@ -4839,9 +4854,14 @@ class ApiClient {
4839
4854
  }
4840
4855
 
4841
4856
  setRefreshTenantId(tenantId ) {
4857
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4842
4858
  this.refreshTenantId = tenantId;
4843
4859
  }
4844
4860
 
4861
+ setRefreshDomainName(domainName ) {
4862
+ this.refreshDomainName = domainName;
4863
+ }
4864
+
4845
4865
  setIsMobile(isMobile ) {
4846
4866
  this.isMobile = isMobile;
4847
4867
  }
@@ -4866,6 +4886,7 @@ global.wazoClientId = global.wazoClientId || {};
4866
4886
  global.wazoClientToken = global.wazoClientToken || {};
4867
4887
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4868
4888
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4889
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4869
4890
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4870
4891
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4871
4892
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4875,6 +4896,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
4875
4896
 
4876
4897
  const fillClient = (apiClient ) => {
4877
4898
  const { server, token, clientId } = apiClient.client;
4899
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
4878
4900
 
4879
4901
  // try with null server when dealing with non-related server info
4880
4902
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -4883,8 +4905,12 @@ const fillClient = (apiClient ) => {
4883
4905
 
4884
4906
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
4885
4907
 
4886
- apiClient.setRefreshTenantId(
4887
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
4908
+ if (tenantId) {
4909
+ apiClient.setRefreshTenantId(tenantId);
4910
+ }
4911
+
4912
+ apiClient.setRefreshDomainName(
4913
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
4888
4914
  );
4889
4915
 
4890
4916
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -2217,6 +2217,7 @@ var authMethods = (client , baseUrl ) => ({
2217
2217
 
2218
2218
 
2219
2219
 
2220
+
2220
2221
  ) {
2221
2222
  const body = {
2222
2223
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2237,9 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
2237
2238
  }
2238
2239
 
2239
2240
  if (params.tenantId) {
2241
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2240
2242
  body.tenant_id = params.tenantId;
2241
2243
  }
2242
2244
 
2245
+ if (params.domainName) {
2246
+ body.domain_name = params.domainName;
2247
+ }
2248
+
2243
2249
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2244
2250
  },
2245
2251
 
@@ -2252,6 +2258,7 @@ var authMethods = (client , baseUrl ) => ({
2252
2258
  expiration ,
2253
2259
  isMobile = false,
2254
2260
  tenantId ,
2261
+ domainName ,
2255
2262
  ) => {
2256
2263
  const body = {
2257
2264
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2261,9 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
2261
2268
  };
2262
2269
 
2263
2270
  if (tenantId) {
2271
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2264
2272
  body.tenant_id = tenantId;
2265
2273
  }
2266
2274
 
2275
+ if (domainName) {
2276
+ body.domain_name = domainName;
2277
+ }
2278
+
2267
2279
  const headers = {
2268
2280
  'Content-Type': 'application/json',
2269
2281
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4732,6 +4744,7 @@ class ApiClient {
4732
4744
 
4733
4745
 
4734
4746
 
4747
+
4735
4748
 
4736
4749
 
4737
4750
 
@@ -4773,6 +4786,7 @@ class ApiClient {
4773
4786
  refreshToken: this.refreshToken,
4774
4787
  refreshBackend: this.refreshBackend,
4775
4788
  refreshTenantId: this.refreshTenantId,
4789
+ refreshDomainName: this.refreshDomainName,
4776
4790
  refreshExpiration: this.refreshExpiration,
4777
4791
  isMobile: this.isMobile,
4778
4792
  });
@@ -4788,6 +4802,7 @@ class ApiClient {
4788
4802
  this.refreshExpiration,
4789
4803
  this.isMobile,
4790
4804
  this.refreshTenantId,
4805
+ this.refreshDomainName,
4791
4806
  );
4792
4807
 
4793
4808
  logger.info('token refreshed', { token: session.token });
@@ -4841,9 +4856,14 @@ class ApiClient {
4841
4856
  }
4842
4857
 
4843
4858
  setRefreshTenantId(tenantId ) {
4859
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4844
4860
  this.refreshTenantId = tenantId;
4845
4861
  }
4846
4862
 
4863
+ setRefreshDomainName(domainName ) {
4864
+ this.refreshDomainName = domainName;
4865
+ }
4866
+
4847
4867
  setIsMobile(isMobile ) {
4848
4868
  this.isMobile = isMobile;
4849
4869
  }
@@ -4868,6 +4888,7 @@ global.wazoClientId = global.wazoClientId || {};
4868
4888
  global.wazoClientToken = global.wazoClientToken || {};
4869
4889
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4870
4890
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4891
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4871
4892
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4872
4893
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4873
4894
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4877,6 +4898,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
4877
4898
 
4878
4899
  const fillClient = (apiClient ) => {
4879
4900
  const { server, token, clientId } = apiClient.client;
4901
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
4880
4902
 
4881
4903
  // try with null server when dealing with non-related server info
4882
4904
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -4885,8 +4907,12 @@ const fillClient = (apiClient ) => {
4885
4907
 
4886
4908
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
4887
4909
 
4888
- apiClient.setRefreshTenantId(
4889
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
4910
+ if (tenantId) {
4911
+ apiClient.setRefreshTenantId(tenantId);
4912
+ }
4913
+
4914
+ apiClient.setRefreshDomainName(
4915
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
4890
4916
  );
4891
4917
 
4892
4918
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -3184,6 +3184,7 @@ var authMethods = (client , baseUrl ) => ({
3184
3184
 
3185
3185
 
3186
3186
 
3187
+
3187
3188
  ) {
3188
3189
  const body = {
3189
3190
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -3204,9 +3205,14 @@ var authMethods = (client , baseUrl ) => ({
3204
3205
  }
3205
3206
 
3206
3207
  if (params.tenantId) {
3208
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
3207
3209
  body.tenant_id = params.tenantId;
3208
3210
  }
3209
3211
 
3212
+ if (params.domainName) {
3213
+ body.domain_name = params.domainName;
3214
+ }
3215
+
3210
3216
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
3211
3217
  },
3212
3218
 
@@ -3219,6 +3225,7 @@ var authMethods = (client , baseUrl ) => ({
3219
3225
  expiration ,
3220
3226
  isMobile = false,
3221
3227
  tenantId ,
3228
+ domainName ,
3222
3229
  ) => {
3223
3230
  const body = {
3224
3231
  backend: backend || DEFAULT_BACKEND_USER,
@@ -3228,9 +3235,14 @@ var authMethods = (client , baseUrl ) => ({
3228
3235
  };
3229
3236
 
3230
3237
  if (tenantId) {
3238
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
3231
3239
  body.tenant_id = tenantId;
3232
3240
  }
3233
3241
 
3242
+ if (domainName) {
3243
+ body.domain_name = domainName;
3244
+ }
3245
+
3234
3246
  const headers = {
3235
3247
  'Content-Type': 'application/json',
3236
3248
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -5146,6 +5158,7 @@ class ApiClient {
5146
5158
 
5147
5159
 
5148
5160
 
5161
+
5149
5162
 
5150
5163
 
5151
5164
 
@@ -5187,6 +5200,7 @@ class ApiClient {
5187
5200
  refreshToken: this.refreshToken,
5188
5201
  refreshBackend: this.refreshBackend,
5189
5202
  refreshTenantId: this.refreshTenantId,
5203
+ refreshDomainName: this.refreshDomainName,
5190
5204
  refreshExpiration: this.refreshExpiration,
5191
5205
  isMobile: this.isMobile,
5192
5206
  });
@@ -5202,6 +5216,7 @@ class ApiClient {
5202
5216
  this.refreshExpiration,
5203
5217
  this.isMobile,
5204
5218
  this.refreshTenantId,
5219
+ this.refreshDomainName,
5205
5220
  );
5206
5221
 
5207
5222
  logger$1.info('token refreshed', { token: session.token });
@@ -5255,9 +5270,14 @@ class ApiClient {
5255
5270
  }
5256
5271
 
5257
5272
  setRefreshTenantId(tenantId ) {
5273
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
5258
5274
  this.refreshTenantId = tenantId;
5259
5275
  }
5260
5276
 
5277
+ setRefreshDomainName(domainName ) {
5278
+ this.refreshDomainName = domainName;
5279
+ }
5280
+
5261
5281
  setIsMobile(isMobile ) {
5262
5282
  this.isMobile = isMobile;
5263
5283
  }
@@ -5282,6 +5302,7 @@ global.wazoClientId = global.wazoClientId || {};
5282
5302
  global.wazoClientToken = global.wazoClientToken || {};
5283
5303
  global.wazoRefreshToken = global.wazoRefreshToken || {};
5284
5304
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
5305
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
5285
5306
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
5286
5307
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
5287
5308
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -5291,6 +5312,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
5291
5312
 
5292
5313
  const fillClient = (apiClient ) => {
5293
5314
  const { server, token, clientId } = apiClient.client;
5315
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
5294
5316
 
5295
5317
  // try with null server when dealing with non-related server info
5296
5318
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -5299,8 +5321,12 @@ const fillClient = (apiClient ) => {
5299
5321
 
5300
5322
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
5301
5323
 
5302
- apiClient.setRefreshTenantId(
5303
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
5324
+ if (tenantId) {
5325
+ apiClient.setRefreshTenantId(tenantId);
5326
+ }
5327
+
5328
+ apiClient.setRefreshDomainName(
5329
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
5304
5330
  );
5305
5331
 
5306
5332
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -903,6 +903,7 @@ global.wazoClientId = global.wazoClientId || {};
903
903
  global.wazoClientToken = global.wazoClientToken || {};
904
904
  global.wazoRefreshToken = global.wazoRefreshToken || {};
905
905
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
906
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
906
907
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
907
908
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
908
909
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -1404,7 +1405,7 @@ class WebRTCPhone extends Emitter {
1404
1405
  const screenTrack = screenShareStream.getVideoTracks()[0];
1405
1406
  const sipSession = this.currentSipSession;
1406
1407
  const pc = this.client.getPeerConnection(this.getSipSessionId(sipSession));
1407
- const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
1408
+ const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
1408
1409
  const localStream = this.client.getLocalStream(this.getSipSessionId(sipSession));
1409
1410
  const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
1410
1411
  const hadVideo = !!videoTrack;
@@ -1442,9 +1443,7 @@ class WebRTCPhone extends Emitter {
1442
1443
 
1443
1444
  try {
1444
1445
  if (this.currentScreenShare.stream) {
1445
- this.currentScreenShare.stream.getTracks()
1446
- .filter(track => track.kind === 'video')
1447
- .forEach(track => track.stop());
1446
+ this.currentScreenShare.stream.getTracks().forEach(track => track.stop());
1448
1447
  }
1449
1448
 
1450
1449
  if (restoreLocalStream) {
@@ -1488,7 +1487,7 @@ class WebRTCPhone extends Emitter {
1488
1487
  const screenTrack = screenStream.getVideoTracks()[0];
1489
1488
  const sipSessionId = this.getSipSessionId(sipSession);
1490
1489
  const pc = this.client.getPeerConnection(sipSessionId);
1491
- const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
1490
+ const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
1492
1491
 
1493
1492
  logger.info('WebRTC phone - on screensharing', {
1494
1493
  hadVideo,