@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/lib/index.js CHANGED
@@ -2241,6 +2241,7 @@ var authMethods = (client , baseUrl ) => ({
2241
2241
 
2242
2242
 
2243
2243
 
2244
+
2244
2245
  ) {
2245
2246
  const body = {
2246
2247
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2261,9 +2262,14 @@ var authMethods = (client , baseUrl ) => ({
2261
2262
  }
2262
2263
 
2263
2264
  if (params.tenantId) {
2265
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2264
2266
  body.tenant_id = params.tenantId;
2265
2267
  }
2266
2268
 
2269
+ if (params.domainName) {
2270
+ body.domain_name = params.domainName;
2271
+ }
2272
+
2267
2273
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2268
2274
  },
2269
2275
 
@@ -2276,6 +2282,7 @@ var authMethods = (client , baseUrl ) => ({
2276
2282
  expiration ,
2277
2283
  isMobile = false,
2278
2284
  tenantId ,
2285
+ domainName ,
2279
2286
  ) => {
2280
2287
  const body = {
2281
2288
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2285,9 +2292,14 @@ var authMethods = (client , baseUrl ) => ({
2285
2292
  };
2286
2293
 
2287
2294
  if (tenantId) {
2295
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2288
2296
  body.tenant_id = tenantId;
2289
2297
  }
2290
2298
 
2299
+ if (domainName) {
2300
+ body.domain_name = domainName;
2301
+ }
2302
+
2291
2303
  const headers = {
2292
2304
  'Content-Type': 'application/json',
2293
2305
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4134,6 +4146,7 @@ global.wazoClientId = global.wazoClientId || {};
4134
4146
  global.wazoClientToken = global.wazoClientToken || {};
4135
4147
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4136
4148
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4149
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4137
4150
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4138
4151
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4139
4152
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4158,9 +4171,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
4158
4171
  };
4159
4172
 
4160
4173
  const setRefreshTenantId = (refreshTenantId , forServer = null) => {
4174
+ console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
4161
4175
  global.wazoRefreshTenantId[forServer] = refreshTenantId;
4162
4176
  };
4163
4177
 
4178
+ const setRefreshDomainName = (refreshDomainName , forServer = null) => {
4179
+ global.wazoRefreshDomainName[forServer] = refreshDomainName;
4180
+ };
4181
+
4164
4182
  const setOnRefreshToken = (onRefreshToken , forServer = null) => {
4165
4183
  global.wazoOnRefreshToken[forServer] = onRefreshToken;
4166
4184
  };
@@ -4179,6 +4197,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
4179
4197
 
4180
4198
  const fillClient = (apiClient ) => {
4181
4199
  const { server, token, clientId } = apiClient.client;
4200
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
4182
4201
 
4183
4202
  // try with null server when dealing with non-related server info
4184
4203
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -4187,8 +4206,12 @@ const fillClient = (apiClient ) => {
4187
4206
 
4188
4207
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
4189
4208
 
4190
- apiClient.setRefreshTenantId(
4191
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
4209
+ if (tenantId) {
4210
+ apiClient.setRefreshTenantId(tenantId);
4211
+ }
4212
+
4213
+ apiClient.setRefreshDomainName(
4214
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
4192
4215
  );
4193
4216
 
4194
4217
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -5686,6 +5709,7 @@ class ApiClient {
5686
5709
 
5687
5710
 
5688
5711
 
5712
+
5689
5713
 
5690
5714
 
5691
5715
 
@@ -5727,6 +5751,7 @@ class ApiClient {
5727
5751
  refreshToken: this.refreshToken,
5728
5752
  refreshBackend: this.refreshBackend,
5729
5753
  refreshTenantId: this.refreshTenantId,
5754
+ refreshDomainName: this.refreshDomainName,
5730
5755
  refreshExpiration: this.refreshExpiration,
5731
5756
  isMobile: this.isMobile,
5732
5757
  });
@@ -5742,6 +5767,7 @@ class ApiClient {
5742
5767
  this.refreshExpiration,
5743
5768
  this.isMobile,
5744
5769
  this.refreshTenantId,
5770
+ this.refreshDomainName,
5745
5771
  );
5746
5772
 
5747
5773
  logger$a.info('token refreshed', { token: session.token });
@@ -5795,9 +5821,14 @@ class ApiClient {
5795
5821
  }
5796
5822
 
5797
5823
  setRefreshTenantId(tenantId ) {
5824
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
5798
5825
  this.refreshTenantId = tenantId;
5799
5826
  }
5800
5827
 
5828
+ setRefreshDomainName(domainName ) {
5829
+ this.refreshDomainName = domainName;
5830
+ }
5831
+
5801
5832
  setIsMobile(isMobile ) {
5802
5833
  this.isMobile = isMobile;
5803
5834
  }
@@ -11955,6 +11986,7 @@ const getCallableNumber = (number , country ) => {
11955
11986
  class InvalidSubscription extends Error {}
11956
11987
  class InvalidAuthorization extends Error {}
11957
11988
  class NoTenantIdError extends Error {}
11989
+ class NoDomainNameError extends Error {}
11958
11990
 
11959
11991
  const logger$5 = IssueReporter$1.loggerFor('simple-auth');
11960
11992
 
@@ -12018,9 +12050,24 @@ class Auth {
12018
12050
  setFetchOptions(options);
12019
12051
  }
12020
12052
 
12021
- async logIn(username , password , backend , tenantId ) {
12022
- if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
12023
- throw new NoTenantIdError('No tenant id');
12053
+ async logIn(username , password , backend , extra ) {
12054
+ let tenantId = null;
12055
+ let domainName = null;
12056
+ if (typeof extra === 'string') {
12057
+ tenantId = extra;
12058
+ }
12059
+ if (extra && typeof extra === 'object') {
12060
+ domainName = extra.domainName;
12061
+ }
12062
+
12063
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
12064
+ if (!tenantId) {
12065
+ throw new NoTenantIdError('No tenant id');
12066
+ }
12067
+
12068
+ if (!domainName) {
12069
+ throw new NoDomainNameError('No domain name');
12070
+ }
12024
12071
  }
12025
12072
 
12026
12073
  this.authenticated = false;
@@ -12030,6 +12077,7 @@ class Auth {
12030
12077
  password,
12031
12078
  backend,
12032
12079
  tenantId,
12080
+ domainName,
12033
12081
  expiration: this.expiration,
12034
12082
  mobile: this.mobile,
12035
12083
  });
@@ -12038,7 +12086,13 @@ class Auth {
12038
12086
  getApiClient().setRefreshBackend(backend);
12039
12087
  }
12040
12088
 
12041
- getApiClient().setRefreshTenantId(tenantId);
12089
+ if (tenantId) {
12090
+ getApiClient().setRefreshTenantId(tenantId);
12091
+ }
12092
+
12093
+ if (domainName) {
12094
+ getApiClient().setRefreshDomainName(domainName);
12095
+ }
12042
12096
 
12043
12097
  return this._onAuthenticated(rawSession);
12044
12098
  }
@@ -12137,11 +12191,18 @@ class Auth {
12137
12191
  }
12138
12192
 
12139
12193
  setRefreshTenantId(refreshTenantId ) {
12194
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
12140
12195
  setRefreshTenantId(refreshTenantId);
12141
12196
 
12142
12197
  getApiClient().setRefreshTenantId(refreshTenantId);
12143
12198
  }
12144
12199
 
12200
+ setRefreshDomainName(domainName ) {
12201
+ setRefreshDomainName(domainName);
12202
+
12203
+ getApiClient().setRefreshDomainName(domainName);
12204
+ }
12205
+
12145
12206
  forceRefreshToken() {
12146
12207
  getApiClient().forceRefreshToken();
12147
12208
  }
@@ -14459,6 +14520,7 @@ class Softphone {
14459
14520
  wrapUpDuration,
14460
14521
  enableAgent = true,
14461
14522
  tenantId,
14523
+ domainName,
14462
14524
  debug = false,
14463
14525
  } = {}) {
14464
14526
  this.url = url || 'https://softphone.wazo.io';
@@ -14483,8 +14545,12 @@ class Softphone {
14483
14545
  config.port = port;
14484
14546
  }
14485
14547
  if (tenantId) {
14548
+ console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
14486
14549
  config.tenantId = tenantId;
14487
14550
  }
14551
+ if (domainName) {
14552
+ config.domainName = domainName;
14553
+ }
14488
14554
  if (wrapUpDuration) {
14489
14555
  config.wrapUpDuration = wrapUpDuration;
14490
14556
  }
@@ -14805,6 +14871,7 @@ const Wazo = {
14805
14871
  CanceledCallError,
14806
14872
  SFUNotAvailableError,
14807
14873
  NoTenantIdError,
14874
+ NoDomainNameError,
14808
14875
  };
14809
14876
 
14810
14877
  if (window) {
@@ -2761,6 +2761,7 @@ var authMethods = (client , baseUrl ) => ({
2761
2761
 
2762
2762
 
2763
2763
 
2764
+
2764
2765
  ) {
2765
2766
  const body = {
2766
2767
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2781,9 +2782,14 @@ var authMethods = (client , baseUrl ) => ({
2781
2782
  }
2782
2783
 
2783
2784
  if (params.tenantId) {
2785
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2784
2786
  body.tenant_id = params.tenantId;
2785
2787
  }
2786
2788
 
2789
+ if (params.domainName) {
2790
+ body.domain_name = params.domainName;
2791
+ }
2792
+
2787
2793
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2788
2794
  },
2789
2795
 
@@ -2796,6 +2802,7 @@ var authMethods = (client , baseUrl ) => ({
2796
2802
  expiration ,
2797
2803
  isMobile = false,
2798
2804
  tenantId ,
2805
+ domainName ,
2799
2806
  ) => {
2800
2807
  const body = {
2801
2808
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2805,9 +2812,14 @@ var authMethods = (client , baseUrl ) => ({
2805
2812
  };
2806
2813
 
2807
2814
  if (tenantId) {
2815
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2808
2816
  body.tenant_id = tenantId;
2809
2817
  }
2810
2818
 
2819
+ if (domainName) {
2820
+ body.domain_name = domainName;
2821
+ }
2822
+
2811
2823
  const headers = {
2812
2824
  'Content-Type': 'application/json',
2813
2825
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4730,6 +4742,7 @@ class ApiClient {
4730
4742
 
4731
4743
 
4732
4744
 
4745
+
4733
4746
 
4734
4747
 
4735
4748
 
@@ -4771,6 +4784,7 @@ class ApiClient {
4771
4784
  refreshToken: this.refreshToken,
4772
4785
  refreshBackend: this.refreshBackend,
4773
4786
  refreshTenantId: this.refreshTenantId,
4787
+ refreshDomainName: this.refreshDomainName,
4774
4788
  refreshExpiration: this.refreshExpiration,
4775
4789
  isMobile: this.isMobile,
4776
4790
  });
@@ -4786,6 +4800,7 @@ class ApiClient {
4786
4800
  this.refreshExpiration,
4787
4801
  this.isMobile,
4788
4802
  this.refreshTenantId,
4803
+ this.refreshDomainName,
4789
4804
  );
4790
4805
 
4791
4806
  logger.info('token refreshed', { token: session.token });
@@ -4839,9 +4854,14 @@ class ApiClient {
4839
4854
  }
4840
4855
 
4841
4856
  setRefreshTenantId(tenantId ) {
4857
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4842
4858
  this.refreshTenantId = tenantId;
4843
4859
  }
4844
4860
 
4861
+ setRefreshDomainName(domainName ) {
4862
+ this.refreshDomainName = domainName;
4863
+ }
4864
+
4845
4865
  setIsMobile(isMobile ) {
4846
4866
  this.isMobile = isMobile;
4847
4867
  }
@@ -4866,6 +4886,7 @@ global.wazoClientId = global.wazoClientId || {};
4866
4886
  global.wazoClientToken = global.wazoClientToken || {};
4867
4887
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4868
4888
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4889
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4869
4890
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4870
4891
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4871
4892
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4875,6 +4896,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
4875
4896
 
4876
4897
  const fillClient = (apiClient ) => {
4877
4898
  const { server, token, clientId } = apiClient.client;
4899
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
4878
4900
 
4879
4901
  // try with null server when dealing with non-related server info
4880
4902
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -4883,8 +4905,12 @@ const fillClient = (apiClient ) => {
4883
4905
 
4884
4906
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
4885
4907
 
4886
- apiClient.setRefreshTenantId(
4887
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
4908
+ if (tenantId) {
4909
+ apiClient.setRefreshTenantId(tenantId);
4910
+ }
4911
+
4912
+ apiClient.setRefreshDomainName(
4913
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
4888
4914
  );
4889
4915
 
4890
4916
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -2217,6 +2217,7 @@ var authMethods = (client , baseUrl ) => ({
2217
2217
 
2218
2218
 
2219
2219
 
2220
+
2220
2221
  ) {
2221
2222
  const body = {
2222
2223
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2237,9 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
2237
2238
  }
2238
2239
 
2239
2240
  if (params.tenantId) {
2241
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2240
2242
  body.tenant_id = params.tenantId;
2241
2243
  }
2242
2244
 
2245
+ if (params.domainName) {
2246
+ body.domain_name = params.domainName;
2247
+ }
2248
+
2243
2249
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2244
2250
  },
2245
2251
 
@@ -2252,6 +2258,7 @@ var authMethods = (client , baseUrl ) => ({
2252
2258
  expiration ,
2253
2259
  isMobile = false,
2254
2260
  tenantId ,
2261
+ domainName ,
2255
2262
  ) => {
2256
2263
  const body = {
2257
2264
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2261,9 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
2261
2268
  };
2262
2269
 
2263
2270
  if (tenantId) {
2271
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2264
2272
  body.tenant_id = tenantId;
2265
2273
  }
2266
2274
 
2275
+ if (domainName) {
2276
+ body.domain_name = domainName;
2277
+ }
2278
+
2267
2279
  const headers = {
2268
2280
  'Content-Type': 'application/json',
2269
2281
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4732,6 +4744,7 @@ class ApiClient {
4732
4744
 
4733
4745
 
4734
4746
 
4747
+
4735
4748
 
4736
4749
 
4737
4750
 
@@ -4773,6 +4786,7 @@ class ApiClient {
4773
4786
  refreshToken: this.refreshToken,
4774
4787
  refreshBackend: this.refreshBackend,
4775
4788
  refreshTenantId: this.refreshTenantId,
4789
+ refreshDomainName: this.refreshDomainName,
4776
4790
  refreshExpiration: this.refreshExpiration,
4777
4791
  isMobile: this.isMobile,
4778
4792
  });
@@ -4788,6 +4802,7 @@ class ApiClient {
4788
4802
  this.refreshExpiration,
4789
4803
  this.isMobile,
4790
4804
  this.refreshTenantId,
4805
+ this.refreshDomainName,
4791
4806
  );
4792
4807
 
4793
4808
  logger.info('token refreshed', { token: session.token });
@@ -4841,9 +4856,14 @@ class ApiClient {
4841
4856
  }
4842
4857
 
4843
4858
  setRefreshTenantId(tenantId ) {
4859
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
4844
4860
  this.refreshTenantId = tenantId;
4845
4861
  }
4846
4862
 
4863
+ setRefreshDomainName(domainName ) {
4864
+ this.refreshDomainName = domainName;
4865
+ }
4866
+
4847
4867
  setIsMobile(isMobile ) {
4848
4868
  this.isMobile = isMobile;
4849
4869
  }
@@ -4868,6 +4888,7 @@ global.wazoClientId = global.wazoClientId || {};
4868
4888
  global.wazoClientToken = global.wazoClientToken || {};
4869
4889
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4870
4890
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4891
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4871
4892
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4872
4893
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4873
4894
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -4892,9 +4913,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
4892
4913
  };
4893
4914
 
4894
4915
  const setRefreshTenantId = (refreshTenantId , forServer = null) => {
4916
+ console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
4895
4917
  global.wazoRefreshTenantId[forServer] = refreshTenantId;
4896
4918
  };
4897
4919
 
4920
+ const setRefreshDomainName = (refreshDomainName , forServer = null) => {
4921
+ global.wazoRefreshDomainName[forServer] = refreshDomainName;
4922
+ };
4923
+
4898
4924
  const setOnRefreshToken = (onRefreshToken , forServer = null) => {
4899
4925
  global.wazoOnRefreshToken[forServer] = onRefreshToken;
4900
4926
  };
@@ -4921,6 +4947,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
4921
4947
 
4922
4948
  const fillClient = (apiClient ) => {
4923
4949
  const { server, token, clientId } = apiClient.client;
4950
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
4924
4951
 
4925
4952
  // try with null server when dealing with non-related server info
4926
4953
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -4929,8 +4956,12 @@ const fillClient = (apiClient ) => {
4929
4956
 
4930
4957
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
4931
4958
 
4932
- apiClient.setRefreshTenantId(
4933
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
4959
+ if (tenantId) {
4960
+ apiClient.setRefreshTenantId(tenantId);
4961
+ }
4962
+
4963
+ apiClient.setRefreshDomainName(
4964
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
4934
4965
  );
4935
4966
 
4936
4967
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -4976,6 +5007,7 @@ exports.setIsMobile = setIsMobile;
4976
5007
  exports.setOnRefreshToken = setOnRefreshToken;
4977
5008
  exports.setOnRefreshTokenError = setOnRefreshTokenError;
4978
5009
  exports.setRefreshBackend = setRefreshBackend;
5010
+ exports.setRefreshDomainName = setRefreshDomainName;
4979
5011
  exports.setRefreshExpiration = setRefreshExpiration;
4980
5012
  exports.setRefreshTenantId = setRefreshTenantId;
4981
5013
  exports.setRefreshToken = setRefreshToken;