@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
|
@@ -2218,6 +2218,7 @@ class Session {
|
|
|
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);
|
|
@@ -13114,7 +13142,7 @@ class Room {
|
|
|
13114
13142
|
|
|
13115
13143
|
|
|
13116
13144
|
|
|
13117
|
-
|
|
13145
|
+
|
|
13118
13146
|
|
|
13119
13147
|
|
|
13120
13148
|
|
|
@@ -13140,7 +13168,7 @@ class SwitchboardCall {
|
|
|
13140
13168
|
|
|
13141
13169
|
|
|
13142
13170
|
|
|
13143
|
-
|
|
13171
|
+
|
|
13144
13172
|
|
|
13145
13173
|
|
|
13146
13174
|
|
|
@@ -13154,7 +13182,7 @@ class SwitchboardCall {
|
|
|
13154
13182
|
callerIdName: plain.caller_id_name || null,
|
|
13155
13183
|
callerIdNumber: plain.caller_id_number || null,
|
|
13156
13184
|
participantId: plain.participantId || null,
|
|
13157
|
-
|
|
13185
|
+
answerTime: plain.startTime,
|
|
13158
13186
|
state: plain.state,
|
|
13159
13187
|
switchboardName: plain.switchboardName,
|
|
13160
13188
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -13167,7 +13195,7 @@ class SwitchboardCall {
|
|
|
13167
13195
|
callerIdName,
|
|
13168
13196
|
callerIdNumber,
|
|
13169
13197
|
participantId,
|
|
13170
|
-
|
|
13198
|
+
answerTime,
|
|
13171
13199
|
state,
|
|
13172
13200
|
switchboardName,
|
|
13173
13201
|
switchboardUuid,
|
|
@@ -13177,7 +13205,7 @@ class SwitchboardCall {
|
|
|
13177
13205
|
this.callerIdName = callerIdName;
|
|
13178
13206
|
this.callerIdNumber = callerIdNumber;
|
|
13179
13207
|
this.participantId = participantId;
|
|
13180
|
-
this.
|
|
13208
|
+
this.answerTime = answerTime;
|
|
13181
13209
|
this.state = state;
|
|
13182
13210
|
this.switchboardName = switchboardName;
|
|
13183
13211
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13814,6 +13842,7 @@ const Wazo = {
|
|
|
13814
13842
|
InvalidAuthorization,
|
|
13815
13843
|
CanceledCallError,
|
|
13816
13844
|
SFUNotAvailableError,
|
|
13845
|
+
NoTenantIdError,
|
|
13817
13846
|
};
|
|
13818
13847
|
|
|
13819
13848
|
if (window) {
|
|
@@ -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);
|
|
@@ -13195,7 +13223,7 @@ class Room {
|
|
|
13195
13223
|
|
|
13196
13224
|
|
|
13197
13225
|
|
|
13198
|
-
|
|
13226
|
+
|
|
13199
13227
|
|
|
13200
13228
|
|
|
13201
13229
|
|
|
@@ -13221,7 +13249,7 @@ class SwitchboardCall {
|
|
|
13221
13249
|
|
|
13222
13250
|
|
|
13223
13251
|
|
|
13224
|
-
|
|
13252
|
+
|
|
13225
13253
|
|
|
13226
13254
|
|
|
13227
13255
|
|
|
@@ -13235,7 +13263,7 @@ class SwitchboardCall {
|
|
|
13235
13263
|
callerIdName: plain.caller_id_name || null,
|
|
13236
13264
|
callerIdNumber: plain.caller_id_number || null,
|
|
13237
13265
|
participantId: plain.participantId || null,
|
|
13238
|
-
|
|
13266
|
+
answerTime: plain.startTime,
|
|
13239
13267
|
state: plain.state,
|
|
13240
13268
|
switchboardName: plain.switchboardName,
|
|
13241
13269
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -13248,7 +13276,7 @@ class SwitchboardCall {
|
|
|
13248
13276
|
callerIdName,
|
|
13249
13277
|
callerIdNumber,
|
|
13250
13278
|
participantId,
|
|
13251
|
-
|
|
13279
|
+
answerTime,
|
|
13252
13280
|
state,
|
|
13253
13281
|
switchboardName,
|
|
13254
13282
|
switchboardUuid,
|
|
@@ -13258,7 +13286,7 @@ class SwitchboardCall {
|
|
|
13258
13286
|
this.callerIdName = callerIdName;
|
|
13259
13287
|
this.callerIdNumber = callerIdNumber;
|
|
13260
13288
|
this.participantId = participantId;
|
|
13261
|
-
this.
|
|
13289
|
+
this.answerTime = answerTime;
|
|
13262
13290
|
this.state = state;
|
|
13263
13291
|
this.switchboardName = switchboardName;
|
|
13264
13292
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13895,6 +13923,7 @@ const Wazo = {
|
|
|
13895
13923
|
InvalidAuthorization,
|
|
13896
13924
|
CanceledCallError,
|
|
13897
13925
|
SFUNotAvailableError,
|
|
13926
|
+
NoTenantIdError,
|
|
13898
13927
|
};
|
|
13899
13928
|
|
|
13900
13929
|
if (window) {
|
|
@@ -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) {
|