@wazo/sdk 0.38.9 → 0.38.12
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.
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +21 -0
- package/esm/__tests__/web-rtc-client.test.js +32 -7
- package/esm/api/auth.js +12 -0
- package/esm/api/ctid-ng.js +1 -0
- package/esm/api-client.js +21 -0
- package/esm/checker/Checker.js +32 -7
- package/esm/checker/checks/aor.js +21 -0
- package/esm/checker/checks/api.js +21 -0
- package/esm/checker/checks/index.js +32 -7
- package/esm/checker/checks/webrtc-transport.js +32 -7
- package/esm/checker/checks/webrtc.js +32 -7
- package/esm/domain/AdHocAPIConference.js +28 -2
- package/esm/domain/Features.js +28 -2
- package/esm/domain/Phone/CTIPhone.js +28 -2
- package/esm/domain/Phone/WebRTCPhone.js +3 -2
- package/esm/index.js +86 -15
- package/esm/service/CallApi.js +28 -2
- package/esm/service/getApiClient.js +34 -3
- package/esm/simple/Auth.js +87 -16
- package/esm/simple/Configuration.js +86 -15
- package/esm/simple/Directory.js +28 -2
- package/esm/simple/Phone.js +86 -15
- package/esm/simple/Softphone.js +5 -0
- package/esm/simple/index.js +86 -15
- package/esm/simple/room/LocalParticipant.js +86 -15
- package/esm/simple/room/Participant.js +86 -15
- package/esm/simple/room/RemoteParticipant.js +86 -15
- package/esm/simple/room/Room.js +86 -15
- package/esm/simple/room/SipRoom.js +86 -15
- package/esm/simple/room/Stream.js +86 -15
- package/esm/simple/room/__tests__/Participant.test.js +86 -15
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +86 -15
- package/esm/simple/utils.js +86 -15
- package/esm/web-rtc-client.js +32 -7
- package/lib/__tests__/api-client.test.js +21 -0
- package/lib/__tests__/web-rtc-client.test.js +32 -7
- package/lib/api/auth.js +12 -0
- package/lib/api/ctid-ng.js +1 -0
- package/lib/api-client.js +21 -0
- package/lib/checker/Checker.js +32 -7
- package/lib/checker/checks/aor.js +21 -0
- package/lib/checker/checks/api.js +21 -0
- package/lib/checker/checks/index.js +32 -7
- package/lib/checker/checks/webrtc-transport.js +32 -7
- package/lib/checker/checks/webrtc.js +32 -7
- package/lib/domain/AdHocAPIConference.js +28 -2
- package/lib/domain/Features.js +28 -2
- package/lib/domain/Phone/CTIPhone.js +28 -2
- package/lib/domain/Phone/WebRTCPhone.js +3 -2
- package/lib/index.js +86 -15
- package/lib/service/CallApi.js +28 -2
- package/lib/service/getApiClient.js +34 -2
- package/lib/simple/Auth.js +87 -15
- package/lib/simple/Configuration.js +86 -15
- package/lib/simple/Directory.js +28 -2
- package/lib/simple/Phone.js +86 -15
- package/lib/simple/Softphone.js +5 -0
- package/lib/simple/index.js +86 -15
- package/lib/simple/room/LocalParticipant.js +86 -15
- package/lib/simple/room/Participant.js +86 -15
- package/lib/simple/room/RemoteParticipant.js +86 -15
- package/lib/simple/room/Room.js +86 -15
- package/lib/simple/room/SipRoom.js +86 -15
- package/lib/simple/room/Stream.js +86 -15
- package/lib/simple/room/__tests__/Participant.test.js +86 -15
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +86 -15
- package/lib/simple/utils.js +86 -15
- package/lib/web-rtc-client.js +32 -7
- package/package.json +2 -2
- package/src/api/auth.js +12 -0
- package/src/api-client.js +8 -0
- package/src/domain/Phone/WebRTCPhone.js +2 -2
- package/src/service/getApiClient.js +13 -2
- package/src/simple/Auth.js +35 -4
- package/src/simple/Softphone.js +5 -0
- package/src/simple/index.js +2 -1
- package/src/web-rtc-client.js +11 -7
|
@@ -2239,6 +2239,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2239
2239
|
|
|
2240
2240
|
|
|
2241
2241
|
|
|
2242
|
+
|
|
2242
2243
|
) {
|
|
2243
2244
|
const body = {
|
|
2244
2245
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2259,9 +2260,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2259
2260
|
}
|
|
2260
2261
|
|
|
2261
2262
|
if (params.tenantId) {
|
|
2263
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2262
2264
|
body.tenant_id = params.tenantId;
|
|
2263
2265
|
}
|
|
2264
2266
|
|
|
2267
|
+
if (params.domainName) {
|
|
2268
|
+
body.domain_name = params.domainName;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2265
2271
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2266
2272
|
},
|
|
2267
2273
|
|
|
@@ -2274,6 +2280,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2274
2280
|
expiration ,
|
|
2275
2281
|
isMobile = false,
|
|
2276
2282
|
tenantId ,
|
|
2283
|
+
domainName ,
|
|
2277
2284
|
) => {
|
|
2278
2285
|
const body = {
|
|
2279
2286
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2283,9 +2290,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2283
2290
|
};
|
|
2284
2291
|
|
|
2285
2292
|
if (tenantId) {
|
|
2293
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2286
2294
|
body.tenant_id = tenantId;
|
|
2287
2295
|
}
|
|
2288
2296
|
|
|
2297
|
+
if (domainName) {
|
|
2298
|
+
body.domain_name = domainName;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2289
2301
|
const headers = {
|
|
2290
2302
|
'Content-Type': 'application/json',
|
|
2291
2303
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -5583,6 +5595,7 @@ class ApiClient {
|
|
|
5583
5595
|
|
|
5584
5596
|
|
|
5585
5597
|
|
|
5598
|
+
|
|
5586
5599
|
|
|
5587
5600
|
|
|
5588
5601
|
|
|
@@ -5624,6 +5637,7 @@ class ApiClient {
|
|
|
5624
5637
|
refreshToken: this.refreshToken,
|
|
5625
5638
|
refreshBackend: this.refreshBackend,
|
|
5626
5639
|
refreshTenantId: this.refreshTenantId,
|
|
5640
|
+
refreshDomainName: this.refreshDomainName,
|
|
5627
5641
|
refreshExpiration: this.refreshExpiration,
|
|
5628
5642
|
isMobile: this.isMobile,
|
|
5629
5643
|
});
|
|
@@ -5639,6 +5653,7 @@ class ApiClient {
|
|
|
5639
5653
|
this.refreshExpiration,
|
|
5640
5654
|
this.isMobile,
|
|
5641
5655
|
this.refreshTenantId,
|
|
5656
|
+
this.refreshDomainName,
|
|
5642
5657
|
);
|
|
5643
5658
|
|
|
5644
5659
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5692,9 +5707,14 @@ class ApiClient {
|
|
|
5692
5707
|
}
|
|
5693
5708
|
|
|
5694
5709
|
setRefreshTenantId(tenantId ) {
|
|
5710
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
5695
5711
|
this.refreshTenantId = tenantId;
|
|
5696
5712
|
}
|
|
5697
5713
|
|
|
5714
|
+
setRefreshDomainName(domainName ) {
|
|
5715
|
+
this.refreshDomainName = domainName;
|
|
5716
|
+
}
|
|
5717
|
+
|
|
5698
5718
|
setIsMobile(isMobile ) {
|
|
5699
5719
|
this.isMobile = isMobile;
|
|
5700
5720
|
}
|
|
@@ -5719,6 +5739,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
5719
5739
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
5720
5740
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
5721
5741
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
5742
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
5722
5743
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
5723
5744
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
5724
5745
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -5743,9 +5764,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
5743
5764
|
};
|
|
5744
5765
|
|
|
5745
5766
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
5767
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
5746
5768
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
5747
5769
|
};
|
|
5748
5770
|
|
|
5771
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
5772
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
5773
|
+
};
|
|
5774
|
+
|
|
5749
5775
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
5750
5776
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
5751
5777
|
};
|
|
@@ -5764,6 +5790,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
5764
5790
|
|
|
5765
5791
|
const fillClient = (apiClient ) => {
|
|
5766
5792
|
const { server, token, clientId } = apiClient.client;
|
|
5793
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
5767
5794
|
|
|
5768
5795
|
// try with null server when dealing with non-related server info
|
|
5769
5796
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -5772,8 +5799,12 @@ const fillClient = (apiClient ) => {
|
|
|
5772
5799
|
|
|
5773
5800
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
5774
5801
|
|
|
5775
|
-
|
|
5776
|
-
|
|
5802
|
+
if (tenantId) {
|
|
5803
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
5804
|
+
}
|
|
5805
|
+
|
|
5806
|
+
apiClient.setRefreshDomainName(
|
|
5807
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
5777
5808
|
);
|
|
5778
5809
|
|
|
5779
5810
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -7429,7 +7460,7 @@ class WebRTCClient extends Emitter {
|
|
|
7429
7460
|
|
|
7430
7461
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7431
7462
|
} else {
|
|
7432
|
-
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
7463
|
+
videoSender = pc && pc.getSenders && pc.getSenders().find(sender => sender.track === null);
|
|
7433
7464
|
}
|
|
7434
7465
|
|
|
7435
7466
|
if (!videoSender) {
|
|
@@ -7470,9 +7501,11 @@ class WebRTCClient extends Emitter {
|
|
|
7470
7501
|
const videoTracks = localStream.getVideoTracks();
|
|
7471
7502
|
|
|
7472
7503
|
// Remove video senders
|
|
7473
|
-
pc.getSenders
|
|
7474
|
-
|
|
7475
|
-
|
|
7504
|
+
if (pc.getSenders) {
|
|
7505
|
+
pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
|
|
7506
|
+
videoSender.replaceTrack(null);
|
|
7507
|
+
});
|
|
7508
|
+
}
|
|
7476
7509
|
|
|
7477
7510
|
videoTracks.forEach(videoTrack => {
|
|
7478
7511
|
videoTrack.enabled = false;
|
|
@@ -7705,7 +7738,8 @@ class WebRTCClient extends Emitter {
|
|
|
7705
7738
|
const constraints = { audio: { deviceId: { exact: deviceId } } };
|
|
7706
7739
|
const stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
7707
7740
|
const audioTrack = stream.getAudioTracks()[0];
|
|
7708
|
-
const sender = pc && pc.getSenders
|
|
7741
|
+
const sender = pc && pc.getSenders
|
|
7742
|
+
&& pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
|
|
7709
7743
|
|
|
7710
7744
|
if (sender) {
|
|
7711
7745
|
if (sender.track) {
|
|
@@ -7768,10 +7802,11 @@ class WebRTCClient extends Emitter {
|
|
|
7768
7802
|
// $FlowFixMe
|
|
7769
7803
|
return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
|
|
7770
7804
|
const videoTrack = stream.getVideoTracks()[0];
|
|
7771
|
-
let sender = pc && pc.getSenders
|
|
7805
|
+
let sender = pc && pc.getSenders
|
|
7806
|
+
&& pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
|
|
7772
7807
|
let wasTrackEnabled = false;
|
|
7773
7808
|
if (!sender) {
|
|
7774
|
-
sender = pc && pc.getSenders().find(s => !s.track);
|
|
7809
|
+
sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
|
|
7775
7810
|
}
|
|
7776
7811
|
|
|
7777
7812
|
if (sender) {
|
|
@@ -9305,7 +9340,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9305
9340
|
const screenTrack = screenShareStream.getVideoTracks()[0];
|
|
9306
9341
|
const sipSession = this.currentSipSession;
|
|
9307
9342
|
const pc = this.client.getPeerConnection(this.getSipSessionId(sipSession));
|
|
9308
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9343
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9309
9344
|
const localStream = this.client.getLocalStream(this.getSipSessionId(sipSession));
|
|
9310
9345
|
const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
|
|
9311
9346
|
const hadVideo = !!videoTrack;
|
|
@@ -9387,7 +9422,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9387
9422
|
const screenTrack = screenStream.getVideoTracks()[0];
|
|
9388
9423
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9389
9424
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9390
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9425
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9391
9426
|
|
|
9392
9427
|
logger$8.info('WebRTC phone - on screensharing', {
|
|
9393
9428
|
hadVideo,
|
|
@@ -14002,6 +14037,7 @@ class Softphone {
|
|
|
14002
14037
|
wrapUpDuration,
|
|
14003
14038
|
enableAgent = true,
|
|
14004
14039
|
tenantId,
|
|
14040
|
+
domainName,
|
|
14005
14041
|
debug = false,
|
|
14006
14042
|
} = {}) {
|
|
14007
14043
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -14026,8 +14062,12 @@ class Softphone {
|
|
|
14026
14062
|
config.port = port;
|
|
14027
14063
|
}
|
|
14028
14064
|
if (tenantId) {
|
|
14065
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
14029
14066
|
config.tenantId = tenantId;
|
|
14030
14067
|
}
|
|
14068
|
+
if (domainName) {
|
|
14069
|
+
config.domainName = domainName;
|
|
14070
|
+
}
|
|
14031
14071
|
if (wrapUpDuration) {
|
|
14032
14072
|
config.wrapUpDuration = wrapUpDuration;
|
|
14033
14073
|
}
|
|
@@ -14348,6 +14388,7 @@ const Wazo = {
|
|
|
14348
14388
|
CanceledCallError,
|
|
14349
14389
|
SFUNotAvailableError,
|
|
14350
14390
|
NoTenantIdError,
|
|
14391
|
+
NoDomainNameError,
|
|
14351
14392
|
};
|
|
14352
14393
|
|
|
14353
14394
|
if (window) {
|
|
@@ -14362,6 +14403,7 @@ if (global) {
|
|
|
14362
14403
|
class InvalidSubscription extends Error {}
|
|
14363
14404
|
class InvalidAuthorization extends Error {}
|
|
14364
14405
|
class NoTenantIdError extends Error {}
|
|
14406
|
+
class NoDomainNameError extends Error {}
|
|
14365
14407
|
|
|
14366
14408
|
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
14367
14409
|
|
|
@@ -14425,9 +14467,24 @@ class Auth {
|
|
|
14425
14467
|
setFetchOptions(options);
|
|
14426
14468
|
}
|
|
14427
14469
|
|
|
14428
|
-
async logIn(username , password , backend ,
|
|
14429
|
-
|
|
14430
|
-
|
|
14470
|
+
async logIn(username , password , backend , extra ) {
|
|
14471
|
+
let tenantId = null;
|
|
14472
|
+
let domainName = null;
|
|
14473
|
+
if (typeof extra === 'string') {
|
|
14474
|
+
tenantId = extra;
|
|
14475
|
+
}
|
|
14476
|
+
if (extra && typeof extra === 'object') {
|
|
14477
|
+
domainName = extra.domainName;
|
|
14478
|
+
}
|
|
14479
|
+
|
|
14480
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
14481
|
+
if (!tenantId) {
|
|
14482
|
+
throw new NoTenantIdError('No tenant id');
|
|
14483
|
+
}
|
|
14484
|
+
|
|
14485
|
+
if (!domainName) {
|
|
14486
|
+
throw new NoDomainNameError('No domain name');
|
|
14487
|
+
}
|
|
14431
14488
|
}
|
|
14432
14489
|
|
|
14433
14490
|
this.authenticated = false;
|
|
@@ -14437,6 +14494,7 @@ class Auth {
|
|
|
14437
14494
|
password,
|
|
14438
14495
|
backend,
|
|
14439
14496
|
tenantId,
|
|
14497
|
+
domainName,
|
|
14440
14498
|
expiration: this.expiration,
|
|
14441
14499
|
mobile: this.mobile,
|
|
14442
14500
|
});
|
|
@@ -14445,7 +14503,13 @@ class Auth {
|
|
|
14445
14503
|
getApiClient().setRefreshBackend(backend);
|
|
14446
14504
|
}
|
|
14447
14505
|
|
|
14448
|
-
|
|
14506
|
+
if (tenantId) {
|
|
14507
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
14508
|
+
}
|
|
14509
|
+
|
|
14510
|
+
if (domainName) {
|
|
14511
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
14512
|
+
}
|
|
14449
14513
|
|
|
14450
14514
|
return this._onAuthenticated(rawSession);
|
|
14451
14515
|
}
|
|
@@ -14544,11 +14608,18 @@ class Auth {
|
|
|
14544
14608
|
}
|
|
14545
14609
|
|
|
14546
14610
|
setRefreshTenantId(refreshTenantId ) {
|
|
14611
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
14547
14612
|
setRefreshTenantId(refreshTenantId);
|
|
14548
14613
|
|
|
14549
14614
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
14550
14615
|
}
|
|
14551
14616
|
|
|
14617
|
+
setRefreshDomainName(domainName ) {
|
|
14618
|
+
setRefreshDomainName(domainName);
|
|
14619
|
+
|
|
14620
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
14621
|
+
}
|
|
14622
|
+
|
|
14552
14623
|
forceRefreshToken() {
|
|
14553
14624
|
getApiClient().forceRefreshToken();
|
|
14554
14625
|
}
|
package/lib/simple/Directory.js
CHANGED
|
@@ -2215,6 +2215,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2215
2215
|
|
|
2216
2216
|
|
|
2217
2217
|
|
|
2218
|
+
|
|
2218
2219
|
) {
|
|
2219
2220
|
const body = {
|
|
2220
2221
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2235,9 +2236,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2235
2236
|
}
|
|
2236
2237
|
|
|
2237
2238
|
if (params.tenantId) {
|
|
2239
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2238
2240
|
body.tenant_id = params.tenantId;
|
|
2239
2241
|
}
|
|
2240
2242
|
|
|
2243
|
+
if (params.domainName) {
|
|
2244
|
+
body.domain_name = params.domainName;
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2241
2247
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2242
2248
|
},
|
|
2243
2249
|
|
|
@@ -2250,6 +2256,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2250
2256
|
expiration ,
|
|
2251
2257
|
isMobile = false,
|
|
2252
2258
|
tenantId ,
|
|
2259
|
+
domainName ,
|
|
2253
2260
|
) => {
|
|
2254
2261
|
const body = {
|
|
2255
2262
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2259,9 +2266,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2259
2266
|
};
|
|
2260
2267
|
|
|
2261
2268
|
if (tenantId) {
|
|
2269
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2262
2270
|
body.tenant_id = tenantId;
|
|
2263
2271
|
}
|
|
2264
2272
|
|
|
2273
|
+
if (domainName) {
|
|
2274
|
+
body.domain_name = domainName;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2265
2277
|
const headers = {
|
|
2266
2278
|
'Content-Type': 'application/json',
|
|
2267
2279
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -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
|
-
|
|
4887
|
-
|
|
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);
|