@wazo/sdk 0.37.36 → 0.37.39
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/README.md +7 -2
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +9 -0
- package/esm/__tests__/web-rtc-client.test.js +9 -0
- package/esm/api/auth.js +4 -1
- package/esm/api-client.js +9 -0
- package/esm/checker/Checker.js +9 -0
- package/esm/checker/checks/aor.js +9 -0
- package/esm/checker/checks/api.js +9 -0
- package/esm/checker/checks/index.js +9 -0
- package/esm/checker/checks/webrtc-transport.js +9 -0
- package/esm/checker/checks/webrtc.js +9 -0
- package/esm/domain/AdHocAPIConference.js +14 -5
- package/esm/domain/Features.js +9 -0
- package/esm/domain/Phone/CTIPhone.js +9 -0
- package/esm/domain/SwitchboardCall.js +5 -5
- package/esm/index.js +40 -11
- package/esm/service/CallApi.js +9 -0
- package/esm/service/getApiClient.js +9 -0
- package/esm/simple/Auth.js +41 -12
- package/esm/simple/Configuration.js +40 -11
- package/esm/simple/Directory.js +9 -0
- package/esm/simple/Phone.js +40 -11
- package/esm/simple/index.js +40 -11
- package/esm/simple/room/LocalParticipant.js +40 -11
- package/esm/simple/room/Participant.js +40 -11
- package/esm/simple/room/RemoteParticipant.js +40 -11
- package/esm/simple/room/Room.js +40 -11
- package/esm/simple/room/SipRoom.js +40 -11
- package/esm/simple/room/Stream.js +40 -11
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +40 -11
- package/esm/simple/utils.js +40 -11
- package/esm/web-rtc-client.js +9 -0
- package/lib/__tests__/api-client.test.js +9 -0
- package/lib/__tests__/web-rtc-client.test.js +9 -0
- package/lib/api/auth.js +5 -0
- package/lib/api-client.js +9 -0
- package/lib/checker/Checker.js +9 -0
- package/lib/checker/checks/aor.js +9 -0
- package/lib/checker/checks/api.js +9 -0
- package/lib/checker/checks/index.js +9 -0
- package/lib/checker/checks/webrtc-transport.js +9 -0
- package/lib/checker/checks/webrtc.js +9 -0
- package/lib/domain/AdHocAPIConference.js +14 -5
- package/lib/domain/Features.js +9 -0
- package/lib/domain/Phone/CTIPhone.js +9 -0
- package/lib/domain/SwitchboardCall.js +5 -5
- package/lib/index.js +40 -11
- package/lib/service/CallApi.js +9 -0
- package/lib/service/getApiClient.js +9 -0
- package/lib/simple/Auth.js +41 -11
- package/lib/simple/Configuration.js +40 -11
- package/lib/simple/Directory.js +9 -0
- package/lib/simple/Phone.js +40 -11
- package/lib/simple/index.js +40 -11
- package/lib/simple/room/LocalParticipant.js +40 -11
- package/lib/simple/room/Participant.js +40 -11
- package/lib/simple/room/RemoteParticipant.js +40 -11
- package/lib/simple/room/Room.js +40 -11
- package/lib/simple/room/SipRoom.js +40 -11
- package/lib/simple/room/Stream.js +40 -11
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +40 -11
- package/lib/simple/utils.js +40 -11
- package/lib/web-rtc-client.js +9 -0
- package/package.json +1 -1
- package/src/api/auth.js +4 -1
- package/src/api-client.js +7 -0
- package/src/domain/AdHocAPIConference.js +5 -5
- package/src/domain/SwitchboardCall.js +5 -5
- package/src/simple/Auth.js +20 -2
- package/src/simple/index.js +2 -1
package/esm/simple/room/Room.js
CHANGED
|
@@ -2208,6 +2208,7 @@ class Session {
|
|
|
2208
2208
|
/* */
|
|
2209
2209
|
|
|
2210
2210
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2211
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2211
2212
|
const DETAULT_EXPIRATION = 3600;
|
|
2212
2213
|
|
|
2213
2214
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2257,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2257
2258
|
backend ,
|
|
2258
2259
|
expiration ,
|
|
2259
2260
|
isMobile = false,
|
|
2261
|
+
tenantId ,
|
|
2260
2262
|
) => {
|
|
2261
2263
|
const body = {
|
|
2262
2264
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2263
2265
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2264
2266
|
refresh_token: refreshToken,
|
|
2265
2267
|
client_id: client.clientId,
|
|
2268
|
+
tenant_id: tenantId,
|
|
2266
2269
|
};
|
|
2267
2270
|
|
|
2268
2271
|
const headers = {
|
|
@@ -5414,6 +5417,7 @@ class ApiClient {
|
|
|
5414
5417
|
|
|
5415
5418
|
|
|
5416
5419
|
|
|
5420
|
+
|
|
5417
5421
|
|
|
5418
5422
|
|
|
5419
5423
|
|
|
@@ -5454,6 +5458,7 @@ class ApiClient {
|
|
|
5454
5458
|
logger$a.info('refresh token callback called', {
|
|
5455
5459
|
refreshToken: this.refreshToken,
|
|
5456
5460
|
refreshBackend: this.refreshBackend,
|
|
5461
|
+
refreshTenantId: this.refreshTenantId,
|
|
5457
5462
|
refreshExpiration: this.refreshExpiration,
|
|
5458
5463
|
isMobile: this.isMobile,
|
|
5459
5464
|
});
|
|
@@ -5467,6 +5472,7 @@ class ApiClient {
|
|
|
5467
5472
|
this.refreshBackend,
|
|
5468
5473
|
this.refreshExpiration,
|
|
5469
5474
|
this.isMobile,
|
|
5475
|
+
this.refreshTenantId,
|
|
5470
5476
|
);
|
|
5471
5477
|
|
|
5472
5478
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5508,6 +5514,10 @@ class ApiClient {
|
|
|
5508
5514
|
this.refreshBackend = refreshBackend;
|
|
5509
5515
|
}
|
|
5510
5516
|
|
|
5517
|
+
setRefreshTenantId(tenantId ) {
|
|
5518
|
+
this.refreshTenantId = tenantId;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5511
5521
|
setIsMobile(isMobile ) {
|
|
5512
5522
|
this.isMobile = isMobile;
|
|
5513
5523
|
}
|
|
@@ -5609,6 +5619,7 @@ var getApiClient = (forServer ) => {
|
|
|
5609
5619
|
|
|
5610
5620
|
class InvalidSubscription extends Error {}
|
|
5611
5621
|
class InvalidAuthorization extends Error {}
|
|
5622
|
+
class NoTenantIdError extends Error {}
|
|
5612
5623
|
|
|
5613
5624
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5614
5625
|
|
|
@@ -5622,11 +5633,15 @@ class Auth {
|
|
|
5622
5633
|
|
|
5623
5634
|
|
|
5624
5635
|
|
|
5636
|
+
|
|
5637
|
+
|
|
5625
5638
|
|
|
5626
5639
|
constructor() {
|
|
5627
5640
|
this.expiration = DETAULT_EXPIRATION;
|
|
5628
5641
|
this.authenticated = false;
|
|
5629
5642
|
this.minSubscriptionType = null;
|
|
5643
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
5644
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
5630
5645
|
}
|
|
5631
5646
|
|
|
5632
5647
|
init(clientId ,
|
|
@@ -5659,15 +5674,28 @@ class Auth {
|
|
|
5659
5674
|
setFetchOptions(options);
|
|
5660
5675
|
}
|
|
5661
5676
|
|
|
5662
|
-
async logIn(username , password ) {
|
|
5677
|
+
async logIn(username , password , backend , tenantId ) {
|
|
5678
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
5679
|
+
throw new NoTenantIdError('No tenant id');
|
|
5680
|
+
}
|
|
5681
|
+
|
|
5663
5682
|
this.authenticated = false;
|
|
5664
5683
|
this.session = null;
|
|
5665
5684
|
const rawSession = await getApiClient().auth.logIn({
|
|
5666
5685
|
username,
|
|
5667
5686
|
password,
|
|
5687
|
+
backend,
|
|
5688
|
+
tenantId,
|
|
5668
5689
|
expiration: this.expiration,
|
|
5669
5690
|
mobile: this.mobile,
|
|
5670
5691
|
});
|
|
5692
|
+
|
|
5693
|
+
if (backend) {
|
|
5694
|
+
getApiClient().setRefreshBackend(backend);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5698
|
+
|
|
5671
5699
|
return this._onAuthenticated(rawSession);
|
|
5672
5700
|
}
|
|
5673
5701
|
|
|
@@ -5894,7 +5922,7 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
5894
5922
|
|
|
5895
5923
|
|
|
5896
5924
|
|
|
5897
|
-
|
|
5925
|
+
|
|
5898
5926
|
|
|
5899
5927
|
|
|
5900
5928
|
|
|
@@ -5914,7 +5942,7 @@ class AdHocAPIConference {
|
|
|
5914
5942
|
|
|
5915
5943
|
|
|
5916
5944
|
|
|
5917
|
-
|
|
5945
|
+
|
|
5918
5946
|
|
|
5919
5947
|
|
|
5920
5948
|
|
|
@@ -5926,7 +5954,7 @@ class AdHocAPIConference {
|
|
|
5926
5954
|
participants,
|
|
5927
5955
|
started,
|
|
5928
5956
|
finished,
|
|
5929
|
-
|
|
5957
|
+
answerTime,
|
|
5930
5958
|
conferenceId,
|
|
5931
5959
|
muted,
|
|
5932
5960
|
paused,
|
|
@@ -5936,7 +5964,7 @@ class AdHocAPIConference {
|
|
|
5936
5964
|
this.participants = participants || {};
|
|
5937
5965
|
this.started = started || false;
|
|
5938
5966
|
this.finished = finished || false;
|
|
5939
|
-
this.
|
|
5967
|
+
this.answerTime = answerTime;
|
|
5940
5968
|
this.conferenceId = conferenceId || '';
|
|
5941
5969
|
this.muted = muted || false;
|
|
5942
5970
|
this.paused = paused || false;
|
|
@@ -5949,7 +5977,7 @@ class AdHocAPIConference {
|
|
|
5949
5977
|
async start() {
|
|
5950
5978
|
this.started = true;
|
|
5951
5979
|
// $FlowFixMe
|
|
5952
|
-
this.
|
|
5980
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5953
5981
|
|
|
5954
5982
|
const participantIds = Object.keys(this.participants);
|
|
5955
5983
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -12407,7 +12435,7 @@ class Room$1 {
|
|
|
12407
12435
|
|
|
12408
12436
|
|
|
12409
12437
|
|
|
12410
|
-
|
|
12438
|
+
|
|
12411
12439
|
|
|
12412
12440
|
|
|
12413
12441
|
|
|
@@ -12433,7 +12461,7 @@ class SwitchboardCall {
|
|
|
12433
12461
|
|
|
12434
12462
|
|
|
12435
12463
|
|
|
12436
|
-
|
|
12464
|
+
|
|
12437
12465
|
|
|
12438
12466
|
|
|
12439
12467
|
|
|
@@ -12447,7 +12475,7 @@ class SwitchboardCall {
|
|
|
12447
12475
|
callerIdName: plain.caller_id_name || null,
|
|
12448
12476
|
callerIdNumber: plain.caller_id_number || null,
|
|
12449
12477
|
participantId: plain.participantId || null,
|
|
12450
|
-
|
|
12478
|
+
answerTime: plain.startTime,
|
|
12451
12479
|
state: plain.state,
|
|
12452
12480
|
switchboardName: plain.switchboardName,
|
|
12453
12481
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -12460,7 +12488,7 @@ class SwitchboardCall {
|
|
|
12460
12488
|
callerIdName,
|
|
12461
12489
|
callerIdNumber,
|
|
12462
12490
|
participantId,
|
|
12463
|
-
|
|
12491
|
+
answerTime,
|
|
12464
12492
|
state,
|
|
12465
12493
|
switchboardName,
|
|
12466
12494
|
switchboardUuid,
|
|
@@ -12470,7 +12498,7 @@ class SwitchboardCall {
|
|
|
12470
12498
|
this.callerIdName = callerIdName;
|
|
12471
12499
|
this.callerIdNumber = callerIdNumber;
|
|
12472
12500
|
this.participantId = participantId;
|
|
12473
|
-
this.
|
|
12501
|
+
this.answerTime = answerTime;
|
|
12474
12502
|
this.state = state;
|
|
12475
12503
|
this.switchboardName = switchboardName;
|
|
12476
12504
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13107,6 +13135,7 @@ const Wazo = {
|
|
|
13107
13135
|
InvalidAuthorization,
|
|
13108
13136
|
CanceledCallError,
|
|
13109
13137
|
SFUNotAvailableError,
|
|
13138
|
+
NoTenantIdError,
|
|
13110
13139
|
};
|
|
13111
13140
|
|
|
13112
13141
|
if (window) {
|
|
@@ -2208,6 +2208,7 @@ class Session {
|
|
|
2208
2208
|
/* */
|
|
2209
2209
|
|
|
2210
2210
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2211
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2211
2212
|
const DETAULT_EXPIRATION = 3600;
|
|
2212
2213
|
|
|
2213
2214
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2257,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2257
2258
|
backend ,
|
|
2258
2259
|
expiration ,
|
|
2259
2260
|
isMobile = false,
|
|
2261
|
+
tenantId ,
|
|
2260
2262
|
) => {
|
|
2261
2263
|
const body = {
|
|
2262
2264
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2263
2265
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2264
2266
|
refresh_token: refreshToken,
|
|
2265
2267
|
client_id: client.clientId,
|
|
2268
|
+
tenant_id: tenantId,
|
|
2266
2269
|
};
|
|
2267
2270
|
|
|
2268
2271
|
const headers = {
|
|
@@ -5414,6 +5417,7 @@ class ApiClient {
|
|
|
5414
5417
|
|
|
5415
5418
|
|
|
5416
5419
|
|
|
5420
|
+
|
|
5417
5421
|
|
|
5418
5422
|
|
|
5419
5423
|
|
|
@@ -5454,6 +5458,7 @@ class ApiClient {
|
|
|
5454
5458
|
logger$a.info('refresh token callback called', {
|
|
5455
5459
|
refreshToken: this.refreshToken,
|
|
5456
5460
|
refreshBackend: this.refreshBackend,
|
|
5461
|
+
refreshTenantId: this.refreshTenantId,
|
|
5457
5462
|
refreshExpiration: this.refreshExpiration,
|
|
5458
5463
|
isMobile: this.isMobile,
|
|
5459
5464
|
});
|
|
@@ -5467,6 +5472,7 @@ class ApiClient {
|
|
|
5467
5472
|
this.refreshBackend,
|
|
5468
5473
|
this.refreshExpiration,
|
|
5469
5474
|
this.isMobile,
|
|
5475
|
+
this.refreshTenantId,
|
|
5470
5476
|
);
|
|
5471
5477
|
|
|
5472
5478
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5508,6 +5514,10 @@ class ApiClient {
|
|
|
5508
5514
|
this.refreshBackend = refreshBackend;
|
|
5509
5515
|
}
|
|
5510
5516
|
|
|
5517
|
+
setRefreshTenantId(tenantId ) {
|
|
5518
|
+
this.refreshTenantId = tenantId;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5511
5521
|
setIsMobile(isMobile ) {
|
|
5512
5522
|
this.isMobile = isMobile;
|
|
5513
5523
|
}
|
|
@@ -5609,6 +5619,7 @@ var getApiClient = (forServer ) => {
|
|
|
5609
5619
|
|
|
5610
5620
|
class InvalidSubscription extends Error {}
|
|
5611
5621
|
class InvalidAuthorization extends Error {}
|
|
5622
|
+
class NoTenantIdError extends Error {}
|
|
5612
5623
|
|
|
5613
5624
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5614
5625
|
|
|
@@ -5622,11 +5633,15 @@ class Auth {
|
|
|
5622
5633
|
|
|
5623
5634
|
|
|
5624
5635
|
|
|
5636
|
+
|
|
5637
|
+
|
|
5625
5638
|
|
|
5626
5639
|
constructor() {
|
|
5627
5640
|
this.expiration = DETAULT_EXPIRATION;
|
|
5628
5641
|
this.authenticated = false;
|
|
5629
5642
|
this.minSubscriptionType = null;
|
|
5643
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
5644
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
5630
5645
|
}
|
|
5631
5646
|
|
|
5632
5647
|
init(clientId ,
|
|
@@ -5659,15 +5674,28 @@ class Auth {
|
|
|
5659
5674
|
setFetchOptions(options);
|
|
5660
5675
|
}
|
|
5661
5676
|
|
|
5662
|
-
async logIn(username , password ) {
|
|
5677
|
+
async logIn(username , password , backend , tenantId ) {
|
|
5678
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
5679
|
+
throw new NoTenantIdError('No tenant id');
|
|
5680
|
+
}
|
|
5681
|
+
|
|
5663
5682
|
this.authenticated = false;
|
|
5664
5683
|
this.session = null;
|
|
5665
5684
|
const rawSession = await getApiClient().auth.logIn({
|
|
5666
5685
|
username,
|
|
5667
5686
|
password,
|
|
5687
|
+
backend,
|
|
5688
|
+
tenantId,
|
|
5668
5689
|
expiration: this.expiration,
|
|
5669
5690
|
mobile: this.mobile,
|
|
5670
5691
|
});
|
|
5692
|
+
|
|
5693
|
+
if (backend) {
|
|
5694
|
+
getApiClient().setRefreshBackend(backend);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5698
|
+
|
|
5671
5699
|
return this._onAuthenticated(rawSession);
|
|
5672
5700
|
}
|
|
5673
5701
|
|
|
@@ -5894,7 +5922,7 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
5894
5922
|
|
|
5895
5923
|
|
|
5896
5924
|
|
|
5897
|
-
|
|
5925
|
+
|
|
5898
5926
|
|
|
5899
5927
|
|
|
5900
5928
|
|
|
@@ -5914,7 +5942,7 @@ class AdHocAPIConference {
|
|
|
5914
5942
|
|
|
5915
5943
|
|
|
5916
5944
|
|
|
5917
|
-
|
|
5945
|
+
|
|
5918
5946
|
|
|
5919
5947
|
|
|
5920
5948
|
|
|
@@ -5926,7 +5954,7 @@ class AdHocAPIConference {
|
|
|
5926
5954
|
participants,
|
|
5927
5955
|
started,
|
|
5928
5956
|
finished,
|
|
5929
|
-
|
|
5957
|
+
answerTime,
|
|
5930
5958
|
conferenceId,
|
|
5931
5959
|
muted,
|
|
5932
5960
|
paused,
|
|
@@ -5936,7 +5964,7 @@ class AdHocAPIConference {
|
|
|
5936
5964
|
this.participants = participants || {};
|
|
5937
5965
|
this.started = started || false;
|
|
5938
5966
|
this.finished = finished || false;
|
|
5939
|
-
this.
|
|
5967
|
+
this.answerTime = answerTime;
|
|
5940
5968
|
this.conferenceId = conferenceId || '';
|
|
5941
5969
|
this.muted = muted || false;
|
|
5942
5970
|
this.paused = paused || false;
|
|
@@ -5949,7 +5977,7 @@ class AdHocAPIConference {
|
|
|
5949
5977
|
async start() {
|
|
5950
5978
|
this.started = true;
|
|
5951
5979
|
// $FlowFixMe
|
|
5952
|
-
this.
|
|
5980
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5953
5981
|
|
|
5954
5982
|
const participantIds = Object.keys(this.participants);
|
|
5955
5983
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -13104,7 +13132,7 @@ class Room {
|
|
|
13104
13132
|
|
|
13105
13133
|
|
|
13106
13134
|
|
|
13107
|
-
|
|
13135
|
+
|
|
13108
13136
|
|
|
13109
13137
|
|
|
13110
13138
|
|
|
@@ -13130,7 +13158,7 @@ class SwitchboardCall {
|
|
|
13130
13158
|
|
|
13131
13159
|
|
|
13132
13160
|
|
|
13133
|
-
|
|
13161
|
+
|
|
13134
13162
|
|
|
13135
13163
|
|
|
13136
13164
|
|
|
@@ -13144,7 +13172,7 @@ class SwitchboardCall {
|
|
|
13144
13172
|
callerIdName: plain.caller_id_name || null,
|
|
13145
13173
|
callerIdNumber: plain.caller_id_number || null,
|
|
13146
13174
|
participantId: plain.participantId || null,
|
|
13147
|
-
|
|
13175
|
+
answerTime: plain.startTime,
|
|
13148
13176
|
state: plain.state,
|
|
13149
13177
|
switchboardName: plain.switchboardName,
|
|
13150
13178
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -13157,7 +13185,7 @@ class SwitchboardCall {
|
|
|
13157
13185
|
callerIdName,
|
|
13158
13186
|
callerIdNumber,
|
|
13159
13187
|
participantId,
|
|
13160
|
-
|
|
13188
|
+
answerTime,
|
|
13161
13189
|
state,
|
|
13162
13190
|
switchboardName,
|
|
13163
13191
|
switchboardUuid,
|
|
@@ -13167,7 +13195,7 @@ class SwitchboardCall {
|
|
|
13167
13195
|
this.callerIdName = callerIdName;
|
|
13168
13196
|
this.callerIdNumber = callerIdNumber;
|
|
13169
13197
|
this.participantId = participantId;
|
|
13170
|
-
this.
|
|
13198
|
+
this.answerTime = answerTime;
|
|
13171
13199
|
this.state = state;
|
|
13172
13200
|
this.switchboardName = switchboardName;
|
|
13173
13201
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13804,6 +13832,7 @@ const Wazo = {
|
|
|
13804
13832
|
InvalidAuthorization,
|
|
13805
13833
|
CanceledCallError,
|
|
13806
13834
|
SFUNotAvailableError,
|
|
13835
|
+
NoTenantIdError,
|
|
13807
13836
|
};
|
|
13808
13837
|
|
|
13809
13838
|
if (window) {
|
|
@@ -2208,6 +2208,7 @@ class ApiRequester {
|
|
|
2208
2208
|
/* */
|
|
2209
2209
|
|
|
2210
2210
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2211
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2211
2212
|
const DETAULT_EXPIRATION = 3600;
|
|
2212
2213
|
|
|
2213
2214
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2257,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2257
2258
|
backend ,
|
|
2258
2259
|
expiration ,
|
|
2259
2260
|
isMobile = false,
|
|
2261
|
+
tenantId ,
|
|
2260
2262
|
) => {
|
|
2261
2263
|
const body = {
|
|
2262
2264
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2263
2265
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2264
2266
|
refresh_token: refreshToken,
|
|
2265
2267
|
client_id: client.clientId,
|
|
2268
|
+
tenant_id: tenantId,
|
|
2266
2269
|
};
|
|
2267
2270
|
|
|
2268
2271
|
const headers = {
|
|
@@ -5414,6 +5417,7 @@ class ApiClient {
|
|
|
5414
5417
|
|
|
5415
5418
|
|
|
5416
5419
|
|
|
5420
|
+
|
|
5417
5421
|
|
|
5418
5422
|
|
|
5419
5423
|
|
|
@@ -5454,6 +5458,7 @@ class ApiClient {
|
|
|
5454
5458
|
logger$a.info('refresh token callback called', {
|
|
5455
5459
|
refreshToken: this.refreshToken,
|
|
5456
5460
|
refreshBackend: this.refreshBackend,
|
|
5461
|
+
refreshTenantId: this.refreshTenantId,
|
|
5457
5462
|
refreshExpiration: this.refreshExpiration,
|
|
5458
5463
|
isMobile: this.isMobile,
|
|
5459
5464
|
});
|
|
@@ -5467,6 +5472,7 @@ class ApiClient {
|
|
|
5467
5472
|
this.refreshBackend,
|
|
5468
5473
|
this.refreshExpiration,
|
|
5469
5474
|
this.isMobile,
|
|
5475
|
+
this.refreshTenantId,
|
|
5470
5476
|
);
|
|
5471
5477
|
|
|
5472
5478
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5508,6 +5514,10 @@ class ApiClient {
|
|
|
5508
5514
|
this.refreshBackend = refreshBackend;
|
|
5509
5515
|
}
|
|
5510
5516
|
|
|
5517
|
+
setRefreshTenantId(tenantId ) {
|
|
5518
|
+
this.refreshTenantId = tenantId;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5511
5521
|
setIsMobile(isMobile ) {
|
|
5512
5522
|
this.isMobile = isMobile;
|
|
5513
5523
|
}
|
|
@@ -5609,6 +5619,7 @@ var getApiClient = (forServer ) => {
|
|
|
5609
5619
|
|
|
5610
5620
|
class InvalidSubscription extends Error {}
|
|
5611
5621
|
class InvalidAuthorization extends Error {}
|
|
5622
|
+
class NoTenantIdError extends Error {}
|
|
5612
5623
|
|
|
5613
5624
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5614
5625
|
|
|
@@ -5622,11 +5633,15 @@ class Auth {
|
|
|
5622
5633
|
|
|
5623
5634
|
|
|
5624
5635
|
|
|
5636
|
+
|
|
5637
|
+
|
|
5625
5638
|
|
|
5626
5639
|
constructor() {
|
|
5627
5640
|
this.expiration = DETAULT_EXPIRATION;
|
|
5628
5641
|
this.authenticated = false;
|
|
5629
5642
|
this.minSubscriptionType = null;
|
|
5643
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
5644
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
5630
5645
|
}
|
|
5631
5646
|
|
|
5632
5647
|
init(clientId ,
|
|
@@ -5659,15 +5674,28 @@ class Auth {
|
|
|
5659
5674
|
setFetchOptions(options);
|
|
5660
5675
|
}
|
|
5661
5676
|
|
|
5662
|
-
async logIn(username , password ) {
|
|
5677
|
+
async logIn(username , password , backend , tenantId ) {
|
|
5678
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
5679
|
+
throw new NoTenantIdError('No tenant id');
|
|
5680
|
+
}
|
|
5681
|
+
|
|
5663
5682
|
this.authenticated = false;
|
|
5664
5683
|
this.session = null;
|
|
5665
5684
|
const rawSession = await getApiClient().auth.logIn({
|
|
5666
5685
|
username,
|
|
5667
5686
|
password,
|
|
5687
|
+
backend,
|
|
5688
|
+
tenantId,
|
|
5668
5689
|
expiration: this.expiration,
|
|
5669
5690
|
mobile: this.mobile,
|
|
5670
5691
|
});
|
|
5692
|
+
|
|
5693
|
+
if (backend) {
|
|
5694
|
+
getApiClient().setRefreshBackend(backend);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5698
|
+
|
|
5671
5699
|
return this._onAuthenticated(rawSession);
|
|
5672
5700
|
}
|
|
5673
5701
|
|
|
@@ -5894,7 +5922,7 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
5894
5922
|
|
|
5895
5923
|
|
|
5896
5924
|
|
|
5897
|
-
|
|
5925
|
+
|
|
5898
5926
|
|
|
5899
5927
|
|
|
5900
5928
|
|
|
@@ -5914,7 +5942,7 @@ class AdHocAPIConference {
|
|
|
5914
5942
|
|
|
5915
5943
|
|
|
5916
5944
|
|
|
5917
|
-
|
|
5945
|
+
|
|
5918
5946
|
|
|
5919
5947
|
|
|
5920
5948
|
|
|
@@ -5926,7 +5954,7 @@ class AdHocAPIConference {
|
|
|
5926
5954
|
participants,
|
|
5927
5955
|
started,
|
|
5928
5956
|
finished,
|
|
5929
|
-
|
|
5957
|
+
answerTime,
|
|
5930
5958
|
conferenceId,
|
|
5931
5959
|
muted,
|
|
5932
5960
|
paused,
|
|
@@ -5936,7 +5964,7 @@ class AdHocAPIConference {
|
|
|
5936
5964
|
this.participants = participants || {};
|
|
5937
5965
|
this.started = started || false;
|
|
5938
5966
|
this.finished = finished || false;
|
|
5939
|
-
this.
|
|
5967
|
+
this.answerTime = answerTime;
|
|
5940
5968
|
this.conferenceId = conferenceId || '';
|
|
5941
5969
|
this.muted = muted || false;
|
|
5942
5970
|
this.paused = paused || false;
|
|
@@ -5949,7 +5977,7 @@ class AdHocAPIConference {
|
|
|
5949
5977
|
async start() {
|
|
5950
5978
|
this.started = true;
|
|
5951
5979
|
// $FlowFixMe
|
|
5952
|
-
this.
|
|
5980
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5953
5981
|
|
|
5954
5982
|
const participantIds = Object.keys(this.participants);
|
|
5955
5983
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -13185,7 +13213,7 @@ class Room {
|
|
|
13185
13213
|
|
|
13186
13214
|
|
|
13187
13215
|
|
|
13188
|
-
|
|
13216
|
+
|
|
13189
13217
|
|
|
13190
13218
|
|
|
13191
13219
|
|
|
@@ -13211,7 +13239,7 @@ class SwitchboardCall {
|
|
|
13211
13239
|
|
|
13212
13240
|
|
|
13213
13241
|
|
|
13214
|
-
|
|
13242
|
+
|
|
13215
13243
|
|
|
13216
13244
|
|
|
13217
13245
|
|
|
@@ -13225,7 +13253,7 @@ class SwitchboardCall {
|
|
|
13225
13253
|
callerIdName: plain.caller_id_name || null,
|
|
13226
13254
|
callerIdNumber: plain.caller_id_number || null,
|
|
13227
13255
|
participantId: plain.participantId || null,
|
|
13228
|
-
|
|
13256
|
+
answerTime: plain.startTime,
|
|
13229
13257
|
state: plain.state,
|
|
13230
13258
|
switchboardName: plain.switchboardName,
|
|
13231
13259
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -13238,7 +13266,7 @@ class SwitchboardCall {
|
|
|
13238
13266
|
callerIdName,
|
|
13239
13267
|
callerIdNumber,
|
|
13240
13268
|
participantId,
|
|
13241
|
-
|
|
13269
|
+
answerTime,
|
|
13242
13270
|
state,
|
|
13243
13271
|
switchboardName,
|
|
13244
13272
|
switchboardUuid,
|
|
@@ -13248,7 +13276,7 @@ class SwitchboardCall {
|
|
|
13248
13276
|
this.callerIdName = callerIdName;
|
|
13249
13277
|
this.callerIdNumber = callerIdNumber;
|
|
13250
13278
|
this.participantId = participantId;
|
|
13251
|
-
this.
|
|
13279
|
+
this.answerTime = answerTime;
|
|
13252
13280
|
this.state = state;
|
|
13253
13281
|
this.switchboardName = switchboardName;
|
|
13254
13282
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13885,6 +13913,7 @@ const Wazo = {
|
|
|
13885
13913
|
InvalidAuthorization,
|
|
13886
13914
|
CanceledCallError,
|
|
13887
13915
|
SFUNotAvailableError,
|
|
13916
|
+
NoTenantIdError,
|
|
13888
13917
|
};
|
|
13889
13918
|
|
|
13890
13919
|
if (window) {
|