@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
@@ -2229,6 +2229,7 @@ var authMethods = (client , baseUrl ) => ({
2229
2229
 
2230
2230
 
2231
2231
 
2232
+
2232
2233
  ) {
2233
2234
  const body = {
2234
2235
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2249,9 +2250,14 @@ var authMethods = (client , baseUrl ) => ({
2249
2250
  }
2250
2251
 
2251
2252
  if (params.tenantId) {
2253
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2252
2254
  body.tenant_id = params.tenantId;
2253
2255
  }
2254
2256
 
2257
+ if (params.domainName) {
2258
+ body.domain_name = params.domainName;
2259
+ }
2260
+
2255
2261
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2256
2262
  },
2257
2263
 
@@ -2264,6 +2270,7 @@ var authMethods = (client , baseUrl ) => ({
2264
2270
  expiration ,
2265
2271
  isMobile = false,
2266
2272
  tenantId ,
2273
+ domainName ,
2267
2274
  ) => {
2268
2275
  const body = {
2269
2276
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2273,9 +2280,14 @@ var authMethods = (client , baseUrl ) => ({
2273
2280
  };
2274
2281
 
2275
2282
  if (tenantId) {
2283
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2276
2284
  body.tenant_id = tenantId;
2277
2285
  }
2278
2286
 
2287
+ if (domainName) {
2288
+ body.domain_name = domainName;
2289
+ }
2290
+
2279
2291
  const headers = {
2280
2292
  'Content-Type': 'application/json',
2281
2293
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -5573,6 +5585,7 @@ class ApiClient {
5573
5585
 
5574
5586
 
5575
5587
 
5588
+
5576
5589
 
5577
5590
 
5578
5591
 
@@ -5614,6 +5627,7 @@ class ApiClient {
5614
5627
  refreshToken: this.refreshToken,
5615
5628
  refreshBackend: this.refreshBackend,
5616
5629
  refreshTenantId: this.refreshTenantId,
5630
+ refreshDomainName: this.refreshDomainName,
5617
5631
  refreshExpiration: this.refreshExpiration,
5618
5632
  isMobile: this.isMobile,
5619
5633
  });
@@ -5629,6 +5643,7 @@ class ApiClient {
5629
5643
  this.refreshExpiration,
5630
5644
  this.isMobile,
5631
5645
  this.refreshTenantId,
5646
+ this.refreshDomainName,
5632
5647
  );
5633
5648
 
5634
5649
  logger$a.info('token refreshed', { token: session.token });
@@ -5682,9 +5697,14 @@ class ApiClient {
5682
5697
  }
5683
5698
 
5684
5699
  setRefreshTenantId(tenantId ) {
5700
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
5685
5701
  this.refreshTenantId = tenantId;
5686
5702
  }
5687
5703
 
5704
+ setRefreshDomainName(domainName ) {
5705
+ this.refreshDomainName = domainName;
5706
+ }
5707
+
5688
5708
  setIsMobile(isMobile ) {
5689
5709
  this.isMobile = isMobile;
5690
5710
  }
@@ -5709,6 +5729,7 @@ global.wazoClientId = global.wazoClientId || {};
5709
5729
  global.wazoClientToken = global.wazoClientToken || {};
5710
5730
  global.wazoRefreshToken = global.wazoRefreshToken || {};
5711
5731
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
5732
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
5712
5733
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
5713
5734
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
5714
5735
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -5733,9 +5754,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
5733
5754
  };
5734
5755
 
5735
5756
  const setRefreshTenantId = (refreshTenantId , forServer = null) => {
5757
+ console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
5736
5758
  global.wazoRefreshTenantId[forServer] = refreshTenantId;
5737
5759
  };
5738
5760
 
5761
+ const setRefreshDomainName = (refreshDomainName , forServer = null) => {
5762
+ global.wazoRefreshDomainName[forServer] = refreshDomainName;
5763
+ };
5764
+
5739
5765
  const setOnRefreshToken = (onRefreshToken , forServer = null) => {
5740
5766
  global.wazoOnRefreshToken[forServer] = onRefreshToken;
5741
5767
  };
@@ -5754,6 +5780,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
5754
5780
 
5755
5781
  const fillClient = (apiClient ) => {
5756
5782
  const { server, token, clientId } = apiClient.client;
5783
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
5757
5784
 
5758
5785
  // try with null server when dealing with non-related server info
5759
5786
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -5762,8 +5789,12 @@ const fillClient = (apiClient ) => {
5762
5789
 
5763
5790
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
5764
5791
 
5765
- apiClient.setRefreshTenantId(
5766
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
5792
+ if (tenantId) {
5793
+ apiClient.setRefreshTenantId(tenantId);
5794
+ }
5795
+
5796
+ apiClient.setRefreshDomainName(
5797
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
5767
5798
  );
5768
5799
 
5769
5800
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -7460,9 +7491,11 @@ class WebRTCClient extends Emitter {
7460
7491
  const videoTracks = localStream.getVideoTracks();
7461
7492
 
7462
7493
  // Remove video senders
7463
- pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
7464
- videoSender.replaceTrack(null);
7465
- });
7494
+ if (pc.getSenders) {
7495
+ pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
7496
+ videoSender.replaceTrack(null);
7497
+ });
7498
+ }
7466
7499
 
7467
7500
  videoTracks.forEach(videoTrack => {
7468
7501
  videoTrack.enabled = false;
@@ -7695,7 +7728,8 @@ class WebRTCClient extends Emitter {
7695
7728
  const constraints = { audio: { deviceId: { exact: deviceId } } };
7696
7729
  const stream = await navigator.mediaDevices.getUserMedia(constraints);
7697
7730
  const audioTrack = stream.getAudioTracks()[0];
7698
- const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7731
+ const sender = pc && pc.getSenders
7732
+ && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
7699
7733
 
7700
7734
  if (sender) {
7701
7735
  if (sender.track) {
@@ -7758,10 +7792,11 @@ class WebRTCClient extends Emitter {
7758
7792
  // $FlowFixMe
7759
7793
  return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
7760
7794
  const videoTrack = stream.getVideoTracks()[0];
7761
- let sender = pc && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
7795
+ let sender = pc && pc.getSenders
7796
+ && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
7762
7797
  let wasTrackEnabled = false;
7763
7798
  if (!sender) {
7764
- sender = pc && pc.getSenders().find(s => !s.track);
7799
+ sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
7765
7800
  }
7766
7801
 
7767
7802
  if (sender) {
@@ -9295,7 +9330,7 @@ class WebRTCPhone extends Emitter {
9295
9330
  const screenTrack = screenShareStream.getVideoTracks()[0];
9296
9331
  const sipSession = this.currentSipSession;
9297
9332
  const pc = this.client.getPeerConnection(this.getSipSessionId(sipSession));
9298
- const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9333
+ const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9299
9334
  const localStream = this.client.getLocalStream(this.getSipSessionId(sipSession));
9300
9335
  const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
9301
9336
  const hadVideo = !!videoTrack;
@@ -9333,9 +9368,7 @@ class WebRTCPhone extends Emitter {
9333
9368
 
9334
9369
  try {
9335
9370
  if (this.currentScreenShare.stream) {
9336
- this.currentScreenShare.stream.getTracks()
9337
- .filter(track => track.kind === 'video')
9338
- .forEach(track => track.stop());
9371
+ this.currentScreenShare.stream.getTracks().forEach(track => track.stop());
9339
9372
  }
9340
9373
 
9341
9374
  if (restoreLocalStream) {
@@ -9379,7 +9412,7 @@ class WebRTCPhone extends Emitter {
9379
9412
  const screenTrack = screenStream.getVideoTracks()[0];
9380
9413
  const sipSessionId = this.getSipSessionId(sipSession);
9381
9414
  const pc = this.client.getPeerConnection(sipSessionId);
9382
- const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9415
+ const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9383
9416
 
9384
9417
  logger$8.info('WebRTC phone - on screensharing', {
9385
9418
  hadVideo,
@@ -13994,6 +14027,7 @@ class Softphone {
13994
14027
  wrapUpDuration,
13995
14028
  enableAgent = true,
13996
14029
  tenantId,
14030
+ domainName,
13997
14031
  debug = false,
13998
14032
  } = {}) {
13999
14033
  this.url = url || 'https://softphone.wazo.io';
@@ -14018,8 +14052,12 @@ class Softphone {
14018
14052
  config.port = port;
14019
14053
  }
14020
14054
  if (tenantId) {
14055
+ console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
14021
14056
  config.tenantId = tenantId;
14022
14057
  }
14058
+ if (domainName) {
14059
+ config.domainName = domainName;
14060
+ }
14023
14061
  if (wrapUpDuration) {
14024
14062
  config.wrapUpDuration = wrapUpDuration;
14025
14063
  }
@@ -14340,6 +14378,7 @@ const Wazo = {
14340
14378
  CanceledCallError,
14341
14379
  SFUNotAvailableError,
14342
14380
  NoTenantIdError,
14381
+ NoDomainNameError,
14343
14382
  };
14344
14383
 
14345
14384
  if (window) {
@@ -14354,6 +14393,7 @@ if (global) {
14354
14393
  class InvalidSubscription extends Error {}
14355
14394
  class InvalidAuthorization extends Error {}
14356
14395
  class NoTenantIdError extends Error {}
14396
+ class NoDomainNameError extends Error {}
14357
14397
 
14358
14398
  const logger = IssueReporter$1.loggerFor('simple-auth');
14359
14399
 
@@ -14417,9 +14457,24 @@ class Auth {
14417
14457
  setFetchOptions(options);
14418
14458
  }
14419
14459
 
14420
- async logIn(username , password , backend , tenantId ) {
14421
- if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
14422
- throw new NoTenantIdError('No tenant id');
14460
+ async logIn(username , password , backend , extra ) {
14461
+ let tenantId = null;
14462
+ let domainName = null;
14463
+ if (typeof extra === 'string') {
14464
+ tenantId = extra;
14465
+ }
14466
+ if (extra && typeof extra === 'object') {
14467
+ domainName = extra.domainName;
14468
+ }
14469
+
14470
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
14471
+ if (!tenantId) {
14472
+ throw new NoTenantIdError('No tenant id');
14473
+ }
14474
+
14475
+ if (!domainName) {
14476
+ throw new NoDomainNameError('No domain name');
14477
+ }
14423
14478
  }
14424
14479
 
14425
14480
  this.authenticated = false;
@@ -14429,6 +14484,7 @@ class Auth {
14429
14484
  password,
14430
14485
  backend,
14431
14486
  tenantId,
14487
+ domainName,
14432
14488
  expiration: this.expiration,
14433
14489
  mobile: this.mobile,
14434
14490
  });
@@ -14437,7 +14493,13 @@ class Auth {
14437
14493
  getApiClient().setRefreshBackend(backend);
14438
14494
  }
14439
14495
 
14440
- getApiClient().setRefreshTenantId(tenantId);
14496
+ if (tenantId) {
14497
+ getApiClient().setRefreshTenantId(tenantId);
14498
+ }
14499
+
14500
+ if (domainName) {
14501
+ getApiClient().setRefreshDomainName(domainName);
14502
+ }
14441
14503
 
14442
14504
  return this._onAuthenticated(rawSession);
14443
14505
  }
@@ -14536,11 +14598,18 @@ class Auth {
14536
14598
  }
14537
14599
 
14538
14600
  setRefreshTenantId(refreshTenantId ) {
14601
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
14539
14602
  setRefreshTenantId(refreshTenantId);
14540
14603
 
14541
14604
  getApiClient().setRefreshTenantId(refreshTenantId);
14542
14605
  }
14543
14606
 
14607
+ setRefreshDomainName(domainName ) {
14608
+ setRefreshDomainName(domainName);
14609
+
14610
+ getApiClient().setRefreshDomainName(domainName);
14611
+ }
14612
+
14544
14613
  forceRefreshToken() {
14545
14614
  getApiClient().forceRefreshToken();
14546
14615
  }
@@ -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);