@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
@@ -1192,6 +1192,7 @@ global.wazoClientId = global.wazoClientId || {};
1192
1192
  global.wazoClientToken = global.wazoClientToken || {};
1193
1193
  global.wazoRefreshToken = global.wazoRefreshToken || {};
1194
1194
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
1195
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
1195
1196
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
1196
1197
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
1197
1198
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
package/lib/api-client.js CHANGED
@@ -2215,6 +2215,7 @@ var authMethods = (client , baseUrl ) => ({
2215
2215
 
2216
2216
 
2217
2217
 
2218
+
2218
2219
  ) {
2219
2220
  const body = {
2220
2221
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2235,9 +2236,14 @@ var authMethods = (client , baseUrl ) => ({
2235
2236
  }
2236
2237
 
2237
2238
  if (params.tenantId) {
2239
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2238
2240
  body.tenant_id = params.tenantId;
2239
2241
  }
2240
2242
 
2243
+ if (params.domainName) {
2244
+ body.domain_name = params.domainName;
2245
+ }
2246
+
2241
2247
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2242
2248
  },
2243
2249
 
@@ -2250,6 +2256,7 @@ var authMethods = (client , baseUrl ) => ({
2250
2256
  expiration ,
2251
2257
  isMobile = false,
2252
2258
  tenantId ,
2259
+ domainName ,
2253
2260
  ) => {
2254
2261
  const body = {
2255
2262
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2259,9 +2266,14 @@ var authMethods = (client , baseUrl ) => ({
2259
2266
  };
2260
2267
 
2261
2268
  if (tenantId) {
2269
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2262
2270
  body.tenant_id = tenantId;
2263
2271
  }
2264
2272
 
2273
+ if (domainName) {
2274
+ body.domain_name = domainName;
2275
+ }
2276
+
2265
2277
  const headers = {
2266
2278
  'Content-Type': 'application/json',
2267
2279
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3688,6 +3700,7 @@ global.wazoClientId = global.wazoClientId || {};
3688
3700
  global.wazoClientToken = global.wazoClientToken || {};
3689
3701
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3690
3702
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3703
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3691
3704
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3692
3705
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3693
3706
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4747,6 +4760,7 @@ class ApiClient {
4747
4760
 
4748
4761
 
4749
4762
 
4763
+
4750
4764
 
4751
4765
 
4752
4766
 
@@ -4788,6 +4802,7 @@ class ApiClient {
4788
4802
  refreshToken: this.refreshToken,
4789
4803
  refreshBackend: this.refreshBackend,
4790
4804
  refreshTenantId: this.refreshTenantId,
4805
+ refreshDomainName: this.refreshDomainName,
4791
4806
  refreshExpiration: this.refreshExpiration,
4792
4807
  isMobile: this.isMobile,
4793
4808
  });
@@ -4803,6 +4818,7 @@ class ApiClient {
4803
4818
  this.refreshExpiration,
4804
4819
  this.isMobile,
4805
4820
  this.refreshTenantId,
4821
+ this.refreshDomainName,
4806
4822
  );
4807
4823
 
4808
4824
  logger.info('token refreshed', { token: session.token });
@@ -4856,9 +4872,14 @@ class ApiClient {
4856
4872
  }
4857
4873
 
4858
4874
  setRefreshTenantId(tenantId ) {
4875
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4859
4876
  this.refreshTenantId = tenantId;
4860
4877
  }
4861
4878
 
4879
+ setRefreshDomainName(domainName ) {
4880
+ this.refreshDomainName = domainName;
4881
+ }
4882
+
4862
4883
  setIsMobile(isMobile ) {
4863
4884
  this.isMobile = isMobile;
4864
4885
  }
@@ -2237,6 +2237,7 @@ var authMethods = (client , baseUrl ) => ({
2237
2237
 
2238
2238
 
2239
2239
 
2240
+
2240
2241
  ) {
2241
2242
  const body = {
2242
2243
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2257,9 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
2257
2258
  }
2258
2259
 
2259
2260
  if (params.tenantId) {
2261
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2260
2262
  body.tenant_id = params.tenantId;
2261
2263
  }
2262
2264
 
2265
+ if (params.domainName) {
2266
+ body.domain_name = params.domainName;
2267
+ }
2268
+
2263
2269
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2264
2270
  },
2265
2271
 
@@ -2272,6 +2278,7 @@ var authMethods = (client , baseUrl ) => ({
2272
2278
  expiration ,
2273
2279
  isMobile = false,
2274
2280
  tenantId ,
2281
+ domainName ,
2275
2282
  ) => {
2276
2283
  const body = {
2277
2284
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2281,9 +2288,14 @@ var authMethods = (client , baseUrl ) => ({
2281
2288
  };
2282
2289
 
2283
2290
  if (tenantId) {
2291
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2284
2292
  body.tenant_id = tenantId;
2285
2293
  }
2286
2294
 
2295
+ if (domainName) {
2296
+ body.domain_name = domainName;
2297
+ }
2298
+
2287
2299
  const headers = {
2288
2300
  'Content-Type': 'application/json',
2289
2301
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3736,6 +3748,7 @@ global.wazoClientId = global.wazoClientId || {};
3736
3748
  global.wazoClientToken = global.wazoClientToken || {};
3737
3749
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3738
3750
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3751
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3739
3752
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3740
3753
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3741
3754
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4795,6 +4808,7 @@ class ApiClient {
4795
4808
 
4796
4809
 
4797
4810
 
4811
+
4798
4812
 
4799
4813
 
4800
4814
 
@@ -4836,6 +4850,7 @@ class ApiClient {
4836
4850
  refreshToken: this.refreshToken,
4837
4851
  refreshBackend: this.refreshBackend,
4838
4852
  refreshTenantId: this.refreshTenantId,
4853
+ refreshDomainName: this.refreshDomainName,
4839
4854
  refreshExpiration: this.refreshExpiration,
4840
4855
  isMobile: this.isMobile,
4841
4856
  });
@@ -4851,6 +4866,7 @@ class ApiClient {
4851
4866
  this.refreshExpiration,
4852
4867
  this.isMobile,
4853
4868
  this.refreshTenantId,
4869
+ this.refreshDomainName,
4854
4870
  );
4855
4871
 
4856
4872
  logger$3.info('token refreshed', { token: session.token });
@@ -4904,9 +4920,14 @@ class ApiClient {
4904
4920
  }
4905
4921
 
4906
4922
  setRefreshTenantId(tenantId ) {
4923
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4907
4924
  this.refreshTenantId = tenantId;
4908
4925
  }
4909
4926
 
4927
+ setRefreshDomainName(domainName ) {
4928
+ this.refreshDomainName = domainName;
4929
+ }
4930
+
4910
4931
  setIsMobile(isMobile ) {
4911
4932
  this.isMobile = isMobile;
4912
4933
  }
@@ -6985,9 +7006,11 @@ class WebRTCClient extends Emitter {
6985
7006
  const videoTracks = localStream.getVideoTracks();
6986
7007
 
6987
7008
  // Remove video senders
6988
- pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
6989
- videoSender.replaceTrack(null);
6990
- });
7009
+ if (pc.getSenders) {
7010
+ pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
7011
+ videoSender.replaceTrack(null);
7012
+ });
7013
+ }
6991
7014
 
6992
7015
  videoTracks.forEach(videoTrack => {
6993
7016
  videoTrack.enabled = false;
@@ -7220,7 +7243,8 @@ class WebRTCClient extends Emitter {
7220
7243
  const constraints = { audio: { deviceId: { exact: deviceId } } };
7221
7244
  const stream = await navigator.mediaDevices.getUserMedia(constraints);
7222
7245
  const audioTrack = stream.getAudioTracks()[0];
7223
- const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7246
+ const sender = pc && pc.getSenders
7247
+ && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7224
7248
 
7225
7249
  if (sender) {
7226
7250
  if (sender.track) {
@@ -7283,10 +7307,11 @@ class WebRTCClient extends Emitter {
7283
7307
  // $FlowFixMe
7284
7308
  return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
7285
7309
  const videoTrack = stream.getVideoTracks()[0];
7286
- let sender = pc && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
7310
+ let sender = pc && pc.getSenders
7311
+ && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
7287
7312
  let wasTrackEnabled = false;
7288
7313
  if (!sender) {
7289
- sender = pc && pc.getSenders().find(s => !s.track);
7314
+ sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
7290
7315
  }
7291
7316
 
7292
7317
  if (sender) {
@@ -2215,6 +2215,7 @@ var authMethods = (client , baseUrl ) => ({
2215
2215
 
2216
2216
 
2217
2217
 
2218
+
2218
2219
  ) {
2219
2220
  const body = {
2220
2221
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2235,9 +2236,14 @@ var authMethods = (client , baseUrl ) => ({
2235
2236
  }
2236
2237
 
2237
2238
  if (params.tenantId) {
2239
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2238
2240
  body.tenant_id = params.tenantId;
2239
2241
  }
2240
2242
 
2243
+ if (params.domainName) {
2244
+ body.domain_name = params.domainName;
2245
+ }
2246
+
2241
2247
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2242
2248
  },
2243
2249
 
@@ -2250,6 +2256,7 @@ var authMethods = (client , baseUrl ) => ({
2250
2256
  expiration ,
2251
2257
  isMobile = false,
2252
2258
  tenantId ,
2259
+ domainName ,
2253
2260
  ) => {
2254
2261
  const body = {
2255
2262
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2259,9 +2266,14 @@ var authMethods = (client , baseUrl ) => ({
2259
2266
  };
2260
2267
 
2261
2268
  if (tenantId) {
2269
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2262
2270
  body.tenant_id = tenantId;
2263
2271
  }
2264
2272
 
2273
+ if (domainName) {
2274
+ body.domain_name = domainName;
2275
+ }
2276
+
2265
2277
  const headers = {
2266
2278
  'Content-Type': 'application/json',
2267
2279
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3688,6 +3700,7 @@ global.wazoClientId = global.wazoClientId || {};
3688
3700
  global.wazoClientToken = global.wazoClientToken || {};
3689
3701
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3690
3702
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3703
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3691
3704
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3692
3705
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3693
3706
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4747,6 +4760,7 @@ class ApiClient {
4747
4760
 
4748
4761
 
4749
4762
 
4763
+
4750
4764
 
4751
4765
 
4752
4766
 
@@ -4788,6 +4802,7 @@ class ApiClient {
4788
4802
  refreshToken: this.refreshToken,
4789
4803
  refreshBackend: this.refreshBackend,
4790
4804
  refreshTenantId: this.refreshTenantId,
4805
+ refreshDomainName: this.refreshDomainName,
4791
4806
  refreshExpiration: this.refreshExpiration,
4792
4807
  isMobile: this.isMobile,
4793
4808
  });
@@ -4803,6 +4818,7 @@ class ApiClient {
4803
4818
  this.refreshExpiration,
4804
4819
  this.isMobile,
4805
4820
  this.refreshTenantId,
4821
+ this.refreshDomainName,
4806
4822
  );
4807
4823
 
4808
4824
  logger.info('token refreshed', { token: session.token });
@@ -4856,9 +4872,14 @@ class ApiClient {
4856
4872
  }
4857
4873
 
4858
4874
  setRefreshTenantId(tenantId ) {
4875
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4859
4876
  this.refreshTenantId = tenantId;
4860
4877
  }
4861
4878
 
4879
+ setRefreshDomainName(domainName ) {
4880
+ this.refreshDomainName = domainName;
4881
+ }
4882
+
4862
4883
  setIsMobile(isMobile ) {
4863
4884
  this.isMobile = isMobile;
4864
4885
  }
@@ -2215,6 +2215,7 @@ var authMethods = (client , baseUrl ) => ({
2215
2215
 
2216
2216
 
2217
2217
 
2218
+
2218
2219
  ) {
2219
2220
  const body = {
2220
2221
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2235,9 +2236,14 @@ var authMethods = (client , baseUrl ) => ({
2235
2236
  }
2236
2237
 
2237
2238
  if (params.tenantId) {
2239
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2238
2240
  body.tenant_id = params.tenantId;
2239
2241
  }
2240
2242
 
2243
+ if (params.domainName) {
2244
+ body.domain_name = params.domainName;
2245
+ }
2246
+
2241
2247
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2242
2248
  },
2243
2249
 
@@ -2250,6 +2256,7 @@ var authMethods = (client , baseUrl ) => ({
2250
2256
  expiration ,
2251
2257
  isMobile = false,
2252
2258
  tenantId ,
2259
+ domainName ,
2253
2260
  ) => {
2254
2261
  const body = {
2255
2262
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2259,9 +2266,14 @@ var authMethods = (client , baseUrl ) => ({
2259
2266
  };
2260
2267
 
2261
2268
  if (tenantId) {
2269
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2262
2270
  body.tenant_id = tenantId;
2263
2271
  }
2264
2272
 
2273
+ if (domainName) {
2274
+ body.domain_name = domainName;
2275
+ }
2276
+
2265
2277
  const headers = {
2266
2278
  'Content-Type': 'application/json',
2267
2279
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3688,6 +3700,7 @@ global.wazoClientId = global.wazoClientId || {};
3688
3700
  global.wazoClientToken = global.wazoClientToken || {};
3689
3701
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3690
3702
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3703
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3691
3704
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3692
3705
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3693
3706
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4747,6 +4760,7 @@ class ApiClient {
4747
4760
 
4748
4761
 
4749
4762
 
4763
+
4750
4764
 
4751
4765
 
4752
4766
 
@@ -4788,6 +4802,7 @@ class ApiClient {
4788
4802
  refreshToken: this.refreshToken,
4789
4803
  refreshBackend: this.refreshBackend,
4790
4804
  refreshTenantId: this.refreshTenantId,
4805
+ refreshDomainName: this.refreshDomainName,
4791
4806
  refreshExpiration: this.refreshExpiration,
4792
4807
  isMobile: this.isMobile,
4793
4808
  });
@@ -4803,6 +4818,7 @@ class ApiClient {
4803
4818
  this.refreshExpiration,
4804
4819
  this.isMobile,
4805
4820
  this.refreshTenantId,
4821
+ this.refreshDomainName,
4806
4822
  );
4807
4823
 
4808
4824
  logger.info('token refreshed', { token: session.token });
@@ -4856,9 +4872,14 @@ class ApiClient {
4856
4872
  }
4857
4873
 
4858
4874
  setRefreshTenantId(tenantId ) {
4875
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4859
4876
  this.refreshTenantId = tenantId;
4860
4877
  }
4861
4878
 
4879
+ setRefreshDomainName(domainName ) {
4880
+ this.refreshDomainName = domainName;
4881
+ }
4882
+
4862
4883
  setIsMobile(isMobile ) {
4863
4884
  this.isMobile = isMobile;
4864
4885
  }
@@ -2237,6 +2237,7 @@ var authMethods = (client , baseUrl ) => ({
2237
2237
 
2238
2238
 
2239
2239
 
2240
+
2240
2241
  ) {
2241
2242
  const body = {
2242
2243
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2257,9 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
2257
2258
  }
2258
2259
 
2259
2260
  if (params.tenantId) {
2261
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2260
2262
  body.tenant_id = params.tenantId;
2261
2263
  }
2262
2264
 
2265
+ if (params.domainName) {
2266
+ body.domain_name = params.domainName;
2267
+ }
2268
+
2263
2269
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2264
2270
  },
2265
2271
 
@@ -2272,6 +2278,7 @@ var authMethods = (client , baseUrl ) => ({
2272
2278
  expiration ,
2273
2279
  isMobile = false,
2274
2280
  tenantId ,
2281
+ domainName ,
2275
2282
  ) => {
2276
2283
  const body = {
2277
2284
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2281,9 +2288,14 @@ var authMethods = (client , baseUrl ) => ({
2281
2288
  };
2282
2289
 
2283
2290
  if (tenantId) {
2291
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2284
2292
  body.tenant_id = tenantId;
2285
2293
  }
2286
2294
 
2295
+ if (domainName) {
2296
+ body.domain_name = domainName;
2297
+ }
2298
+
2287
2299
  const headers = {
2288
2300
  'Content-Type': 'application/json',
2289
2301
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3736,6 +3748,7 @@ global.wazoClientId = global.wazoClientId || {};
3736
3748
  global.wazoClientToken = global.wazoClientToken || {};
3737
3749
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3738
3750
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3751
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
3739
3752
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3740
3753
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3741
3754
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4795,6 +4808,7 @@ class ApiClient {
4795
4808
 
4796
4809
 
4797
4810
 
4811
+
4798
4812
 
4799
4813
 
4800
4814
 
@@ -4836,6 +4850,7 @@ class ApiClient {
4836
4850
  refreshToken: this.refreshToken,
4837
4851
  refreshBackend: this.refreshBackend,
4838
4852
  refreshTenantId: this.refreshTenantId,
4853
+ refreshDomainName: this.refreshDomainName,
4839
4854
  refreshExpiration: this.refreshExpiration,
4840
4855
  isMobile: this.isMobile,
4841
4856
  });
@@ -4851,6 +4866,7 @@ class ApiClient {
4851
4866
  this.refreshExpiration,
4852
4867
  this.isMobile,
4853
4868
  this.refreshTenantId,
4869
+ this.refreshDomainName,
4854
4870
  );
4855
4871
 
4856
4872
  logger$2.info('token refreshed', { token: session.token });
@@ -4904,9 +4920,14 @@ class ApiClient {
4904
4920
  }
4905
4921
 
4906
4922
  setRefreshTenantId(tenantId ) {
4923
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4907
4924
  this.refreshTenantId = tenantId;
4908
4925
  }
4909
4926
 
4927
+ setRefreshDomainName(domainName ) {
4928
+ this.refreshDomainName = domainName;
4929
+ }
4930
+
4910
4931
  setIsMobile(isMobile ) {
4911
4932
  this.isMobile = isMobile;
4912
4933
  }
@@ -6985,9 +7006,11 @@ class WebRTCClient extends Emitter {
6985
7006
  const videoTracks = localStream.getVideoTracks();
6986
7007
 
6987
7008
  // Remove video senders
6988
- pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
6989
- videoSender.replaceTrack(null);
6990
- });
7009
+ if (pc.getSenders) {
7010
+ pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
7011
+ videoSender.replaceTrack(null);
7012
+ });
7013
+ }
6991
7014
 
6992
7015
  videoTracks.forEach(videoTrack => {
6993
7016
  videoTrack.enabled = false;
@@ -7220,7 +7243,8 @@ class WebRTCClient extends Emitter {
7220
7243
  const constraints = { audio: { deviceId: { exact: deviceId } } };
7221
7244
  const stream = await navigator.mediaDevices.getUserMedia(constraints);
7222
7245
  const audioTrack = stream.getAudioTracks()[0];
7223
- const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7246
+ const sender = pc && pc.getSenders
7247
+ && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7224
7248
 
7225
7249
  if (sender) {
7226
7250
  if (sender.track) {
@@ -7283,10 +7307,11 @@ class WebRTCClient extends Emitter {
7283
7307
  // $FlowFixMe
7284
7308
  return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
7285
7309
  const videoTrack = stream.getVideoTracks()[0];
7286
- let sender = pc && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
7310
+ let sender = pc && pc.getSenders
7311
+ && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
7287
7312
  let wasTrackEnabled = false;
7288
7313
  if (!sender) {
7289
- sender = pc && pc.getSenders().find(s => !s.track);
7314
+ sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
7290
7315
  }
7291
7316
 
7292
7317
  if (sender) {
@@ -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) {