@wazo/sdk 0.38.9 → 0.38.12

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 +32 -7
  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 +32 -7
  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 +32 -7
  11. package/esm/checker/checks/webrtc-transport.js +32 -7
  12. package/esm/checker/checks/webrtc.js +32 -7
  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 +3 -2
  17. package/esm/index.js +86 -15
  18. package/esm/service/CallApi.js +28 -2
  19. package/esm/service/getApiClient.js +34 -3
  20. package/esm/simple/Auth.js +87 -16
  21. package/esm/simple/Configuration.js +86 -15
  22. package/esm/simple/Directory.js +28 -2
  23. package/esm/simple/Phone.js +86 -15
  24. package/esm/simple/Softphone.js +5 -0
  25. package/esm/simple/index.js +86 -15
  26. package/esm/simple/room/LocalParticipant.js +86 -15
  27. package/esm/simple/room/Participant.js +86 -15
  28. package/esm/simple/room/RemoteParticipant.js +86 -15
  29. package/esm/simple/room/Room.js +86 -15
  30. package/esm/simple/room/SipRoom.js +86 -15
  31. package/esm/simple/room/Stream.js +86 -15
  32. package/esm/simple/room/__tests__/Participant.test.js +86 -15
  33. package/esm/simple/room/__tests__/RemoteParticipant.test.js +86 -15
  34. package/esm/simple/utils.js +86 -15
  35. package/esm/web-rtc-client.js +32 -7
  36. package/lib/__tests__/api-client.test.js +21 -0
  37. package/lib/__tests__/web-rtc-client.test.js +32 -7
  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 +32 -7
  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 +32 -7
  45. package/lib/checker/checks/webrtc-transport.js +32 -7
  46. package/lib/checker/checks/webrtc.js +32 -7
  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 +3 -2
  51. package/lib/index.js +86 -15
  52. package/lib/service/CallApi.js +28 -2
  53. package/lib/service/getApiClient.js +34 -2
  54. package/lib/simple/Auth.js +87 -15
  55. package/lib/simple/Configuration.js +86 -15
  56. package/lib/simple/Directory.js +28 -2
  57. package/lib/simple/Phone.js +86 -15
  58. package/lib/simple/Softphone.js +5 -0
  59. package/lib/simple/index.js +86 -15
  60. package/lib/simple/room/LocalParticipant.js +86 -15
  61. package/lib/simple/room/Participant.js +86 -15
  62. package/lib/simple/room/RemoteParticipant.js +86 -15
  63. package/lib/simple/room/Room.js +86 -15
  64. package/lib/simple/room/SipRoom.js +86 -15
  65. package/lib/simple/room/Stream.js +86 -15
  66. package/lib/simple/room/__tests__/Participant.test.js +86 -15
  67. package/lib/simple/room/__tests__/RemoteParticipant.test.js +86 -15
  68. package/lib/simple/utils.js +86 -15
  69. package/lib/web-rtc-client.js +32 -7
  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 +2 -2
  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 +11 -7
@@ -2209,6 +2209,7 @@ var authMethods = (client , baseUrl ) => ({
2209
2209
 
2210
2210
 
2211
2211
 
2212
+
2212
2213
  ) {
2213
2214
  const body = {
2214
2215
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2229,9 +2230,14 @@ var authMethods = (client , baseUrl ) => ({
2229
2230
  }
2230
2231
 
2231
2232
  if (params.tenantId) {
2233
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2232
2234
  body.tenant_id = params.tenantId;
2233
2235
  }
2234
2236
 
2237
+ if (params.domainName) {
2238
+ body.domain_name = params.domainName;
2239
+ }
2240
+
2235
2241
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2236
2242
  },
2237
2243
 
@@ -2244,6 +2250,7 @@ var authMethods = (client , baseUrl ) => ({
2244
2250
  expiration ,
2245
2251
  isMobile = false,
2246
2252
  tenantId ,
2253
+ domainName ,
2247
2254
  ) => {
2248
2255
  const body = {
2249
2256
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2253,9 +2260,14 @@ var authMethods = (client , baseUrl ) => ({
2253
2260
  };
2254
2261
 
2255
2262
  if (tenantId) {
2263
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2256
2264
  body.tenant_id = tenantId;
2257
2265
  }
2258
2266
 
2267
+ if (domainName) {
2268
+ body.domain_name = domainName;
2269
+ }
2270
+
2259
2271
  const headers = {
2260
2272
  'Content-Type': 'application/json',
2261
2273
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3682,6 +3694,7 @@ global.wazoClientId = global.wazoClientId || {};
3682
3694
  global.wazoClientToken = global.wazoClientToken || {};
3683
3695
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3684
3696
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3697
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3685
3698
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3686
3699
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3687
3700
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4741,6 +4754,7 @@ class ApiClient {
4741
4754
 
4742
4755
 
4743
4756
 
4757
+
4744
4758
 
4745
4759
 
4746
4760
 
@@ -4782,6 +4796,7 @@ class ApiClient {
4782
4796
  refreshToken: this.refreshToken,
4783
4797
  refreshBackend: this.refreshBackend,
4784
4798
  refreshTenantId: this.refreshTenantId,
4799
+ refreshDomainName: this.refreshDomainName,
4785
4800
  refreshExpiration: this.refreshExpiration,
4786
4801
  isMobile: this.isMobile,
4787
4802
  });
@@ -4797,6 +4812,7 @@ class ApiClient {
4797
4812
  this.refreshExpiration,
4798
4813
  this.isMobile,
4799
4814
  this.refreshTenantId,
4815
+ this.refreshDomainName,
4800
4816
  );
4801
4817
 
4802
4818
  logger.info('token refreshed', { token: session.token });
@@ -4850,9 +4866,14 @@ class ApiClient {
4850
4866
  }
4851
4867
 
4852
4868
  setRefreshTenantId(tenantId ) {
4869
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4853
4870
  this.refreshTenantId = tenantId;
4854
4871
  }
4855
4872
 
4873
+ setRefreshDomainName(domainName ) {
4874
+ this.refreshDomainName = domainName;
4875
+ }
4876
+
4856
4877
  setIsMobile(isMobile ) {
4857
4878
  this.isMobile = isMobile;
4858
4879
  }
@@ -2786,6 +2786,7 @@ var authMethods = (client , baseUrl ) => ({
2786
2786
 
2787
2787
 
2788
2788
 
2789
+
2789
2790
  ) {
2790
2791
  const body = {
2791
2792
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2806,9 +2807,14 @@ var authMethods = (client , baseUrl ) => ({
2806
2807
  }
2807
2808
 
2808
2809
  if (params.tenantId) {
2810
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2809
2811
  body.tenant_id = params.tenantId;
2810
2812
  }
2811
2813
 
2814
+ if (params.domainName) {
2815
+ body.domain_name = params.domainName;
2816
+ }
2817
+
2812
2818
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2813
2819
  },
2814
2820
 
@@ -2821,6 +2827,7 @@ var authMethods = (client , baseUrl ) => ({
2821
2827
  expiration ,
2822
2828
  isMobile = false,
2823
2829
  tenantId ,
2830
+ domainName ,
2824
2831
  ) => {
2825
2832
  const body = {
2826
2833
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2830,9 +2837,14 @@ var authMethods = (client , baseUrl ) => ({
2830
2837
  };
2831
2838
 
2832
2839
  if (tenantId) {
2840
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2833
2841
  body.tenant_id = tenantId;
2834
2842
  }
2835
2843
 
2844
+ if (domainName) {
2845
+ body.domain_name = domainName;
2846
+ }
2847
+
2836
2848
  const headers = {
2837
2849
  'Content-Type': 'application/json',
2838
2850
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4259,6 +4271,7 @@ global.wazoClientId = global.wazoClientId || {};
4259
4271
  global.wazoClientToken = global.wazoClientToken || {};
4260
4272
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4261
4273
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4274
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4262
4275
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4263
4276
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4264
4277
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -5318,6 +5331,7 @@ class ApiClient {
5318
5331
 
5319
5332
 
5320
5333
 
5334
+
5321
5335
 
5322
5336
 
5323
5337
 
@@ -5359,6 +5373,7 @@ class ApiClient {
5359
5373
  refreshToken: this.refreshToken,
5360
5374
  refreshBackend: this.refreshBackend,
5361
5375
  refreshTenantId: this.refreshTenantId,
5376
+ refreshDomainName: this.refreshDomainName,
5362
5377
  refreshExpiration: this.refreshExpiration,
5363
5378
  isMobile: this.isMobile,
5364
5379
  });
@@ -5374,6 +5389,7 @@ class ApiClient {
5374
5389
  this.refreshExpiration,
5375
5390
  this.isMobile,
5376
5391
  this.refreshTenantId,
5392
+ this.refreshDomainName,
5377
5393
  );
5378
5394
 
5379
5395
  logger$1.info('token refreshed', { token: session.token });
@@ -5427,9 +5443,14 @@ class ApiClient {
5427
5443
  }
5428
5444
 
5429
5445
  setRefreshTenantId(tenantId ) {
5446
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
5430
5447
  this.refreshTenantId = tenantId;
5431
5448
  }
5432
5449
 
5450
+ setRefreshDomainName(domainName ) {
5451
+ this.refreshDomainName = domainName;
5452
+ }
5453
+
5433
5454
  setIsMobile(isMobile ) {
5434
5455
  this.isMobile = isMobile;
5435
5456
  }
@@ -6347,7 +6368,7 @@ class WebRTCClient extends Emitter {
6347
6368
 
6348
6369
  videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
6349
6370
  } else {
6350
- videoSender = pc.getSenders().find(sender => sender.track === null);
6371
+ videoSender = pc && pc.getSenders && pc.getSenders().find(sender => sender.track === null);
6351
6372
  }
6352
6373
 
6353
6374
  if (!videoSender) {
@@ -6388,9 +6409,11 @@ class WebRTCClient extends Emitter {
6388
6409
  const videoTracks = localStream.getVideoTracks();
6389
6410
 
6390
6411
  // Remove video senders
6391
- pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
6392
- videoSender.replaceTrack(null);
6393
- });
6412
+ if (pc.getSenders) {
6413
+ pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
6414
+ videoSender.replaceTrack(null);
6415
+ });
6416
+ }
6394
6417
 
6395
6418
  videoTracks.forEach(videoTrack => {
6396
6419
  videoTrack.enabled = false;
@@ -6623,7 +6646,8 @@ class WebRTCClient extends Emitter {
6623
6646
  const constraints = { audio: { deviceId: { exact: deviceId } } };
6624
6647
  const stream = await navigator.mediaDevices.getUserMedia(constraints);
6625
6648
  const audioTrack = stream.getAudioTracks()[0];
6626
- const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
6649
+ const sender = pc && pc.getSenders
6650
+ && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
6627
6651
 
6628
6652
  if (sender) {
6629
6653
  if (sender.track) {
@@ -6686,10 +6710,11 @@ class WebRTCClient extends Emitter {
6686
6710
  // $FlowFixMe
6687
6711
  return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
6688
6712
  const videoTrack = stream.getVideoTracks()[0];
6689
- let sender = pc && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
6713
+ let sender = pc && pc.getSenders
6714
+ && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
6690
6715
  let wasTrackEnabled = false;
6691
6716
  if (!sender) {
6692
- sender = pc && pc.getSenders().find(s => !s.track);
6717
+ sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
6693
6718
  }
6694
6719
 
6695
6720
  if (sender) {
package/esm/api/auth.js CHANGED
@@ -967,6 +967,7 @@ var auth = (client , baseUrl ) => ({
967
967
 
968
968
 
969
969
 
970
+
970
971
  ) {
971
972
  const body = {
972
973
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -987,9 +988,14 @@ var auth = (client , baseUrl ) => ({
987
988
  }
988
989
 
989
990
  if (params.tenantId) {
991
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
990
992
  body.tenant_id = params.tenantId;
991
993
  }
992
994
 
995
+ if (params.domainName) {
996
+ body.domain_name = params.domainName;
997
+ }
998
+
993
999
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
994
1000
  },
995
1001
 
@@ -1002,6 +1008,7 @@ var auth = (client , baseUrl ) => ({
1002
1008
  expiration ,
1003
1009
  isMobile = false,
1004
1010
  tenantId ,
1011
+ domainName ,
1005
1012
  ) => {
1006
1013
  const body = {
1007
1014
  backend: backend || DEFAULT_BACKEND_USER,
@@ -1011,9 +1018,14 @@ var auth = (client , baseUrl ) => ({
1011
1018
  };
1012
1019
 
1013
1020
  if (tenantId) {
1021
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
1014
1022
  body.tenant_id = tenantId;
1015
1023
  }
1016
1024
 
1025
+ if (domainName) {
1026
+ body.domain_name = domainName;
1027
+ }
1028
+
1017
1029
  const headers = {
1018
1030
  'Content-Type': 'application/json',
1019
1031
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -1186,6 +1186,7 @@ global.wazoClientId = global.wazoClientId || {};
1186
1186
  global.wazoClientToken = global.wazoClientToken || {};
1187
1187
  global.wazoRefreshToken = global.wazoRefreshToken || {};
1188
1188
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
1189
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
1189
1190
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
1190
1191
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
1191
1192
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
package/esm/api-client.js CHANGED
@@ -2209,6 +2209,7 @@ var authMethods = (client , baseUrl ) => ({
2209
2209
 
2210
2210
 
2211
2211
 
2212
+
2212
2213
  ) {
2213
2214
  const body = {
2214
2215
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2229,9 +2230,14 @@ var authMethods = (client , baseUrl ) => ({
2229
2230
  }
2230
2231
 
2231
2232
  if (params.tenantId) {
2233
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2232
2234
  body.tenant_id = params.tenantId;
2233
2235
  }
2234
2236
 
2237
+ if (params.domainName) {
2238
+ body.domain_name = params.domainName;
2239
+ }
2240
+
2235
2241
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2236
2242
  },
2237
2243
 
@@ -2244,6 +2250,7 @@ var authMethods = (client , baseUrl ) => ({
2244
2250
  expiration ,
2245
2251
  isMobile = false,
2246
2252
  tenantId ,
2253
+ domainName ,
2247
2254
  ) => {
2248
2255
  const body = {
2249
2256
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2253,9 +2260,14 @@ var authMethods = (client , baseUrl ) => ({
2253
2260
  };
2254
2261
 
2255
2262
  if (tenantId) {
2263
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2256
2264
  body.tenant_id = tenantId;
2257
2265
  }
2258
2266
 
2267
+ if (domainName) {
2268
+ body.domain_name = domainName;
2269
+ }
2270
+
2259
2271
  const headers = {
2260
2272
  'Content-Type': 'application/json',
2261
2273
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3682,6 +3694,7 @@ global.wazoClientId = global.wazoClientId || {};
3682
3694
  global.wazoClientToken = global.wazoClientToken || {};
3683
3695
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3684
3696
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3697
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3685
3698
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3686
3699
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3687
3700
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4741,6 +4754,7 @@ class ApiClient {
4741
4754
 
4742
4755
 
4743
4756
 
4757
+
4744
4758
 
4745
4759
 
4746
4760
 
@@ -4782,6 +4796,7 @@ class ApiClient {
4782
4796
  refreshToken: this.refreshToken,
4783
4797
  refreshBackend: this.refreshBackend,
4784
4798
  refreshTenantId: this.refreshTenantId,
4799
+ refreshDomainName: this.refreshDomainName,
4785
4800
  refreshExpiration: this.refreshExpiration,
4786
4801
  isMobile: this.isMobile,
4787
4802
  });
@@ -4797,6 +4812,7 @@ class ApiClient {
4797
4812
  this.refreshExpiration,
4798
4813
  this.isMobile,
4799
4814
  this.refreshTenantId,
4815
+ this.refreshDomainName,
4800
4816
  );
4801
4817
 
4802
4818
  logger.info('token refreshed', { token: session.token });
@@ -4850,9 +4866,14 @@ class ApiClient {
4850
4866
  }
4851
4867
 
4852
4868
  setRefreshTenantId(tenantId ) {
4869
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4853
4870
  this.refreshTenantId = tenantId;
4854
4871
  }
4855
4872
 
4873
+ setRefreshDomainName(domainName ) {
4874
+ this.refreshDomainName = domainName;
4875
+ }
4876
+
4856
4877
  setIsMobile(isMobile ) {
4857
4878
  this.isMobile = isMobile;
4858
4879
  }
@@ -2227,6 +2227,7 @@ var authMethods = (client , baseUrl ) => ({
2227
2227
 
2228
2228
 
2229
2229
 
2230
+
2230
2231
  ) {
2231
2232
  const body = {
2232
2233
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2247,9 +2248,14 @@ var authMethods = (client , baseUrl ) => ({
2247
2248
  }
2248
2249
 
2249
2250
  if (params.tenantId) {
2251
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2250
2252
  body.tenant_id = params.tenantId;
2251
2253
  }
2252
2254
 
2255
+ if (params.domainName) {
2256
+ body.domain_name = params.domainName;
2257
+ }
2258
+
2253
2259
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2254
2260
  },
2255
2261
 
@@ -2262,6 +2268,7 @@ var authMethods = (client , baseUrl ) => ({
2262
2268
  expiration ,
2263
2269
  isMobile = false,
2264
2270
  tenantId ,
2271
+ domainName ,
2265
2272
  ) => {
2266
2273
  const body = {
2267
2274
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2271,9 +2278,14 @@ var authMethods = (client , baseUrl ) => ({
2271
2278
  };
2272
2279
 
2273
2280
  if (tenantId) {
2281
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2274
2282
  body.tenant_id = tenantId;
2275
2283
  }
2276
2284
 
2285
+ if (domainName) {
2286
+ body.domain_name = domainName;
2287
+ }
2288
+
2277
2289
  const headers = {
2278
2290
  'Content-Type': 'application/json',
2279
2291
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3726,6 +3738,7 @@ global.wazoClientId = global.wazoClientId || {};
3726
3738
  global.wazoClientToken = global.wazoClientToken || {};
3727
3739
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3728
3740
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3741
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3729
3742
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3730
3743
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3731
3744
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4785,6 +4798,7 @@ class ApiClient {
4785
4798
 
4786
4799
 
4787
4800
 
4801
+
4788
4802
 
4789
4803
 
4790
4804
 
@@ -4826,6 +4840,7 @@ class ApiClient {
4826
4840
  refreshToken: this.refreshToken,
4827
4841
  refreshBackend: this.refreshBackend,
4828
4842
  refreshTenantId: this.refreshTenantId,
4843
+ refreshDomainName: this.refreshDomainName,
4829
4844
  refreshExpiration: this.refreshExpiration,
4830
4845
  isMobile: this.isMobile,
4831
4846
  });
@@ -4841,6 +4856,7 @@ class ApiClient {
4841
4856
  this.refreshExpiration,
4842
4857
  this.isMobile,
4843
4858
  this.refreshTenantId,
4859
+ this.refreshDomainName,
4844
4860
  );
4845
4861
 
4846
4862
  logger$3.info('token refreshed', { token: session.token });
@@ -4894,9 +4910,14 @@ class ApiClient {
4894
4910
  }
4895
4911
 
4896
4912
  setRefreshTenantId(tenantId ) {
4913
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4897
4914
  this.refreshTenantId = tenantId;
4898
4915
  }
4899
4916
 
4917
+ setRefreshDomainName(domainName ) {
4918
+ this.refreshDomainName = domainName;
4919
+ }
4920
+
4900
4921
  setIsMobile(isMobile ) {
4901
4922
  this.isMobile = isMobile;
4902
4923
  }
@@ -6934,7 +6955,7 @@ class WebRTCClient extends Emitter {
6934
6955
 
6935
6956
  videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
6936
6957
  } else {
6937
- videoSender = pc.getSenders().find(sender => sender.track === null);
6958
+ videoSender = pc && pc.getSenders && pc.getSenders().find(sender => sender.track === null);
6938
6959
  }
6939
6960
 
6940
6961
  if (!videoSender) {
@@ -6975,9 +6996,11 @@ class WebRTCClient extends Emitter {
6975
6996
  const videoTracks = localStream.getVideoTracks();
6976
6997
 
6977
6998
  // Remove video senders
6978
- pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
6979
- videoSender.replaceTrack(null);
6980
- });
6999
+ if (pc.getSenders) {
7000
+ pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
7001
+ videoSender.replaceTrack(null);
7002
+ });
7003
+ }
6981
7004
 
6982
7005
  videoTracks.forEach(videoTrack => {
6983
7006
  videoTrack.enabled = false;
@@ -7210,7 +7233,8 @@ class WebRTCClient extends Emitter {
7210
7233
  const constraints = { audio: { deviceId: { exact: deviceId } } };
7211
7234
  const stream = await navigator.mediaDevices.getUserMedia(constraints);
7212
7235
  const audioTrack = stream.getAudioTracks()[0];
7213
- const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7236
+ const sender = pc && pc.getSenders
7237
+ && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7214
7238
 
7215
7239
  if (sender) {
7216
7240
  if (sender.track) {
@@ -7273,10 +7297,11 @@ class WebRTCClient extends Emitter {
7273
7297
  // $FlowFixMe
7274
7298
  return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
7275
7299
  const videoTrack = stream.getVideoTracks()[0];
7276
- let sender = pc && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
7300
+ let sender = pc && pc.getSenders
7301
+ && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
7277
7302
  let wasTrackEnabled = false;
7278
7303
  if (!sender) {
7279
- sender = pc && pc.getSenders().find(s => !s.track);
7304
+ sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
7280
7305
  }
7281
7306
 
7282
7307
  if (sender) {
@@ -2209,6 +2209,7 @@ var authMethods = (client , baseUrl ) => ({
2209
2209
 
2210
2210
 
2211
2211
 
2212
+
2212
2213
  ) {
2213
2214
  const body = {
2214
2215
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2229,9 +2230,14 @@ var authMethods = (client , baseUrl ) => ({
2229
2230
  }
2230
2231
 
2231
2232
  if (params.tenantId) {
2233
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2232
2234
  body.tenant_id = params.tenantId;
2233
2235
  }
2234
2236
 
2237
+ if (params.domainName) {
2238
+ body.domain_name = params.domainName;
2239
+ }
2240
+
2235
2241
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2236
2242
  },
2237
2243
 
@@ -2244,6 +2250,7 @@ var authMethods = (client , baseUrl ) => ({
2244
2250
  expiration ,
2245
2251
  isMobile = false,
2246
2252
  tenantId ,
2253
+ domainName ,
2247
2254
  ) => {
2248
2255
  const body = {
2249
2256
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2253,9 +2260,14 @@ var authMethods = (client , baseUrl ) => ({
2253
2260
  };
2254
2261
 
2255
2262
  if (tenantId) {
2263
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2256
2264
  body.tenant_id = tenantId;
2257
2265
  }
2258
2266
 
2267
+ if (domainName) {
2268
+ body.domain_name = domainName;
2269
+ }
2270
+
2259
2271
  const headers = {
2260
2272
  'Content-Type': 'application/json',
2261
2273
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3682,6 +3694,7 @@ global.wazoClientId = global.wazoClientId || {};
3682
3694
  global.wazoClientToken = global.wazoClientToken || {};
3683
3695
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3684
3696
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3697
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3685
3698
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3686
3699
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3687
3700
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4741,6 +4754,7 @@ class ApiClient {
4741
4754
 
4742
4755
 
4743
4756
 
4757
+
4744
4758
 
4745
4759
 
4746
4760
 
@@ -4782,6 +4796,7 @@ class ApiClient {
4782
4796
  refreshToken: this.refreshToken,
4783
4797
  refreshBackend: this.refreshBackend,
4784
4798
  refreshTenantId: this.refreshTenantId,
4799
+ refreshDomainName: this.refreshDomainName,
4785
4800
  refreshExpiration: this.refreshExpiration,
4786
4801
  isMobile: this.isMobile,
4787
4802
  });
@@ -4797,6 +4812,7 @@ class ApiClient {
4797
4812
  this.refreshExpiration,
4798
4813
  this.isMobile,
4799
4814
  this.refreshTenantId,
4815
+ this.refreshDomainName,
4800
4816
  );
4801
4817
 
4802
4818
  logger.info('token refreshed', { token: session.token });
@@ -4850,9 +4866,14 @@ class ApiClient {
4850
4866
  }
4851
4867
 
4852
4868
  setRefreshTenantId(tenantId ) {
4869
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4853
4870
  this.refreshTenantId = tenantId;
4854
4871
  }
4855
4872
 
4873
+ setRefreshDomainName(domainName ) {
4874
+ this.refreshDomainName = domainName;
4875
+ }
4876
+
4856
4877
  setIsMobile(isMobile ) {
4857
4878
  this.isMobile = isMobile;
4858
4879
  }
@@ -2209,6 +2209,7 @@ var authMethods = (client , baseUrl ) => ({
2209
2209
 
2210
2210
 
2211
2211
 
2212
+
2212
2213
  ) {
2213
2214
  const body = {
2214
2215
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2229,9 +2230,14 @@ var authMethods = (client , baseUrl ) => ({
2229
2230
  }
2230
2231
 
2231
2232
  if (params.tenantId) {
2233
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2232
2234
  body.tenant_id = params.tenantId;
2233
2235
  }
2234
2236
 
2237
+ if (params.domainName) {
2238
+ body.domain_name = params.domainName;
2239
+ }
2240
+
2235
2241
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2236
2242
  },
2237
2243
 
@@ -2244,6 +2250,7 @@ var authMethods = (client , baseUrl ) => ({
2244
2250
  expiration ,
2245
2251
  isMobile = false,
2246
2252
  tenantId ,
2253
+ domainName ,
2247
2254
  ) => {
2248
2255
  const body = {
2249
2256
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2253,9 +2260,14 @@ var authMethods = (client , baseUrl ) => ({
2253
2260
  };
2254
2261
 
2255
2262
  if (tenantId) {
2263
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2256
2264
  body.tenant_id = tenantId;
2257
2265
  }
2258
2266
 
2267
+ if (domainName) {
2268
+ body.domain_name = domainName;
2269
+ }
2270
+
2259
2271
  const headers = {
2260
2272
  'Content-Type': 'application/json',
2261
2273
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3682,6 +3694,7 @@ global.wazoClientId = global.wazoClientId || {};
3682
3694
  global.wazoClientToken = global.wazoClientToken || {};
3683
3695
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3684
3696
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3697
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3685
3698
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3686
3699
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3687
3700
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4741,6 +4754,7 @@ class ApiClient {
4741
4754
 
4742
4755
 
4743
4756
 
4757
+
4744
4758
 
4745
4759
 
4746
4760
 
@@ -4782,6 +4796,7 @@ class ApiClient {
4782
4796
  refreshToken: this.refreshToken,
4783
4797
  refreshBackend: this.refreshBackend,
4784
4798
  refreshTenantId: this.refreshTenantId,
4799
+ refreshDomainName: this.refreshDomainName,
4785
4800
  refreshExpiration: this.refreshExpiration,
4786
4801
  isMobile: this.isMobile,
4787
4802
  });
@@ -4797,6 +4812,7 @@ class ApiClient {
4797
4812
  this.refreshExpiration,
4798
4813
  this.isMobile,
4799
4814
  this.refreshTenantId,
4815
+ this.refreshDomainName,
4800
4816
  );
4801
4817
 
4802
4818
  logger.info('token refreshed', { token: session.token });
@@ -4850,9 +4866,14 @@ class ApiClient {
4850
4866
  }
4851
4867
 
4852
4868
  setRefreshTenantId(tenantId ) {
4869
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4853
4870
  this.refreshTenantId = tenantId;
4854
4871
  }
4855
4872
 
4873
+ setRefreshDomainName(domainName ) {
4874
+ this.refreshDomainName = domainName;
4875
+ }
4876
+
4856
4877
  setIsMobile(isMobile ) {
4857
4878
  this.isMobile = isMobile;
4858
4879
  }