@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
|
@@ -2234,6 +2234,7 @@ class Session {
|
|
|
2234
2234
|
/* */
|
|
2235
2235
|
|
|
2236
2236
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2237
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2237
2238
|
const DETAULT_EXPIRATION = 3600;
|
|
2238
2239
|
|
|
2239
2240
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2283,12 +2284,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2283
2284
|
backend ,
|
|
2284
2285
|
expiration ,
|
|
2285
2286
|
isMobile = false,
|
|
2287
|
+
tenantId ,
|
|
2286
2288
|
) => {
|
|
2287
2289
|
const body = {
|
|
2288
2290
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2289
2291
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2290
2292
|
refresh_token: refreshToken,
|
|
2291
2293
|
client_id: client.clientId,
|
|
2294
|
+
tenant_id: tenantId,
|
|
2292
2295
|
};
|
|
2293
2296
|
|
|
2294
2297
|
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);
|
|
@@ -12112,7 +12140,7 @@ class Room$1 {
|
|
|
12112
12140
|
|
|
12113
12141
|
|
|
12114
12142
|
|
|
12115
|
-
|
|
12143
|
+
|
|
12116
12144
|
|
|
12117
12145
|
|
|
12118
12146
|
|
|
@@ -12138,7 +12166,7 @@ class SwitchboardCall {
|
|
|
12138
12166
|
|
|
12139
12167
|
|
|
12140
12168
|
|
|
12141
|
-
|
|
12169
|
+
|
|
12142
12170
|
|
|
12143
12171
|
|
|
12144
12172
|
|
|
@@ -12152,7 +12180,7 @@ class SwitchboardCall {
|
|
|
12152
12180
|
callerIdName: plain.caller_id_name || null,
|
|
12153
12181
|
callerIdNumber: plain.caller_id_number || null,
|
|
12154
12182
|
participantId: plain.participantId || null,
|
|
12155
|
-
|
|
12183
|
+
answerTime: plain.startTime,
|
|
12156
12184
|
state: plain.state,
|
|
12157
12185
|
switchboardName: plain.switchboardName,
|
|
12158
12186
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -12165,7 +12193,7 @@ class SwitchboardCall {
|
|
|
12165
12193
|
callerIdName,
|
|
12166
12194
|
callerIdNumber,
|
|
12167
12195
|
participantId,
|
|
12168
|
-
|
|
12196
|
+
answerTime,
|
|
12169
12197
|
state,
|
|
12170
12198
|
switchboardName,
|
|
12171
12199
|
switchboardUuid,
|
|
@@ -12175,7 +12203,7 @@ class SwitchboardCall {
|
|
|
12175
12203
|
this.callerIdName = callerIdName;
|
|
12176
12204
|
this.callerIdNumber = callerIdNumber;
|
|
12177
12205
|
this.participantId = participantId;
|
|
12178
|
-
this.
|
|
12206
|
+
this.answerTime = answerTime;
|
|
12179
12207
|
this.state = state;
|
|
12180
12208
|
this.switchboardName = switchboardName;
|
|
12181
12209
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -12812,6 +12840,7 @@ const Wazo = {
|
|
|
12812
12840
|
InvalidAuthorization,
|
|
12813
12841
|
CanceledCallError,
|
|
12814
12842
|
SFUNotAvailableError,
|
|
12843
|
+
NoTenantIdError,
|
|
12815
12844
|
};
|
|
12816
12845
|
|
|
12817
12846
|
if (window) {
|
|
@@ -2234,6 +2234,7 @@ class Session {
|
|
|
2234
2234
|
/* */
|
|
2235
2235
|
|
|
2236
2236
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2237
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2237
2238
|
const DETAULT_EXPIRATION = 3600;
|
|
2238
2239
|
|
|
2239
2240
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2283,12 +2284,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2283
2284
|
backend ,
|
|
2284
2285
|
expiration ,
|
|
2285
2286
|
isMobile = false,
|
|
2287
|
+
tenantId ,
|
|
2286
2288
|
) => {
|
|
2287
2289
|
const body = {
|
|
2288
2290
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2289
2291
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2290
2292
|
refresh_token: refreshToken,
|
|
2291
2293
|
client_id: client.clientId,
|
|
2294
|
+
tenant_id: tenantId,
|
|
2292
2295
|
};
|
|
2293
2296
|
|
|
2294
2297
|
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);
|
|
@@ -12117,7 +12145,7 @@ class Room$1 {
|
|
|
12117
12145
|
|
|
12118
12146
|
|
|
12119
12147
|
|
|
12120
|
-
|
|
12148
|
+
|
|
12121
12149
|
|
|
12122
12150
|
|
|
12123
12151
|
|
|
@@ -12143,7 +12171,7 @@ class SwitchboardCall {
|
|
|
12143
12171
|
|
|
12144
12172
|
|
|
12145
12173
|
|
|
12146
|
-
|
|
12174
|
+
|
|
12147
12175
|
|
|
12148
12176
|
|
|
12149
12177
|
|
|
@@ -12157,7 +12185,7 @@ class SwitchboardCall {
|
|
|
12157
12185
|
callerIdName: plain.caller_id_name || null,
|
|
12158
12186
|
callerIdNumber: plain.caller_id_number || null,
|
|
12159
12187
|
participantId: plain.participantId || null,
|
|
12160
|
-
|
|
12188
|
+
answerTime: plain.startTime,
|
|
12161
12189
|
state: plain.state,
|
|
12162
12190
|
switchboardName: plain.switchboardName,
|
|
12163
12191
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -12170,7 +12198,7 @@ class SwitchboardCall {
|
|
|
12170
12198
|
callerIdName,
|
|
12171
12199
|
callerIdNumber,
|
|
12172
12200
|
participantId,
|
|
12173
|
-
|
|
12201
|
+
answerTime,
|
|
12174
12202
|
state,
|
|
12175
12203
|
switchboardName,
|
|
12176
12204
|
switchboardUuid,
|
|
@@ -12180,7 +12208,7 @@ class SwitchboardCall {
|
|
|
12180
12208
|
this.callerIdName = callerIdName;
|
|
12181
12209
|
this.callerIdNumber = callerIdNumber;
|
|
12182
12210
|
this.participantId = participantId;
|
|
12183
|
-
this.
|
|
12211
|
+
this.answerTime = answerTime;
|
|
12184
12212
|
this.state = state;
|
|
12185
12213
|
this.switchboardName = switchboardName;
|
|
12186
12214
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -12817,6 +12845,7 @@ const Wazo = {
|
|
|
12817
12845
|
InvalidAuthorization,
|
|
12818
12846
|
CanceledCallError,
|
|
12819
12847
|
SFUNotAvailableError,
|
|
12848
|
+
NoTenantIdError,
|
|
12820
12849
|
};
|
|
12821
12850
|
|
|
12822
12851
|
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);
|
|
@@ -12396,7 +12424,7 @@ class Room$1 {
|
|
|
12396
12424
|
|
|
12397
12425
|
|
|
12398
12426
|
|
|
12399
|
-
|
|
12427
|
+
|
|
12400
12428
|
|
|
12401
12429
|
|
|
12402
12430
|
|
|
@@ -12422,7 +12450,7 @@ class SwitchboardCall {
|
|
|
12422
12450
|
|
|
12423
12451
|
|
|
12424
12452
|
|
|
12425
|
-
|
|
12453
|
+
|
|
12426
12454
|
|
|
12427
12455
|
|
|
12428
12456
|
|
|
@@ -12436,7 +12464,7 @@ class SwitchboardCall {
|
|
|
12436
12464
|
callerIdName: plain.caller_id_name || null,
|
|
12437
12465
|
callerIdNumber: plain.caller_id_number || null,
|
|
12438
12466
|
participantId: plain.participantId || null,
|
|
12439
|
-
|
|
12467
|
+
answerTime: plain.startTime,
|
|
12440
12468
|
state: plain.state,
|
|
12441
12469
|
switchboardName: plain.switchboardName,
|
|
12442
12470
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -12449,7 +12477,7 @@ class SwitchboardCall {
|
|
|
12449
12477
|
callerIdName,
|
|
12450
12478
|
callerIdNumber,
|
|
12451
12479
|
participantId,
|
|
12452
|
-
|
|
12480
|
+
answerTime,
|
|
12453
12481
|
state,
|
|
12454
12482
|
switchboardName,
|
|
12455
12483
|
switchboardUuid,
|
|
@@ -12459,7 +12487,7 @@ class SwitchboardCall {
|
|
|
12459
12487
|
this.callerIdName = callerIdName;
|
|
12460
12488
|
this.callerIdNumber = callerIdNumber;
|
|
12461
12489
|
this.participantId = participantId;
|
|
12462
|
-
this.
|
|
12490
|
+
this.answerTime = answerTime;
|
|
12463
12491
|
this.state = state;
|
|
12464
12492
|
this.switchboardName = switchboardName;
|
|
12465
12493
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13096,6 +13124,7 @@ const Wazo = {
|
|
|
13096
13124
|
InvalidAuthorization,
|
|
13097
13125
|
CanceledCallError,
|
|
13098
13126
|
SFUNotAvailableError,
|
|
13127
|
+
NoTenantIdError,
|
|
13099
13128
|
};
|
|
13100
13129
|
|
|
13101
13130
|
if (window) {
|