@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/lib/simple/Phone.js
CHANGED
|
@@ -2821,6 +2821,7 @@ class Session {
|
|
|
2821
2821
|
/* */
|
|
2822
2822
|
|
|
2823
2823
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2824
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2824
2825
|
const DETAULT_EXPIRATION = 3600;
|
|
2825
2826
|
|
|
2826
2827
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2870,12 +2871,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2870
2871
|
backend ,
|
|
2871
2872
|
expiration ,
|
|
2872
2873
|
isMobile = false,
|
|
2874
|
+
tenantId ,
|
|
2873
2875
|
) => {
|
|
2874
2876
|
const body = {
|
|
2875
2877
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2876
2878
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2877
2879
|
refresh_token: refreshToken,
|
|
2878
2880
|
client_id: client.clientId,
|
|
2881
|
+
tenant_id: tenantId,
|
|
2879
2882
|
};
|
|
2880
2883
|
|
|
2881
2884
|
const headers = {
|
|
@@ -5424,6 +5427,7 @@ class ApiClient {
|
|
|
5424
5427
|
|
|
5425
5428
|
|
|
5426
5429
|
|
|
5430
|
+
|
|
5427
5431
|
|
|
5428
5432
|
|
|
5429
5433
|
|
|
@@ -5464,6 +5468,7 @@ class ApiClient {
|
|
|
5464
5468
|
logger$a.info('refresh token callback called', {
|
|
5465
5469
|
refreshToken: this.refreshToken,
|
|
5466
5470
|
refreshBackend: this.refreshBackend,
|
|
5471
|
+
refreshTenantId: this.refreshTenantId,
|
|
5467
5472
|
refreshExpiration: this.refreshExpiration,
|
|
5468
5473
|
isMobile: this.isMobile,
|
|
5469
5474
|
});
|
|
@@ -5477,6 +5482,7 @@ class ApiClient {
|
|
|
5477
5482
|
this.refreshBackend,
|
|
5478
5483
|
this.refreshExpiration,
|
|
5479
5484
|
this.isMobile,
|
|
5485
|
+
this.refreshTenantId,
|
|
5480
5486
|
);
|
|
5481
5487
|
|
|
5482
5488
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5518,6 +5524,10 @@ class ApiClient {
|
|
|
5518
5524
|
this.refreshBackend = refreshBackend;
|
|
5519
5525
|
}
|
|
5520
5526
|
|
|
5527
|
+
setRefreshTenantId(tenantId ) {
|
|
5528
|
+
this.refreshTenantId = tenantId;
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5521
5531
|
setIsMobile(isMobile ) {
|
|
5522
5532
|
this.isMobile = isMobile;
|
|
5523
5533
|
}
|
|
@@ -5640,7 +5650,7 @@ var getApiClient = (forServer ) => {
|
|
|
5640
5650
|
|
|
5641
5651
|
|
|
5642
5652
|
|
|
5643
|
-
|
|
5653
|
+
|
|
5644
5654
|
|
|
5645
5655
|
|
|
5646
5656
|
|
|
@@ -5660,7 +5670,7 @@ class AdHocAPIConference {
|
|
|
5660
5670
|
|
|
5661
5671
|
|
|
5662
5672
|
|
|
5663
|
-
|
|
5673
|
+
|
|
5664
5674
|
|
|
5665
5675
|
|
|
5666
5676
|
|
|
@@ -5672,7 +5682,7 @@ class AdHocAPIConference {
|
|
|
5672
5682
|
participants,
|
|
5673
5683
|
started,
|
|
5674
5684
|
finished,
|
|
5675
|
-
|
|
5685
|
+
answerTime,
|
|
5676
5686
|
conferenceId,
|
|
5677
5687
|
muted,
|
|
5678
5688
|
paused,
|
|
@@ -5682,7 +5692,7 @@ class AdHocAPIConference {
|
|
|
5682
5692
|
this.participants = participants || {};
|
|
5683
5693
|
this.started = started || false;
|
|
5684
5694
|
this.finished = finished || false;
|
|
5685
|
-
this.
|
|
5695
|
+
this.answerTime = answerTime;
|
|
5686
5696
|
this.conferenceId = conferenceId || '';
|
|
5687
5697
|
this.muted = muted || false;
|
|
5688
5698
|
this.paused = paused || false;
|
|
@@ -5695,7 +5705,7 @@ class AdHocAPIConference {
|
|
|
5695
5705
|
async start() {
|
|
5696
5706
|
this.started = true;
|
|
5697
5707
|
// $FlowFixMe
|
|
5698
|
-
this.
|
|
5708
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5699
5709
|
|
|
5700
5710
|
const participantIds = Object.keys(this.participants);
|
|
5701
5711
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -10387,6 +10397,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10387
10397
|
|
|
10388
10398
|
class InvalidSubscription extends Error {}
|
|
10389
10399
|
class InvalidAuthorization extends Error {}
|
|
10400
|
+
class NoTenantIdError extends Error {}
|
|
10390
10401
|
|
|
10391
10402
|
const logger$7 = IssueReporter$1.loggerFor('simple-auth');
|
|
10392
10403
|
|
|
@@ -10400,11 +10411,15 @@ class Auth {
|
|
|
10400
10411
|
|
|
10401
10412
|
|
|
10402
10413
|
|
|
10414
|
+
|
|
10415
|
+
|
|
10403
10416
|
|
|
10404
10417
|
constructor() {
|
|
10405
10418
|
this.expiration = DETAULT_EXPIRATION;
|
|
10406
10419
|
this.authenticated = false;
|
|
10407
10420
|
this.minSubscriptionType = null;
|
|
10421
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
10422
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
10408
10423
|
}
|
|
10409
10424
|
|
|
10410
10425
|
init(clientId ,
|
|
@@ -10437,15 +10452,28 @@ class Auth {
|
|
|
10437
10452
|
setFetchOptions(options);
|
|
10438
10453
|
}
|
|
10439
10454
|
|
|
10440
|
-
async logIn(username , password ) {
|
|
10455
|
+
async logIn(username , password , backend , tenantId ) {
|
|
10456
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
10457
|
+
throw new NoTenantIdError('No tenant id');
|
|
10458
|
+
}
|
|
10459
|
+
|
|
10441
10460
|
this.authenticated = false;
|
|
10442
10461
|
this.session = null;
|
|
10443
10462
|
const rawSession = await getApiClient().auth.logIn({
|
|
10444
10463
|
username,
|
|
10445
10464
|
password,
|
|
10465
|
+
backend,
|
|
10466
|
+
tenantId,
|
|
10446
10467
|
expiration: this.expiration,
|
|
10447
10468
|
mobile: this.mobile,
|
|
10448
10469
|
});
|
|
10470
|
+
|
|
10471
|
+
if (backend) {
|
|
10472
|
+
getApiClient().setRefreshBackend(backend);
|
|
10473
|
+
}
|
|
10474
|
+
|
|
10475
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
10476
|
+
|
|
10449
10477
|
return this._onAuthenticated(rawSession);
|
|
10450
10478
|
}
|
|
10451
10479
|
|
|
@@ -12843,7 +12871,7 @@ class Room {
|
|
|
12843
12871
|
|
|
12844
12872
|
|
|
12845
12873
|
|
|
12846
|
-
|
|
12874
|
+
|
|
12847
12875
|
|
|
12848
12876
|
|
|
12849
12877
|
|
|
@@ -12869,7 +12897,7 @@ class SwitchboardCall {
|
|
|
12869
12897
|
|
|
12870
12898
|
|
|
12871
12899
|
|
|
12872
|
-
|
|
12900
|
+
|
|
12873
12901
|
|
|
12874
12902
|
|
|
12875
12903
|
|
|
@@ -12883,7 +12911,7 @@ class SwitchboardCall {
|
|
|
12883
12911
|
callerIdName: plain.caller_id_name || null,
|
|
12884
12912
|
callerIdNumber: plain.caller_id_number || null,
|
|
12885
12913
|
participantId: plain.participantId || null,
|
|
12886
|
-
|
|
12914
|
+
answerTime: plain.startTime,
|
|
12887
12915
|
state: plain.state,
|
|
12888
12916
|
switchboardName: plain.switchboardName,
|
|
12889
12917
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -12896,7 +12924,7 @@ class SwitchboardCall {
|
|
|
12896
12924
|
callerIdName,
|
|
12897
12925
|
callerIdNumber,
|
|
12898
12926
|
participantId,
|
|
12899
|
-
|
|
12927
|
+
answerTime,
|
|
12900
12928
|
state,
|
|
12901
12929
|
switchboardName,
|
|
12902
12930
|
switchboardUuid,
|
|
@@ -12906,7 +12934,7 @@ class SwitchboardCall {
|
|
|
12906
12934
|
this.callerIdName = callerIdName;
|
|
12907
12935
|
this.callerIdNumber = callerIdNumber;
|
|
12908
12936
|
this.participantId = participantId;
|
|
12909
|
-
this.
|
|
12937
|
+
this.answerTime = answerTime;
|
|
12910
12938
|
this.state = state;
|
|
12911
12939
|
this.switchboardName = switchboardName;
|
|
12912
12940
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13543,6 +13571,7 @@ const Wazo = {
|
|
|
13543
13571
|
InvalidAuthorization,
|
|
13544
13572
|
CanceledCallError,
|
|
13545
13573
|
SFUNotAvailableError,
|
|
13574
|
+
NoTenantIdError,
|
|
13546
13575
|
};
|
|
13547
13576
|
|
|
13548
13577
|
if (window) {
|
package/lib/simple/index.js
CHANGED
|
@@ -2218,6 +2218,7 @@ class ApiRequester {
|
|
|
2218
2218
|
/* */
|
|
2219
2219
|
|
|
2220
2220
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2221
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2221
2222
|
const DETAULT_EXPIRATION = 3600;
|
|
2222
2223
|
|
|
2223
2224
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2267,12 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2267
2268
|
backend ,
|
|
2268
2269
|
expiration ,
|
|
2269
2270
|
isMobile = false,
|
|
2271
|
+
tenantId ,
|
|
2270
2272
|
) => {
|
|
2271
2273
|
const body = {
|
|
2272
2274
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2273
2275
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2274
2276
|
refresh_token: refreshToken,
|
|
2275
2277
|
client_id: client.clientId,
|
|
2278
|
+
tenant_id: tenantId,
|
|
2276
2279
|
};
|
|
2277
2280
|
|
|
2278
2281
|
const headers = {
|
|
@@ -5424,6 +5427,7 @@ class ApiClient {
|
|
|
5424
5427
|
|
|
5425
5428
|
|
|
5426
5429
|
|
|
5430
|
+
|
|
5427
5431
|
|
|
5428
5432
|
|
|
5429
5433
|
|
|
@@ -5464,6 +5468,7 @@ class ApiClient {
|
|
|
5464
5468
|
logger$a.info('refresh token callback called', {
|
|
5465
5469
|
refreshToken: this.refreshToken,
|
|
5466
5470
|
refreshBackend: this.refreshBackend,
|
|
5471
|
+
refreshTenantId: this.refreshTenantId,
|
|
5467
5472
|
refreshExpiration: this.refreshExpiration,
|
|
5468
5473
|
isMobile: this.isMobile,
|
|
5469
5474
|
});
|
|
@@ -5477,6 +5482,7 @@ class ApiClient {
|
|
|
5477
5482
|
this.refreshBackend,
|
|
5478
5483
|
this.refreshExpiration,
|
|
5479
5484
|
this.isMobile,
|
|
5485
|
+
this.refreshTenantId,
|
|
5480
5486
|
);
|
|
5481
5487
|
|
|
5482
5488
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5518,6 +5524,10 @@ class ApiClient {
|
|
|
5518
5524
|
this.refreshBackend = refreshBackend;
|
|
5519
5525
|
}
|
|
5520
5526
|
|
|
5527
|
+
setRefreshTenantId(tenantId ) {
|
|
5528
|
+
this.refreshTenantId = tenantId;
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5521
5531
|
setIsMobile(isMobile ) {
|
|
5522
5532
|
this.isMobile = isMobile;
|
|
5523
5533
|
}
|
|
@@ -5619,6 +5629,7 @@ var getApiClient = (forServer ) => {
|
|
|
5619
5629
|
|
|
5620
5630
|
class InvalidSubscription extends Error {}
|
|
5621
5631
|
class InvalidAuthorization extends Error {}
|
|
5632
|
+
class NoTenantIdError extends Error {}
|
|
5622
5633
|
|
|
5623
5634
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5624
5635
|
|
|
@@ -5632,11 +5643,15 @@ class Auth {
|
|
|
5632
5643
|
|
|
5633
5644
|
|
|
5634
5645
|
|
|
5646
|
+
|
|
5647
|
+
|
|
5635
5648
|
|
|
5636
5649
|
constructor() {
|
|
5637
5650
|
this.expiration = DETAULT_EXPIRATION;
|
|
5638
5651
|
this.authenticated = false;
|
|
5639
5652
|
this.minSubscriptionType = null;
|
|
5653
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
5654
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
5640
5655
|
}
|
|
5641
5656
|
|
|
5642
5657
|
init(clientId ,
|
|
@@ -5669,15 +5684,28 @@ class Auth {
|
|
|
5669
5684
|
setFetchOptions(options);
|
|
5670
5685
|
}
|
|
5671
5686
|
|
|
5672
|
-
async logIn(username , password ) {
|
|
5687
|
+
async logIn(username , password , backend , tenantId ) {
|
|
5688
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
5689
|
+
throw new NoTenantIdError('No tenant id');
|
|
5690
|
+
}
|
|
5691
|
+
|
|
5673
5692
|
this.authenticated = false;
|
|
5674
5693
|
this.session = null;
|
|
5675
5694
|
const rawSession = await getApiClient().auth.logIn({
|
|
5676
5695
|
username,
|
|
5677
5696
|
password,
|
|
5697
|
+
backend,
|
|
5698
|
+
tenantId,
|
|
5678
5699
|
expiration: this.expiration,
|
|
5679
5700
|
mobile: this.mobile,
|
|
5680
5701
|
});
|
|
5702
|
+
|
|
5703
|
+
if (backend) {
|
|
5704
|
+
getApiClient().setRefreshBackend(backend);
|
|
5705
|
+
}
|
|
5706
|
+
|
|
5707
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5708
|
+
|
|
5681
5709
|
return this._onAuthenticated(rawSession);
|
|
5682
5710
|
}
|
|
5683
5711
|
|
|
@@ -5904,7 +5932,7 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
5904
5932
|
|
|
5905
5933
|
|
|
5906
5934
|
|
|
5907
|
-
|
|
5935
|
+
|
|
5908
5936
|
|
|
5909
5937
|
|
|
5910
5938
|
|
|
@@ -5924,7 +5952,7 @@ class AdHocAPIConference {
|
|
|
5924
5952
|
|
|
5925
5953
|
|
|
5926
5954
|
|
|
5927
|
-
|
|
5955
|
+
|
|
5928
5956
|
|
|
5929
5957
|
|
|
5930
5958
|
|
|
@@ -5936,7 +5964,7 @@ class AdHocAPIConference {
|
|
|
5936
5964
|
participants,
|
|
5937
5965
|
started,
|
|
5938
5966
|
finished,
|
|
5939
|
-
|
|
5967
|
+
answerTime,
|
|
5940
5968
|
conferenceId,
|
|
5941
5969
|
muted,
|
|
5942
5970
|
paused,
|
|
@@ -5946,7 +5974,7 @@ class AdHocAPIConference {
|
|
|
5946
5974
|
this.participants = participants || {};
|
|
5947
5975
|
this.started = started || false;
|
|
5948
5976
|
this.finished = finished || false;
|
|
5949
|
-
this.
|
|
5977
|
+
this.answerTime = answerTime;
|
|
5950
5978
|
this.conferenceId = conferenceId || '';
|
|
5951
5979
|
this.muted = muted || false;
|
|
5952
5980
|
this.paused = paused || false;
|
|
@@ -5959,7 +5987,7 @@ class AdHocAPIConference {
|
|
|
5959
5987
|
async start() {
|
|
5960
5988
|
this.started = true;
|
|
5961
5989
|
// $FlowFixMe
|
|
5962
|
-
this.
|
|
5990
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5963
5991
|
|
|
5964
5992
|
const participantIds = Object.keys(this.participants);
|
|
5965
5993
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -13253,7 +13281,7 @@ class Room {
|
|
|
13253
13281
|
|
|
13254
13282
|
|
|
13255
13283
|
|
|
13256
|
-
|
|
13284
|
+
|
|
13257
13285
|
|
|
13258
13286
|
|
|
13259
13287
|
|
|
@@ -13279,7 +13307,7 @@ class SwitchboardCall {
|
|
|
13279
13307
|
|
|
13280
13308
|
|
|
13281
13309
|
|
|
13282
|
-
|
|
13310
|
+
|
|
13283
13311
|
|
|
13284
13312
|
|
|
13285
13313
|
|
|
@@ -13293,7 +13321,7 @@ class SwitchboardCall {
|
|
|
13293
13321
|
callerIdName: plain.caller_id_name || null,
|
|
13294
13322
|
callerIdNumber: plain.caller_id_number || null,
|
|
13295
13323
|
participantId: plain.participantId || null,
|
|
13296
|
-
|
|
13324
|
+
answerTime: plain.startTime,
|
|
13297
13325
|
state: plain.state,
|
|
13298
13326
|
switchboardName: plain.switchboardName,
|
|
13299
13327
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -13306,7 +13334,7 @@ class SwitchboardCall {
|
|
|
13306
13334
|
callerIdName,
|
|
13307
13335
|
callerIdNumber,
|
|
13308
13336
|
participantId,
|
|
13309
|
-
|
|
13337
|
+
answerTime,
|
|
13310
13338
|
state,
|
|
13311
13339
|
switchboardName,
|
|
13312
13340
|
switchboardUuid,
|
|
@@ -13316,7 +13344,7 @@ class SwitchboardCall {
|
|
|
13316
13344
|
this.callerIdName = callerIdName;
|
|
13317
13345
|
this.callerIdNumber = callerIdNumber;
|
|
13318
13346
|
this.participantId = participantId;
|
|
13319
|
-
this.
|
|
13347
|
+
this.answerTime = answerTime;
|
|
13320
13348
|
this.state = state;
|
|
13321
13349
|
this.switchboardName = switchboardName;
|
|
13322
13350
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13953,6 +13981,7 @@ const Wazo = {
|
|
|
13953
13981
|
InvalidAuthorization,
|
|
13954
13982
|
CanceledCallError,
|
|
13955
13983
|
SFUNotAvailableError,
|
|
13984
|
+
NoTenantIdError,
|
|
13956
13985
|
};
|
|
13957
13986
|
|
|
13958
13987
|
if (window) {
|
|
@@ -2244,6 +2244,7 @@ class Session {
|
|
|
2244
2244
|
/* */
|
|
2245
2245
|
|
|
2246
2246
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2247
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2247
2248
|
const DETAULT_EXPIRATION = 3600;
|
|
2248
2249
|
|
|
2249
2250
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2293,12 +2294,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2293
2294
|
backend ,
|
|
2294
2295
|
expiration ,
|
|
2295
2296
|
isMobile = false,
|
|
2297
|
+
tenantId ,
|
|
2296
2298
|
) => {
|
|
2297
2299
|
const body = {
|
|
2298
2300
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2299
2301
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2300
2302
|
refresh_token: refreshToken,
|
|
2301
2303
|
client_id: client.clientId,
|
|
2304
|
+
tenant_id: tenantId,
|
|
2302
2305
|
};
|
|
2303
2306
|
|
|
2304
2307
|
const headers = {
|
|
@@ -5424,6 +5427,7 @@ class ApiClient {
|
|
|
5424
5427
|
|
|
5425
5428
|
|
|
5426
5429
|
|
|
5430
|
+
|
|
5427
5431
|
|
|
5428
5432
|
|
|
5429
5433
|
|
|
@@ -5464,6 +5468,7 @@ class ApiClient {
|
|
|
5464
5468
|
logger$a.info('refresh token callback called', {
|
|
5465
5469
|
refreshToken: this.refreshToken,
|
|
5466
5470
|
refreshBackend: this.refreshBackend,
|
|
5471
|
+
refreshTenantId: this.refreshTenantId,
|
|
5467
5472
|
refreshExpiration: this.refreshExpiration,
|
|
5468
5473
|
isMobile: this.isMobile,
|
|
5469
5474
|
});
|
|
@@ -5477,6 +5482,7 @@ class ApiClient {
|
|
|
5477
5482
|
this.refreshBackend,
|
|
5478
5483
|
this.refreshExpiration,
|
|
5479
5484
|
this.isMobile,
|
|
5485
|
+
this.refreshTenantId,
|
|
5480
5486
|
);
|
|
5481
5487
|
|
|
5482
5488
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5518,6 +5524,10 @@ class ApiClient {
|
|
|
5518
5524
|
this.refreshBackend = refreshBackend;
|
|
5519
5525
|
}
|
|
5520
5526
|
|
|
5527
|
+
setRefreshTenantId(tenantId ) {
|
|
5528
|
+
this.refreshTenantId = tenantId;
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5521
5531
|
setIsMobile(isMobile ) {
|
|
5522
5532
|
this.isMobile = isMobile;
|
|
5523
5533
|
}
|
|
@@ -5619,6 +5629,7 @@ var getApiClient = (forServer ) => {
|
|
|
5619
5629
|
|
|
5620
5630
|
class InvalidSubscription extends Error {}
|
|
5621
5631
|
class InvalidAuthorization extends Error {}
|
|
5632
|
+
class NoTenantIdError extends Error {}
|
|
5622
5633
|
|
|
5623
5634
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5624
5635
|
|
|
@@ -5632,11 +5643,15 @@ class Auth {
|
|
|
5632
5643
|
|
|
5633
5644
|
|
|
5634
5645
|
|
|
5646
|
+
|
|
5647
|
+
|
|
5635
5648
|
|
|
5636
5649
|
constructor() {
|
|
5637
5650
|
this.expiration = DETAULT_EXPIRATION;
|
|
5638
5651
|
this.authenticated = false;
|
|
5639
5652
|
this.minSubscriptionType = null;
|
|
5653
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
5654
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
5640
5655
|
}
|
|
5641
5656
|
|
|
5642
5657
|
init(clientId ,
|
|
@@ -5669,15 +5684,28 @@ class Auth {
|
|
|
5669
5684
|
setFetchOptions(options);
|
|
5670
5685
|
}
|
|
5671
5686
|
|
|
5672
|
-
async logIn(username , password ) {
|
|
5687
|
+
async logIn(username , password , backend , tenantId ) {
|
|
5688
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
5689
|
+
throw new NoTenantIdError('No tenant id');
|
|
5690
|
+
}
|
|
5691
|
+
|
|
5673
5692
|
this.authenticated = false;
|
|
5674
5693
|
this.session = null;
|
|
5675
5694
|
const rawSession = await getApiClient().auth.logIn({
|
|
5676
5695
|
username,
|
|
5677
5696
|
password,
|
|
5697
|
+
backend,
|
|
5698
|
+
tenantId,
|
|
5678
5699
|
expiration: this.expiration,
|
|
5679
5700
|
mobile: this.mobile,
|
|
5680
5701
|
});
|
|
5702
|
+
|
|
5703
|
+
if (backend) {
|
|
5704
|
+
getApiClient().setRefreshBackend(backend);
|
|
5705
|
+
}
|
|
5706
|
+
|
|
5707
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5708
|
+
|
|
5681
5709
|
return this._onAuthenticated(rawSession);
|
|
5682
5710
|
}
|
|
5683
5711
|
|
|
@@ -5904,7 +5932,7 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
5904
5932
|
|
|
5905
5933
|
|
|
5906
5934
|
|
|
5907
|
-
|
|
5935
|
+
|
|
5908
5936
|
|
|
5909
5937
|
|
|
5910
5938
|
|
|
@@ -5924,7 +5952,7 @@ class AdHocAPIConference {
|
|
|
5924
5952
|
|
|
5925
5953
|
|
|
5926
5954
|
|
|
5927
|
-
|
|
5955
|
+
|
|
5928
5956
|
|
|
5929
5957
|
|
|
5930
5958
|
|
|
@@ -5936,7 +5964,7 @@ class AdHocAPIConference {
|
|
|
5936
5964
|
participants,
|
|
5937
5965
|
started,
|
|
5938
5966
|
finished,
|
|
5939
|
-
|
|
5967
|
+
answerTime,
|
|
5940
5968
|
conferenceId,
|
|
5941
5969
|
muted,
|
|
5942
5970
|
paused,
|
|
@@ -5946,7 +5974,7 @@ class AdHocAPIConference {
|
|
|
5946
5974
|
this.participants = participants || {};
|
|
5947
5975
|
this.started = started || false;
|
|
5948
5976
|
this.finished = finished || false;
|
|
5949
|
-
this.
|
|
5977
|
+
this.answerTime = answerTime;
|
|
5950
5978
|
this.conferenceId = conferenceId || '';
|
|
5951
5979
|
this.muted = muted || false;
|
|
5952
5980
|
this.paused = paused || false;
|
|
@@ -5959,7 +5987,7 @@ class AdHocAPIConference {
|
|
|
5959
5987
|
async start() {
|
|
5960
5988
|
this.started = true;
|
|
5961
5989
|
// $FlowFixMe
|
|
5962
|
-
this.
|
|
5990
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5963
5991
|
|
|
5964
5992
|
const participantIds = Object.keys(this.participants);
|
|
5965
5993
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -12122,7 +12150,7 @@ class Room$1 {
|
|
|
12122
12150
|
|
|
12123
12151
|
|
|
12124
12152
|
|
|
12125
|
-
|
|
12153
|
+
|
|
12126
12154
|
|
|
12127
12155
|
|
|
12128
12156
|
|
|
@@ -12148,7 +12176,7 @@ class SwitchboardCall {
|
|
|
12148
12176
|
|
|
12149
12177
|
|
|
12150
12178
|
|
|
12151
|
-
|
|
12179
|
+
|
|
12152
12180
|
|
|
12153
12181
|
|
|
12154
12182
|
|
|
@@ -12162,7 +12190,7 @@ class SwitchboardCall {
|
|
|
12162
12190
|
callerIdName: plain.caller_id_name || null,
|
|
12163
12191
|
callerIdNumber: plain.caller_id_number || null,
|
|
12164
12192
|
participantId: plain.participantId || null,
|
|
12165
|
-
|
|
12193
|
+
answerTime: plain.startTime,
|
|
12166
12194
|
state: plain.state,
|
|
12167
12195
|
switchboardName: plain.switchboardName,
|
|
12168
12196
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -12175,7 +12203,7 @@ class SwitchboardCall {
|
|
|
12175
12203
|
callerIdName,
|
|
12176
12204
|
callerIdNumber,
|
|
12177
12205
|
participantId,
|
|
12178
|
-
|
|
12206
|
+
answerTime,
|
|
12179
12207
|
state,
|
|
12180
12208
|
switchboardName,
|
|
12181
12209
|
switchboardUuid,
|
|
@@ -12185,7 +12213,7 @@ class SwitchboardCall {
|
|
|
12185
12213
|
this.callerIdName = callerIdName;
|
|
12186
12214
|
this.callerIdNumber = callerIdNumber;
|
|
12187
12215
|
this.participantId = participantId;
|
|
12188
|
-
this.
|
|
12216
|
+
this.answerTime = answerTime;
|
|
12189
12217
|
this.state = state;
|
|
12190
12218
|
this.switchboardName = switchboardName;
|
|
12191
12219
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -12822,6 +12850,7 @@ const Wazo = {
|
|
|
12822
12850
|
InvalidAuthorization,
|
|
12823
12851
|
CanceledCallError,
|
|
12824
12852
|
SFUNotAvailableError,
|
|
12853
|
+
NoTenantIdError,
|
|
12825
12854
|
};
|
|
12826
12855
|
|
|
12827
12856
|
if (window) {
|