@wazo/sdk 0.38.9 → 0.38.10

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 (76) 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 +21 -0
  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 +21 -0
  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 +21 -0
  11. package/esm/checker/checks/webrtc-transport.js +21 -0
  12. package/esm/checker/checks/webrtc.js +21 -0
  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 +1 -0
  17. package/esm/index.js +73 -6
  18. package/esm/service/CallApi.js +28 -2
  19. package/esm/service/getApiClient.js +34 -3
  20. package/esm/simple/Auth.js +74 -7
  21. package/esm/simple/Configuration.js +73 -6
  22. package/esm/simple/Directory.js +28 -2
  23. package/esm/simple/Phone.js +73 -6
  24. package/esm/simple/Softphone.js +5 -0
  25. package/esm/simple/index.js +73 -6
  26. package/esm/simple/room/LocalParticipant.js +73 -6
  27. package/esm/simple/room/Participant.js +73 -6
  28. package/esm/simple/room/RemoteParticipant.js +73 -6
  29. package/esm/simple/room/Room.js +73 -6
  30. package/esm/simple/room/SipRoom.js +73 -6
  31. package/esm/simple/room/Stream.js +73 -6
  32. package/esm/simple/room/__tests__/Participant.test.js +73 -6
  33. package/esm/simple/room/__tests__/RemoteParticipant.test.js +73 -6
  34. package/esm/simple/utils.js +73 -6
  35. package/esm/web-rtc-client.js +21 -0
  36. package/lib/__tests__/api-client.test.js +21 -0
  37. package/lib/__tests__/web-rtc-client.test.js +21 -0
  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 +21 -0
  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 +21 -0
  45. package/lib/checker/checks/webrtc-transport.js +21 -0
  46. package/lib/checker/checks/webrtc.js +21 -0
  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 +1 -0
  51. package/lib/index.js +73 -6
  52. package/lib/service/CallApi.js +28 -2
  53. package/lib/service/getApiClient.js +34 -2
  54. package/lib/simple/Auth.js +74 -6
  55. package/lib/simple/Configuration.js +73 -6
  56. package/lib/simple/Directory.js +28 -2
  57. package/lib/simple/Phone.js +73 -6
  58. package/lib/simple/Softphone.js +5 -0
  59. package/lib/simple/index.js +73 -6
  60. package/lib/simple/room/LocalParticipant.js +73 -6
  61. package/lib/simple/room/Participant.js +73 -6
  62. package/lib/simple/room/RemoteParticipant.js +73 -6
  63. package/lib/simple/room/Room.js +73 -6
  64. package/lib/simple/room/SipRoom.js +73 -6
  65. package/lib/simple/room/Stream.js +73 -6
  66. package/lib/simple/room/__tests__/Participant.test.js +73 -6
  67. package/lib/simple/room/__tests__/RemoteParticipant.test.js +73 -6
  68. package/lib/simple/utils.js +73 -6
  69. package/lib/web-rtc-client.js +21 -0
  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/service/getApiClient.js +13 -2
  74. package/src/simple/Auth.js +35 -4
  75. package/src/simple/Softphone.js +5 -0
  76. package/src/simple/index.js +2 -1
package/esm/index.js CHANGED
@@ -2230,6 +2230,7 @@ var authMethods = (client , baseUrl ) => ({
2230
2230
 
2231
2231
 
2232
2232
 
2233
+
2233
2234
  ) {
2234
2235
  const body = {
2235
2236
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2250,9 +2251,14 @@ var authMethods = (client , baseUrl ) => ({
2250
2251
  }
2251
2252
 
2252
2253
  if (params.tenantId) {
2254
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2253
2255
  body.tenant_id = params.tenantId;
2254
2256
  }
2255
2257
 
2258
+ if (params.domainName) {
2259
+ body.domain_name = params.domainName;
2260
+ }
2261
+
2256
2262
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2257
2263
  },
2258
2264
 
@@ -2265,6 +2271,7 @@ var authMethods = (client , baseUrl ) => ({
2265
2271
  expiration ,
2266
2272
  isMobile = false,
2267
2273
  tenantId ,
2274
+ domainName ,
2268
2275
  ) => {
2269
2276
  const body = {
2270
2277
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2274,9 +2281,14 @@ var authMethods = (client , baseUrl ) => ({
2274
2281
  };
2275
2282
 
2276
2283
  if (tenantId) {
2284
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2277
2285
  body.tenant_id = tenantId;
2278
2286
  }
2279
2287
 
2288
+ if (domainName) {
2289
+ body.domain_name = domainName;
2290
+ }
2291
+
2280
2292
  const headers = {
2281
2293
  'Content-Type': 'application/json',
2282
2294
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4123,6 +4135,7 @@ global.wazoClientId = global.wazoClientId || {};
4123
4135
  global.wazoClientToken = global.wazoClientToken || {};
4124
4136
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4125
4137
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4138
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4126
4139
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4127
4140
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4128
4141
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4147,9 +4160,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
4147
4160
  };
4148
4161
 
4149
4162
  const setRefreshTenantId = (refreshTenantId , forServer = null) => {
4163
+ console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
4150
4164
  global.wazoRefreshTenantId[forServer] = refreshTenantId;
4151
4165
  };
4152
4166
 
4167
+ const setRefreshDomainName = (refreshDomainName , forServer = null) => {
4168
+ global.wazoRefreshDomainName[forServer] = refreshDomainName;
4169
+ };
4170
+
4153
4171
  const setOnRefreshToken = (onRefreshToken , forServer = null) => {
4154
4172
  global.wazoOnRefreshToken[forServer] = onRefreshToken;
4155
4173
  };
@@ -4168,6 +4186,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
4168
4186
 
4169
4187
  const fillClient = (apiClient ) => {
4170
4188
  const { server, token, clientId } = apiClient.client;
4189
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
4171
4190
 
4172
4191
  // try with null server when dealing with non-related server info
4173
4192
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -4176,8 +4195,12 @@ const fillClient = (apiClient ) => {
4176
4195
 
4177
4196
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
4178
4197
 
4179
- apiClient.setRefreshTenantId(
4180
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
4198
+ if (tenantId) {
4199
+ apiClient.setRefreshTenantId(tenantId);
4200
+ }
4201
+
4202
+ apiClient.setRefreshDomainName(
4203
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
4181
4204
  );
4182
4205
 
4183
4206
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -5675,6 +5698,7 @@ class ApiClient {
5675
5698
 
5676
5699
 
5677
5700
 
5701
+
5678
5702
 
5679
5703
 
5680
5704
 
@@ -5716,6 +5740,7 @@ class ApiClient {
5716
5740
  refreshToken: this.refreshToken,
5717
5741
  refreshBackend: this.refreshBackend,
5718
5742
  refreshTenantId: this.refreshTenantId,
5743
+ refreshDomainName: this.refreshDomainName,
5719
5744
  refreshExpiration: this.refreshExpiration,
5720
5745
  isMobile: this.isMobile,
5721
5746
  });
@@ -5731,6 +5756,7 @@ class ApiClient {
5731
5756
  this.refreshExpiration,
5732
5757
  this.isMobile,
5733
5758
  this.refreshTenantId,
5759
+ this.refreshDomainName,
5734
5760
  );
5735
5761
 
5736
5762
  logger$a.info('token refreshed', { token: session.token });
@@ -5784,9 +5810,14 @@ class ApiClient {
5784
5810
  }
5785
5811
 
5786
5812
  setRefreshTenantId(tenantId ) {
5813
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
5787
5814
  this.refreshTenantId = tenantId;
5788
5815
  }
5789
5816
 
5817
+ setRefreshDomainName(domainName ) {
5818
+ this.refreshDomainName = domainName;
5819
+ }
5820
+
5790
5821
  setIsMobile(isMobile ) {
5791
5822
  this.isMobile = isMobile;
5792
5823
  }
@@ -11944,6 +11975,7 @@ const getCallableNumber = (number , country ) => {
11944
11975
  class InvalidSubscription extends Error {}
11945
11976
  class InvalidAuthorization extends Error {}
11946
11977
  class NoTenantIdError extends Error {}
11978
+ class NoDomainNameError extends Error {}
11947
11979
 
11948
11980
  const logger$5 = IssueReporter$1.loggerFor('simple-auth');
11949
11981
 
@@ -12007,9 +12039,24 @@ class Auth {
12007
12039
  setFetchOptions(options);
12008
12040
  }
12009
12041
 
12010
- async logIn(username , password , backend , tenantId ) {
12011
- if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
12012
- throw new NoTenantIdError('No tenant id');
12042
+ async logIn(username , password , backend , extra ) {
12043
+ let tenantId = null;
12044
+ let domainName = null;
12045
+ if (typeof extra === 'string') {
12046
+ tenantId = extra;
12047
+ }
12048
+ if (extra && typeof extra === 'object') {
12049
+ domainName = extra.domainName;
12050
+ }
12051
+
12052
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
12053
+ if (!tenantId) {
12054
+ throw new NoTenantIdError('No tenant id');
12055
+ }
12056
+
12057
+ if (!domainName) {
12058
+ throw new NoDomainNameError('No domain name');
12059
+ }
12013
12060
  }
12014
12061
 
12015
12062
  this.authenticated = false;
@@ -12019,6 +12066,7 @@ class Auth {
12019
12066
  password,
12020
12067
  backend,
12021
12068
  tenantId,
12069
+ domainName,
12022
12070
  expiration: this.expiration,
12023
12071
  mobile: this.mobile,
12024
12072
  });
@@ -12027,7 +12075,13 @@ class Auth {
12027
12075
  getApiClient().setRefreshBackend(backend);
12028
12076
  }
12029
12077
 
12030
- getApiClient().setRefreshTenantId(tenantId);
12078
+ if (tenantId) {
12079
+ getApiClient().setRefreshTenantId(tenantId);
12080
+ }
12081
+
12082
+ if (domainName) {
12083
+ getApiClient().setRefreshDomainName(domainName);
12084
+ }
12031
12085
 
12032
12086
  return this._onAuthenticated(rawSession);
12033
12087
  }
@@ -12126,11 +12180,18 @@ class Auth {
12126
12180
  }
12127
12181
 
12128
12182
  setRefreshTenantId(refreshTenantId ) {
12183
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
12129
12184
  setRefreshTenantId(refreshTenantId);
12130
12185
 
12131
12186
  getApiClient().setRefreshTenantId(refreshTenantId);
12132
12187
  }
12133
12188
 
12189
+ setRefreshDomainName(domainName ) {
12190
+ setRefreshDomainName(domainName);
12191
+
12192
+ getApiClient().setRefreshDomainName(domainName);
12193
+ }
12194
+
12134
12195
  forceRefreshToken() {
12135
12196
  getApiClient().forceRefreshToken();
12136
12197
  }
@@ -14448,6 +14509,7 @@ class Softphone {
14448
14509
  wrapUpDuration,
14449
14510
  enableAgent = true,
14450
14511
  tenantId,
14512
+ domainName,
14451
14513
  debug = false,
14452
14514
  } = {}) {
14453
14515
  this.url = url || 'https://softphone.wazo.io';
@@ -14472,8 +14534,12 @@ class Softphone {
14472
14534
  config.port = port;
14473
14535
  }
14474
14536
  if (tenantId) {
14537
+ console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
14475
14538
  config.tenantId = tenantId;
14476
14539
  }
14540
+ if (domainName) {
14541
+ config.domainName = domainName;
14542
+ }
14477
14543
  if (wrapUpDuration) {
14478
14544
  config.wrapUpDuration = wrapUpDuration;
14479
14545
  }
@@ -14794,6 +14860,7 @@ const Wazo = {
14794
14860
  CanceledCallError,
14795
14861
  SFUNotAvailableError,
14796
14862
  NoTenantIdError,
14863
+ NoDomainNameError,
14797
14864
  };
14798
14865
 
14799
14866
  if (window) {
@@ -2755,6 +2755,7 @@ var authMethods = (client , baseUrl ) => ({
2755
2755
 
2756
2756
 
2757
2757
 
2758
+
2758
2759
  ) {
2759
2760
  const body = {
2760
2761
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2775,9 +2776,14 @@ var authMethods = (client , baseUrl ) => ({
2775
2776
  }
2776
2777
 
2777
2778
  if (params.tenantId) {
2779
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2778
2780
  body.tenant_id = params.tenantId;
2779
2781
  }
2780
2782
 
2783
+ if (params.domainName) {
2784
+ body.domain_name = params.domainName;
2785
+ }
2786
+
2781
2787
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2782
2788
  },
2783
2789
 
@@ -2790,6 +2796,7 @@ var authMethods = (client , baseUrl ) => ({
2790
2796
  expiration ,
2791
2797
  isMobile = false,
2792
2798
  tenantId ,
2799
+ domainName ,
2793
2800
  ) => {
2794
2801
  const body = {
2795
2802
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2799,9 +2806,14 @@ var authMethods = (client , baseUrl ) => ({
2799
2806
  };
2800
2807
 
2801
2808
  if (tenantId) {
2809
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2802
2810
  body.tenant_id = tenantId;
2803
2811
  }
2804
2812
 
2813
+ if (domainName) {
2814
+ body.domain_name = domainName;
2815
+ }
2816
+
2805
2817
  const headers = {
2806
2818
  'Content-Type': 'application/json',
2807
2819
  ...(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 || {};
@@ -4884,9 +4905,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
4884
4905
  };
4885
4906
 
4886
4907
  const setRefreshTenantId = (refreshTenantId , forServer = null) => {
4908
+ console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
4887
4909
  global.wazoRefreshTenantId[forServer] = refreshTenantId;
4888
4910
  };
4889
4911
 
4912
+ const setRefreshDomainName = (refreshDomainName , forServer = null) => {
4913
+ global.wazoRefreshDomainName[forServer] = refreshDomainName;
4914
+ };
4915
+
4890
4916
  const setOnRefreshToken = (onRefreshToken , forServer = null) => {
4891
4917
  global.wazoOnRefreshToken[forServer] = onRefreshToken;
4892
4918
  };
@@ -4913,6 +4939,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
4913
4939
 
4914
4940
  const fillClient = (apiClient ) => {
4915
4941
  const { server, token, clientId } = apiClient.client;
4942
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
4916
4943
 
4917
4944
  // try with null server when dealing with non-related server info
4918
4945
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -4921,8 +4948,12 @@ const fillClient = (apiClient ) => {
4921
4948
 
4922
4949
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
4923
4950
 
4924
- apiClient.setRefreshTenantId(
4925
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
4951
+ if (tenantId) {
4952
+ apiClient.setRefreshTenantId(tenantId);
4953
+ }
4954
+
4955
+ apiClient.setRefreshDomainName(
4956
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
4926
4957
  );
4927
4958
 
4928
4959
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -4960,4 +4991,4 @@ var getApiClient = (forServer = null) => {
4960
4991
  };
4961
4992
 
4962
4993
  export default getApiClient;
4963
- export { setApiClientId, setApiToken, setCurrentServer, setFetchOptions, setIsMobile, setOnRefreshToken, setOnRefreshTokenError, setRefreshBackend, setRefreshExpiration, setRefreshTenantId, setRefreshToken };
4994
+ export { setApiClientId, setApiToken, setCurrentServer, setFetchOptions, setIsMobile, setOnRefreshToken, setOnRefreshTokenError, setRefreshBackend, setRefreshDomainName, setRefreshExpiration, setRefreshTenantId, setRefreshToken };