@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
@@ -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$2.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
  }
@@ -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) {
@@ -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
  }
@@ -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) {
@@ -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
  }
@@ -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) {
@@ -2424,6 +2424,7 @@ var authMethods = (client , baseUrl ) => ({
2424
2424
 
2425
2425
 
2426
2426
 
2427
+
2427
2428
  ) {
2428
2429
  const body = {
2429
2430
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2444,9 +2445,14 @@ var authMethods = (client , baseUrl ) => ({
2444
2445
  }
2445
2446
 
2446
2447
  if (params.tenantId) {
2448
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2447
2449
  body.tenant_id = params.tenantId;
2448
2450
  }
2449
2451
 
2452
+ if (params.domainName) {
2453
+ body.domain_name = params.domainName;
2454
+ }
2455
+
2450
2456
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2451
2457
  },
2452
2458
 
@@ -2459,6 +2465,7 @@ var authMethods = (client , baseUrl ) => ({
2459
2465
  expiration ,
2460
2466
  isMobile = false,
2461
2467
  tenantId ,
2468
+ domainName ,
2462
2469
  ) => {
2463
2470
  const body = {
2464
2471
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2468,9 +2475,14 @@ var authMethods = (client , baseUrl ) => ({
2468
2475
  };
2469
2476
 
2470
2477
  if (tenantId) {
2478
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2471
2479
  body.tenant_id = tenantId;
2472
2480
  }
2473
2481
 
2482
+ if (domainName) {
2483
+ body.domain_name = domainName;
2484
+ }
2485
+
2474
2486
  const headers = {
2475
2487
  'Content-Type': 'application/json',
2476
2488
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4724,6 +4736,7 @@ class ApiClient {
4724
4736
 
4725
4737
 
4726
4738
 
4739
+
4727
4740
 
4728
4741
 
4729
4742
 
@@ -4765,6 +4778,7 @@ class ApiClient {
4765
4778
  refreshToken: this.refreshToken,
4766
4779
  refreshBackend: this.refreshBackend,
4767
4780
  refreshTenantId: this.refreshTenantId,
4781
+ refreshDomainName: this.refreshDomainName,
4768
4782
  refreshExpiration: this.refreshExpiration,
4769
4783
  isMobile: this.isMobile,
4770
4784
  });
@@ -4780,6 +4794,7 @@ class ApiClient {
4780
4794
  this.refreshExpiration,
4781
4795
  this.isMobile,
4782
4796
  this.refreshTenantId,
4797
+ this.refreshDomainName,
4783
4798
  );
4784
4799
 
4785
4800
  logger.info('token refreshed', { token: session.token });
@@ -4833,9 +4848,14 @@ class ApiClient {
4833
4848
  }
4834
4849
 
4835
4850
  setRefreshTenantId(tenantId ) {
4851
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4836
4852
  this.refreshTenantId = tenantId;
4837
4853
  }
4838
4854
 
4855
+ setRefreshDomainName(domainName ) {
4856
+ this.refreshDomainName = domainName;
4857
+ }
4858
+
4839
4859
  setIsMobile(isMobile ) {
4840
4860
  this.isMobile = isMobile;
4841
4861
  }
@@ -4860,6 +4880,7 @@ global.wazoClientId = global.wazoClientId || {};
4860
4880
  global.wazoClientToken = global.wazoClientToken || {};
4861
4881
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4862
4882
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4883
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4863
4884
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4864
4885
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4865
4886
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4869,6 +4890,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
4869
4890
 
4870
4891
  const fillClient = (apiClient ) => {
4871
4892
  const { server, token, clientId } = apiClient.client;
4893
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
4872
4894
 
4873
4895
  // try with null server when dealing with non-related server info
4874
4896
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -4877,8 +4899,12 @@ const fillClient = (apiClient ) => {
4877
4899
 
4878
4900
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
4879
4901
 
4880
- apiClient.setRefreshTenantId(
4881
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
4902
+ if (tenantId) {
4903
+ apiClient.setRefreshTenantId(tenantId);
4904
+ }
4905
+
4906
+ apiClient.setRefreshDomainName(
4907
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
4882
4908
  );
4883
4909
 
4884
4910
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -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' } : {}),
@@ -4724,6 +4736,7 @@ class ApiClient {
4724
4736
 
4725
4737
 
4726
4738
 
4739
+
4727
4740
 
4728
4741
 
4729
4742
 
@@ -4765,6 +4778,7 @@ class ApiClient {
4765
4778
  refreshToken: this.refreshToken,
4766
4779
  refreshBackend: this.refreshBackend,
4767
4780
  refreshTenantId: this.refreshTenantId,
4781
+ refreshDomainName: this.refreshDomainName,
4768
4782
  refreshExpiration: this.refreshExpiration,
4769
4783
  isMobile: this.isMobile,
4770
4784
  });
@@ -4780,6 +4794,7 @@ class ApiClient {
4780
4794
  this.refreshExpiration,
4781
4795
  this.isMobile,
4782
4796
  this.refreshTenantId,
4797
+ this.refreshDomainName,
4783
4798
  );
4784
4799
 
4785
4800
  logger.info('token refreshed', { token: session.token });
@@ -4833,9 +4848,14 @@ class ApiClient {
4833
4848
  }
4834
4849
 
4835
4850
  setRefreshTenantId(tenantId ) {
4851
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4836
4852
  this.refreshTenantId = tenantId;
4837
4853
  }
4838
4854
 
4855
+ setRefreshDomainName(domainName ) {
4856
+ this.refreshDomainName = domainName;
4857
+ }
4858
+
4839
4859
  setIsMobile(isMobile ) {
4840
4860
  this.isMobile = isMobile;
4841
4861
  }
@@ -4860,6 +4880,7 @@ global.wazoClientId = global.wazoClientId || {};
4860
4880
  global.wazoClientToken = global.wazoClientToken || {};
4861
4881
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4862
4882
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4883
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4863
4884
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4864
4885
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4865
4886
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4869,6 +4890,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
4869
4890
 
4870
4891
  const fillClient = (apiClient ) => {
4871
4892
  const { server, token, clientId } = apiClient.client;
4893
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
4872
4894
 
4873
4895
  // try with null server when dealing with non-related server info
4874
4896
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -4877,8 +4899,12 @@ const fillClient = (apiClient ) => {
4877
4899
 
4878
4900
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
4879
4901
 
4880
- apiClient.setRefreshTenantId(
4881
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
4902
+ if (tenantId) {
4903
+ apiClient.setRefreshTenantId(tenantId);
4904
+ }
4905
+
4906
+ apiClient.setRefreshDomainName(
4907
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
4882
4908
  );
4883
4909
 
4884
4910
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);