@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
|
@@ -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);
|
|
@@ -12127,7 +12155,7 @@ class Room$1 {
|
|
|
12127
12155
|
|
|
12128
12156
|
|
|
12129
12157
|
|
|
12130
|
-
|
|
12158
|
+
|
|
12131
12159
|
|
|
12132
12160
|
|
|
12133
12161
|
|
|
@@ -12153,7 +12181,7 @@ class SwitchboardCall {
|
|
|
12153
12181
|
|
|
12154
12182
|
|
|
12155
12183
|
|
|
12156
|
-
|
|
12184
|
+
|
|
12157
12185
|
|
|
12158
12186
|
|
|
12159
12187
|
|
|
@@ -12167,7 +12195,7 @@ class SwitchboardCall {
|
|
|
12167
12195
|
callerIdName: plain.caller_id_name || null,
|
|
12168
12196
|
callerIdNumber: plain.caller_id_number || null,
|
|
12169
12197
|
participantId: plain.participantId || null,
|
|
12170
|
-
|
|
12198
|
+
answerTime: plain.startTime,
|
|
12171
12199
|
state: plain.state,
|
|
12172
12200
|
switchboardName: plain.switchboardName,
|
|
12173
12201
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -12180,7 +12208,7 @@ class SwitchboardCall {
|
|
|
12180
12208
|
callerIdName,
|
|
12181
12209
|
callerIdNumber,
|
|
12182
12210
|
participantId,
|
|
12183
|
-
|
|
12211
|
+
answerTime,
|
|
12184
12212
|
state,
|
|
12185
12213
|
switchboardName,
|
|
12186
12214
|
switchboardUuid,
|
|
@@ -12190,7 +12218,7 @@ class SwitchboardCall {
|
|
|
12190
12218
|
this.callerIdName = callerIdName;
|
|
12191
12219
|
this.callerIdNumber = callerIdNumber;
|
|
12192
12220
|
this.participantId = participantId;
|
|
12193
|
-
this.
|
|
12221
|
+
this.answerTime = answerTime;
|
|
12194
12222
|
this.state = state;
|
|
12195
12223
|
this.switchboardName = switchboardName;
|
|
12196
12224
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -12827,6 +12855,7 @@ const Wazo = {
|
|
|
12827
12855
|
InvalidAuthorization,
|
|
12828
12856
|
CanceledCallError,
|
|
12829
12857
|
SFUNotAvailableError,
|
|
12858
|
+
NoTenantIdError,
|
|
12830
12859
|
};
|
|
12831
12860
|
|
|
12832
12861
|
if (window) {
|
|
@@ -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);
|
|
@@ -12406,7 +12434,7 @@ class Room$1 {
|
|
|
12406
12434
|
|
|
12407
12435
|
|
|
12408
12436
|
|
|
12409
|
-
|
|
12437
|
+
|
|
12410
12438
|
|
|
12411
12439
|
|
|
12412
12440
|
|
|
@@ -12432,7 +12460,7 @@ class SwitchboardCall {
|
|
|
12432
12460
|
|
|
12433
12461
|
|
|
12434
12462
|
|
|
12435
|
-
|
|
12463
|
+
|
|
12436
12464
|
|
|
12437
12465
|
|
|
12438
12466
|
|
|
@@ -12446,7 +12474,7 @@ class SwitchboardCall {
|
|
|
12446
12474
|
callerIdName: plain.caller_id_name || null,
|
|
12447
12475
|
callerIdNumber: plain.caller_id_number || null,
|
|
12448
12476
|
participantId: plain.participantId || null,
|
|
12449
|
-
|
|
12477
|
+
answerTime: plain.startTime,
|
|
12450
12478
|
state: plain.state,
|
|
12451
12479
|
switchboardName: plain.switchboardName,
|
|
12452
12480
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -12459,7 +12487,7 @@ class SwitchboardCall {
|
|
|
12459
12487
|
callerIdName,
|
|
12460
12488
|
callerIdNumber,
|
|
12461
12489
|
participantId,
|
|
12462
|
-
|
|
12490
|
+
answerTime,
|
|
12463
12491
|
state,
|
|
12464
12492
|
switchboardName,
|
|
12465
12493
|
switchboardUuid,
|
|
@@ -12469,7 +12497,7 @@ class SwitchboardCall {
|
|
|
12469
12497
|
this.callerIdName = callerIdName;
|
|
12470
12498
|
this.callerIdNumber = callerIdNumber;
|
|
12471
12499
|
this.participantId = participantId;
|
|
12472
|
-
this.
|
|
12500
|
+
this.answerTime = answerTime;
|
|
12473
12501
|
this.state = state;
|
|
12474
12502
|
this.switchboardName = switchboardName;
|
|
12475
12503
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13106,6 +13134,7 @@ const Wazo = {
|
|
|
13106
13134
|
InvalidAuthorization,
|
|
13107
13135
|
CanceledCallError,
|
|
13108
13136
|
SFUNotAvailableError,
|
|
13137
|
+
NoTenantIdError,
|
|
13109
13138
|
};
|
|
13110
13139
|
|
|
13111
13140
|
if (window) {
|
package/lib/simple/room/Room.js
CHANGED
|
@@ -2220,6 +2220,7 @@ class Session {
|
|
|
2220
2220
|
/* */
|
|
2221
2221
|
|
|
2222
2222
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2223
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2223
2224
|
const DETAULT_EXPIRATION = 3600;
|
|
2224
2225
|
|
|
2225
2226
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2269,12 +2270,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2269
2270
|
backend ,
|
|
2270
2271
|
expiration ,
|
|
2271
2272
|
isMobile = false,
|
|
2273
|
+
tenantId ,
|
|
2272
2274
|
) => {
|
|
2273
2275
|
const body = {
|
|
2274
2276
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2275
2277
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2276
2278
|
refresh_token: refreshToken,
|
|
2277
2279
|
client_id: client.clientId,
|
|
2280
|
+
tenant_id: tenantId,
|
|
2278
2281
|
};
|
|
2279
2282
|
|
|
2280
2283
|
const headers = {
|
|
@@ -5426,6 +5429,7 @@ class ApiClient {
|
|
|
5426
5429
|
|
|
5427
5430
|
|
|
5428
5431
|
|
|
5432
|
+
|
|
5429
5433
|
|
|
5430
5434
|
|
|
5431
5435
|
|
|
@@ -5466,6 +5470,7 @@ class ApiClient {
|
|
|
5466
5470
|
logger$a.info('refresh token callback called', {
|
|
5467
5471
|
refreshToken: this.refreshToken,
|
|
5468
5472
|
refreshBackend: this.refreshBackend,
|
|
5473
|
+
refreshTenantId: this.refreshTenantId,
|
|
5469
5474
|
refreshExpiration: this.refreshExpiration,
|
|
5470
5475
|
isMobile: this.isMobile,
|
|
5471
5476
|
});
|
|
@@ -5479,6 +5484,7 @@ class ApiClient {
|
|
|
5479
5484
|
this.refreshBackend,
|
|
5480
5485
|
this.refreshExpiration,
|
|
5481
5486
|
this.isMobile,
|
|
5487
|
+
this.refreshTenantId,
|
|
5482
5488
|
);
|
|
5483
5489
|
|
|
5484
5490
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5520,6 +5526,10 @@ class ApiClient {
|
|
|
5520
5526
|
this.refreshBackend = refreshBackend;
|
|
5521
5527
|
}
|
|
5522
5528
|
|
|
5529
|
+
setRefreshTenantId(tenantId ) {
|
|
5530
|
+
this.refreshTenantId = tenantId;
|
|
5531
|
+
}
|
|
5532
|
+
|
|
5523
5533
|
setIsMobile(isMobile ) {
|
|
5524
5534
|
this.isMobile = isMobile;
|
|
5525
5535
|
}
|
|
@@ -5621,6 +5631,7 @@ var getApiClient = (forServer ) => {
|
|
|
5621
5631
|
|
|
5622
5632
|
class InvalidSubscription extends Error {}
|
|
5623
5633
|
class InvalidAuthorization extends Error {}
|
|
5634
|
+
class NoTenantIdError extends Error {}
|
|
5624
5635
|
|
|
5625
5636
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5626
5637
|
|
|
@@ -5634,11 +5645,15 @@ class Auth {
|
|
|
5634
5645
|
|
|
5635
5646
|
|
|
5636
5647
|
|
|
5648
|
+
|
|
5649
|
+
|
|
5637
5650
|
|
|
5638
5651
|
constructor() {
|
|
5639
5652
|
this.expiration = DETAULT_EXPIRATION;
|
|
5640
5653
|
this.authenticated = false;
|
|
5641
5654
|
this.minSubscriptionType = null;
|
|
5655
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
5656
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
5642
5657
|
}
|
|
5643
5658
|
|
|
5644
5659
|
init(clientId ,
|
|
@@ -5671,15 +5686,28 @@ class Auth {
|
|
|
5671
5686
|
setFetchOptions(options);
|
|
5672
5687
|
}
|
|
5673
5688
|
|
|
5674
|
-
async logIn(username , password ) {
|
|
5689
|
+
async logIn(username , password , backend , tenantId ) {
|
|
5690
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
5691
|
+
throw new NoTenantIdError('No tenant id');
|
|
5692
|
+
}
|
|
5693
|
+
|
|
5675
5694
|
this.authenticated = false;
|
|
5676
5695
|
this.session = null;
|
|
5677
5696
|
const rawSession = await getApiClient().auth.logIn({
|
|
5678
5697
|
username,
|
|
5679
5698
|
password,
|
|
5699
|
+
backend,
|
|
5700
|
+
tenantId,
|
|
5680
5701
|
expiration: this.expiration,
|
|
5681
5702
|
mobile: this.mobile,
|
|
5682
5703
|
});
|
|
5704
|
+
|
|
5705
|
+
if (backend) {
|
|
5706
|
+
getApiClient().setRefreshBackend(backend);
|
|
5707
|
+
}
|
|
5708
|
+
|
|
5709
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5710
|
+
|
|
5683
5711
|
return this._onAuthenticated(rawSession);
|
|
5684
5712
|
}
|
|
5685
5713
|
|
|
@@ -5906,7 +5934,7 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
5906
5934
|
|
|
5907
5935
|
|
|
5908
5936
|
|
|
5909
|
-
|
|
5937
|
+
|
|
5910
5938
|
|
|
5911
5939
|
|
|
5912
5940
|
|
|
@@ -5926,7 +5954,7 @@ class AdHocAPIConference {
|
|
|
5926
5954
|
|
|
5927
5955
|
|
|
5928
5956
|
|
|
5929
|
-
|
|
5957
|
+
|
|
5930
5958
|
|
|
5931
5959
|
|
|
5932
5960
|
|
|
@@ -5938,7 +5966,7 @@ class AdHocAPIConference {
|
|
|
5938
5966
|
participants,
|
|
5939
5967
|
started,
|
|
5940
5968
|
finished,
|
|
5941
|
-
|
|
5969
|
+
answerTime,
|
|
5942
5970
|
conferenceId,
|
|
5943
5971
|
muted,
|
|
5944
5972
|
paused,
|
|
@@ -5948,7 +5976,7 @@ class AdHocAPIConference {
|
|
|
5948
5976
|
this.participants = participants || {};
|
|
5949
5977
|
this.started = started || false;
|
|
5950
5978
|
this.finished = finished || false;
|
|
5951
|
-
this.
|
|
5979
|
+
this.answerTime = answerTime;
|
|
5952
5980
|
this.conferenceId = conferenceId || '';
|
|
5953
5981
|
this.muted = muted || false;
|
|
5954
5982
|
this.paused = paused || false;
|
|
@@ -5961,7 +5989,7 @@ class AdHocAPIConference {
|
|
|
5961
5989
|
async start() {
|
|
5962
5990
|
this.started = true;
|
|
5963
5991
|
// $FlowFixMe
|
|
5964
|
-
this.
|
|
5992
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5965
5993
|
|
|
5966
5994
|
const participantIds = Object.keys(this.participants);
|
|
5967
5995
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -12419,7 +12447,7 @@ class Room$1 {
|
|
|
12419
12447
|
|
|
12420
12448
|
|
|
12421
12449
|
|
|
12422
|
-
|
|
12450
|
+
|
|
12423
12451
|
|
|
12424
12452
|
|
|
12425
12453
|
|
|
@@ -12445,7 +12473,7 @@ class SwitchboardCall {
|
|
|
12445
12473
|
|
|
12446
12474
|
|
|
12447
12475
|
|
|
12448
|
-
|
|
12476
|
+
|
|
12449
12477
|
|
|
12450
12478
|
|
|
12451
12479
|
|
|
@@ -12459,7 +12487,7 @@ class SwitchboardCall {
|
|
|
12459
12487
|
callerIdName: plain.caller_id_name || null,
|
|
12460
12488
|
callerIdNumber: plain.caller_id_number || null,
|
|
12461
12489
|
participantId: plain.participantId || null,
|
|
12462
|
-
|
|
12490
|
+
answerTime: plain.startTime,
|
|
12463
12491
|
state: plain.state,
|
|
12464
12492
|
switchboardName: plain.switchboardName,
|
|
12465
12493
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -12472,7 +12500,7 @@ class SwitchboardCall {
|
|
|
12472
12500
|
callerIdName,
|
|
12473
12501
|
callerIdNumber,
|
|
12474
12502
|
participantId,
|
|
12475
|
-
|
|
12503
|
+
answerTime,
|
|
12476
12504
|
state,
|
|
12477
12505
|
switchboardName,
|
|
12478
12506
|
switchboardUuid,
|
|
@@ -12482,7 +12510,7 @@ class SwitchboardCall {
|
|
|
12482
12510
|
this.callerIdName = callerIdName;
|
|
12483
12511
|
this.callerIdNumber = callerIdNumber;
|
|
12484
12512
|
this.participantId = participantId;
|
|
12485
|
-
this.
|
|
12513
|
+
this.answerTime = answerTime;
|
|
12486
12514
|
this.state = state;
|
|
12487
12515
|
this.switchboardName = switchboardName;
|
|
12488
12516
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13119,6 +13147,7 @@ const Wazo = {
|
|
|
13119
13147
|
InvalidAuthorization,
|
|
13120
13148
|
CanceledCallError,
|
|
13121
13149
|
SFUNotAvailableError,
|
|
13150
|
+
NoTenantIdError,
|
|
13122
13151
|
};
|
|
13123
13152
|
|
|
13124
13153
|
if (window) {
|