@wazo/sdk 0.37.35 → 0.37.38
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 +8 -2
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +7 -1
- package/esm/__tests__/web-rtc-client.test.js +7 -1
- package/esm/api/auth.js +2 -1
- package/esm/api/call-logd.js +1 -1
- package/esm/api/chatd.js +6 -0
- package/esm/api/confd.js +6 -0
- package/esm/api-client.js +7 -1
- package/esm/checker/Checker.js +7 -1
- package/esm/checker/checks/aor.js +7 -1
- package/esm/checker/checks/api.js +7 -1
- package/esm/checker/checks/index.js +7 -1
- package/esm/checker/checks/webrtc-transport.js +7 -1
- package/esm/checker/checks/webrtc.js +7 -1
- package/esm/domain/AdHocAPIConference.js +16 -6
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/CallSession.js +14 -0
- package/esm/domain/Features.js +7 -1
- package/esm/domain/Phone/CTIPhone.js +21 -1
- package/esm/domain/Phone/WebRTCPhone.js +42 -11
- package/esm/domain/Profile.js +6 -0
- package/esm/domain/SwitchboardCall.js +5 -5
- package/esm/domain/__tests__/CallLog.test.js +5 -1
- package/esm/domain/__tests__/CallSession.test.js +14 -0
- package/esm/domain/__tests__/IndirectTransfer.test.js +14 -0
- package/esm/domain/__tests__/Profile.test.js +6 -0
- package/esm/domain/__tests__/Room.test.js +14 -0
- package/esm/domain/__tests__/Session.test.js +6 -0
- package/esm/index.js +83 -29
- package/esm/service/CallApi.js +7 -1
- package/esm/service/getApiClient.js +7 -1
- package/esm/simple/Auth.js +84 -30
- package/esm/simple/Configuration.js +83 -29
- package/esm/simple/Directory.js +7 -1
- package/esm/simple/Phone.js +83 -29
- package/esm/simple/index.js +83 -29
- package/esm/simple/room/LocalParticipant.js +83 -29
- package/esm/simple/room/Participant.js +83 -29
- package/esm/simple/room/RemoteParticipant.js +83 -29
- package/esm/simple/room/Room.js +83 -29
- package/esm/simple/room/SipRoom.js +83 -29
- package/esm/simple/room/Stream.js +83 -29
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +83 -29
- package/esm/simple/utils.js +83 -29
- package/esm/web-rtc-client.js +7 -1
- package/lib/__tests__/api-client.test.js +7 -1
- package/lib/__tests__/web-rtc-client.test.js +7 -1
- package/lib/api/auth.js +3 -0
- package/lib/api/call-logd.js +1 -1
- package/lib/api/chatd.js +6 -0
- package/lib/api/confd.js +6 -0
- package/lib/api-client.js +7 -1
- package/lib/checker/Checker.js +7 -1
- package/lib/checker/checks/aor.js +7 -1
- package/lib/checker/checks/api.js +7 -1
- package/lib/checker/checks/index.js +7 -1
- package/lib/checker/checks/webrtc-transport.js +7 -1
- package/lib/checker/checks/webrtc.js +7 -1
- package/lib/domain/AdHocAPIConference.js +16 -6
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/CallSession.js +14 -0
- package/lib/domain/Features.js +7 -1
- package/lib/domain/Phone/CTIPhone.js +21 -1
- package/lib/domain/Phone/WebRTCPhone.js +42 -11
- package/lib/domain/Profile.js +6 -0
- package/lib/domain/SwitchboardCall.js +5 -5
- package/lib/domain/__tests__/CallLog.test.js +5 -1
- package/lib/domain/__tests__/CallSession.test.js +14 -0
- package/lib/domain/__tests__/IndirectTransfer.test.js +14 -0
- package/lib/domain/__tests__/Profile.test.js +6 -0
- package/lib/domain/__tests__/Room.test.js +14 -0
- package/lib/domain/__tests__/Session.test.js +6 -0
- package/lib/index.js +83 -29
- package/lib/service/CallApi.js +7 -1
- package/lib/service/getApiClient.js +7 -1
- package/lib/simple/Auth.js +84 -29
- package/lib/simple/Configuration.js +83 -29
- package/lib/simple/Directory.js +7 -1
- package/lib/simple/Phone.js +83 -29
- package/lib/simple/index.js +83 -29
- package/lib/simple/room/LocalParticipant.js +83 -29
- package/lib/simple/room/Participant.js +83 -29
- package/lib/simple/room/RemoteParticipant.js +83 -29
- package/lib/simple/room/Room.js +83 -29
- package/lib/simple/room/SipRoom.js +83 -29
- package/lib/simple/room/Stream.js +83 -29
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +83 -29
- package/lib/simple/utils.js +83 -29
- package/lib/web-rtc-client.js +7 -1
- package/package.json +1 -1
- package/src/api/auth.js +2 -1
- package/src/domain/AdHocAPIConference.js +9 -5
- package/src/domain/CallLog.js +1 -1
- package/src/domain/CallSession.js +14 -0
- package/src/domain/Phone/WebRTCPhone.js +28 -11
- package/src/domain/Profile.js +6 -0
- package/src/domain/SwitchboardCall.js +5 -5
- package/src/domain/__tests__/CallLog.test.js +4 -0
- package/src/simple/Auth.js +13 -2
- package/src/simple/Phone.js +6 -6
- package/src/simple/index.js +2 -1
package/lib/simple/Auth.js
CHANGED
|
@@ -396,6 +396,7 @@ const LINE_STATE = {
|
|
|
396
396
|
|
|
397
397
|
|
|
398
398
|
|
|
399
|
+
|
|
399
400
|
|
|
400
401
|
|
|
401
402
|
|
|
@@ -432,6 +433,7 @@ const LINE_STATE = {
|
|
|
432
433
|
|
|
433
434
|
|
|
434
435
|
|
|
436
|
+
|
|
435
437
|
|
|
436
438
|
|
|
437
439
|
|
|
@@ -463,6 +465,7 @@ class Profile {
|
|
|
463
465
|
|
|
464
466
|
|
|
465
467
|
|
|
468
|
+
|
|
466
469
|
|
|
467
470
|
|
|
468
471
|
|
|
@@ -479,6 +482,7 @@ class Profile {
|
|
|
479
482
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
480
483
|
username: plain.username,
|
|
481
484
|
mobileNumber: plain.mobile_phone_number || '',
|
|
485
|
+
ringSeconds: plain.ring_seconds,
|
|
482
486
|
forwards: [
|
|
483
487
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
484
488
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -515,6 +519,7 @@ class Profile {
|
|
|
515
519
|
switchboards,
|
|
516
520
|
agent,
|
|
517
521
|
status,
|
|
522
|
+
ringSeconds,
|
|
518
523
|
sipLines,
|
|
519
524
|
callPickupTargetUsers,
|
|
520
525
|
onlineCallRecordEnabled,
|
|
@@ -536,6 +541,7 @@ class Profile {
|
|
|
536
541
|
this.status = status;
|
|
537
542
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
538
543
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
544
|
+
this.ringSeconds = ringSeconds;
|
|
539
545
|
|
|
540
546
|
this.sipLines = sipLines || [];
|
|
541
547
|
}
|
|
@@ -2214,6 +2220,7 @@ class ApiRequester {
|
|
|
2214
2220
|
/* */
|
|
2215
2221
|
|
|
2216
2222
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2223
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2217
2224
|
const DETAULT_EXPIRATION = 3600;
|
|
2218
2225
|
|
|
2219
2226
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -3292,6 +3299,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3292
3299
|
|
|
3293
3300
|
|
|
3294
3301
|
|
|
3302
|
+
|
|
3295
3303
|
|
|
3296
3304
|
|
|
3297
3305
|
class CallSession {
|
|
@@ -3354,6 +3362,8 @@ class CallSession {
|
|
|
3354
3362
|
|
|
3355
3363
|
|
|
3356
3364
|
|
|
3365
|
+
|
|
3366
|
+
|
|
3357
3367
|
|
|
3358
3368
|
|
|
3359
3369
|
|
|
@@ -3385,6 +3395,7 @@ class CallSession {
|
|
|
3385
3395
|
videoRemotelyDowngraded,
|
|
3386
3396
|
sipSession,
|
|
3387
3397
|
answerTime,
|
|
3398
|
+
conference,
|
|
3388
3399
|
} ) {
|
|
3389
3400
|
this.callId = callId;
|
|
3390
3401
|
this.sipCallId = sipCallId;
|
|
@@ -3413,6 +3424,7 @@ class CallSession {
|
|
|
3413
3424
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3414
3425
|
this.sipSession = sipSession;
|
|
3415
3426
|
this.answerTime = answerTime || this.answerTime;
|
|
3427
|
+
this.conference = conference;
|
|
3416
3428
|
|
|
3417
3429
|
// Useful to compare instead of instanceof with minified code
|
|
3418
3430
|
this.type = 'CallSession';
|
|
@@ -3470,6 +3482,10 @@ class CallSession {
|
|
|
3470
3482
|
this.screensharing = false;
|
|
3471
3483
|
}
|
|
3472
3484
|
|
|
3485
|
+
setIsConference(conference ) {
|
|
3486
|
+
this.conference = conference;
|
|
3487
|
+
}
|
|
3488
|
+
|
|
3473
3489
|
isIncoming() {
|
|
3474
3490
|
return !this.isCaller && !this.answered;
|
|
3475
3491
|
}
|
|
@@ -3546,6 +3562,10 @@ class CallSession {
|
|
|
3546
3562
|
return this.sipStatus === sessionState.SessionState.Terminated;
|
|
3547
3563
|
}
|
|
3548
3564
|
|
|
3565
|
+
isConference() {
|
|
3566
|
+
return this.conference;
|
|
3567
|
+
}
|
|
3568
|
+
|
|
3549
3569
|
getElapsedTimeInSeconds() {
|
|
3550
3570
|
if (!this.startTime) {
|
|
3551
3571
|
return 0;
|
|
@@ -3637,6 +3657,7 @@ class CallSession {
|
|
|
3637
3657
|
cameraEnabled: false,
|
|
3638
3658
|
dialedExtension: call.dialedExtension,
|
|
3639
3659
|
call,
|
|
3660
|
+
conference: false, // @FIXME?
|
|
3640
3661
|
});
|
|
3641
3662
|
}
|
|
3642
3663
|
}
|
|
@@ -3732,7 +3753,7 @@ class Recording {
|
|
|
3732
3753
|
|
|
3733
3754
|
|
|
3734
3755
|
|
|
3735
|
-
|
|
3756
|
+
|
|
3736
3757
|
|
|
3737
3758
|
|
|
3738
3759
|
|
|
@@ -5622,7 +5643,7 @@ var getApiClient = (forServer ) => {
|
|
|
5622
5643
|
|
|
5623
5644
|
|
|
5624
5645
|
|
|
5625
|
-
|
|
5646
|
+
|
|
5626
5647
|
|
|
5627
5648
|
|
|
5628
5649
|
|
|
@@ -5642,7 +5663,7 @@ class AdHocAPIConference {
|
|
|
5642
5663
|
|
|
5643
5664
|
|
|
5644
5665
|
|
|
5645
|
-
|
|
5666
|
+
|
|
5646
5667
|
|
|
5647
5668
|
|
|
5648
5669
|
|
|
@@ -5654,7 +5675,7 @@ class AdHocAPIConference {
|
|
|
5654
5675
|
participants,
|
|
5655
5676
|
started,
|
|
5656
5677
|
finished,
|
|
5657
|
-
|
|
5678
|
+
answerTime,
|
|
5658
5679
|
conferenceId,
|
|
5659
5680
|
muted,
|
|
5660
5681
|
paused,
|
|
@@ -5664,16 +5685,20 @@ class AdHocAPIConference {
|
|
|
5664
5685
|
this.participants = participants || {};
|
|
5665
5686
|
this.started = started || false;
|
|
5666
5687
|
this.finished = finished || false;
|
|
5667
|
-
this.
|
|
5688
|
+
this.answerTime = answerTime;
|
|
5668
5689
|
this.conferenceId = conferenceId || '';
|
|
5669
5690
|
this.muted = muted || false;
|
|
5670
5691
|
this.paused = paused || false;
|
|
5692
|
+
|
|
5693
|
+
if (this.host) {
|
|
5694
|
+
this.host.setIsConference(true);
|
|
5695
|
+
}
|
|
5671
5696
|
}
|
|
5672
5697
|
|
|
5673
5698
|
async start() {
|
|
5674
5699
|
this.started = true;
|
|
5675
5700
|
// $FlowFixMe
|
|
5676
|
-
this.
|
|
5701
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5677
5702
|
|
|
5678
5703
|
const participantIds = Object.keys(this.participants);
|
|
5679
5704
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -9377,7 +9402,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9377
9402
|
accept(callSession , cameraEnabled ) {
|
|
9378
9403
|
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9379
9404
|
if (this.currentSipSession) {
|
|
9380
|
-
this.holdSipSession(
|
|
9405
|
+
this.holdSipSession(
|
|
9406
|
+
this.currentSipSession,
|
|
9407
|
+
this.currentCallSession,
|
|
9408
|
+
true,
|
|
9409
|
+
);
|
|
9381
9410
|
}
|
|
9382
9411
|
|
|
9383
9412
|
if (!callSession) {
|
|
@@ -9470,22 +9499,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9470
9499
|
}
|
|
9471
9500
|
}
|
|
9472
9501
|
|
|
9473
|
-
hold(callSession , withEvent = true
|
|
9502
|
+
hold(callSession , withEvent = true) {
|
|
9474
9503
|
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9475
9504
|
|
|
9476
9505
|
const sipSession = this.findSipSession(callSession);
|
|
9477
9506
|
|
|
9478
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
9507
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
9479
9508
|
}
|
|
9480
9509
|
|
|
9481
9510
|
// @Deprecated
|
|
9482
|
-
unhold(callSession , withEvent = true
|
|
9511
|
+
unhold(callSession , withEvent = true) {
|
|
9483
9512
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
9484
9513
|
|
|
9485
|
-
return this.resume(callSession,
|
|
9514
|
+
return this.resume(callSession, withEvent);
|
|
9486
9515
|
}
|
|
9487
9516
|
|
|
9488
|
-
resume(callSession ,
|
|
9517
|
+
resume(callSession , withEvent = true) {
|
|
9489
9518
|
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9490
9519
|
|
|
9491
9520
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -9498,10 +9527,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9498
9527
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9499
9528
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9500
9529
|
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9501
|
-
this.holdSipSession(
|
|
9530
|
+
this.holdSipSession(
|
|
9531
|
+
this.currentSipSession,
|
|
9532
|
+
this.currentCallSession,
|
|
9533
|
+
withEvent,
|
|
9534
|
+
);
|
|
9502
9535
|
}
|
|
9503
9536
|
|
|
9504
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
9537
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
9505
9538
|
this.currentSipSession = sipSession;
|
|
9506
9539
|
if (callSession) {
|
|
9507
9540
|
this.currentCallSession = callSession;
|
|
@@ -9514,7 +9547,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9514
9547
|
sipSession ,
|
|
9515
9548
|
callSession ,
|
|
9516
9549
|
withEvent = true,
|
|
9517
|
-
isConference = false,
|
|
9518
9550
|
) {
|
|
9519
9551
|
if (!sipSession) {
|
|
9520
9552
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -9535,6 +9567,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9535
9567
|
await this.client.downgradeToAudio(sipSession);
|
|
9536
9568
|
}
|
|
9537
9569
|
|
|
9570
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9571
|
+
|
|
9538
9572
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
9539
9573
|
if (withEvent) {
|
|
9540
9574
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -9547,11 +9581,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9547
9581
|
sipSession ,
|
|
9548
9582
|
callSession ,
|
|
9549
9583
|
withEvent = true,
|
|
9550
|
-
isConference = false,
|
|
9551
9584
|
) {
|
|
9552
9585
|
if (!sipSession) {
|
|
9553
9586
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9554
9587
|
}
|
|
9588
|
+
|
|
9589
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9590
|
+
|
|
9555
9591
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9556
9592
|
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9557
9593
|
|
|
@@ -9693,7 +9729,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9693
9729
|
await this.client.register();
|
|
9694
9730
|
}
|
|
9695
9731
|
if (this.currentSipSession) {
|
|
9696
|
-
this.holdSipSession(
|
|
9732
|
+
this.holdSipSession(
|
|
9733
|
+
this.currentSipSession,
|
|
9734
|
+
this.currentCallSession,
|
|
9735
|
+
true,
|
|
9736
|
+
).catch(e => {
|
|
9697
9737
|
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9698
9738
|
});
|
|
9699
9739
|
}
|
|
@@ -9708,6 +9748,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9708
9748
|
return Promise.resolve(null);
|
|
9709
9749
|
}
|
|
9710
9750
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9751
|
+
callSession.setIsConference(conference);
|
|
9711
9752
|
callSession.creationTime = new Date();
|
|
9712
9753
|
this._updateCallSession(callSession);
|
|
9713
9754
|
|
|
@@ -10286,6 +10327,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10286
10327
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10287
10328
|
recordingPaused: false, // @TODO
|
|
10288
10329
|
sipSession,
|
|
10330
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
10289
10331
|
...extra,
|
|
10290
10332
|
});
|
|
10291
10333
|
|
|
@@ -10542,16 +10584,16 @@ class Phone extends Emitter {
|
|
|
10542
10584
|
}
|
|
10543
10585
|
}
|
|
10544
10586
|
|
|
10545
|
-
hold(callSession
|
|
10546
|
-
return this.phone && this.phone.hold(callSession, true
|
|
10587
|
+
hold(callSession ) {
|
|
10588
|
+
return this.phone && this.phone.hold(callSession, true);
|
|
10547
10589
|
}
|
|
10548
10590
|
|
|
10549
|
-
unhold(callSession
|
|
10550
|
-
return this.phone && this.phone.unhold(callSession, true
|
|
10591
|
+
unhold(callSession ) {
|
|
10592
|
+
return this.phone && this.phone.unhold(callSession, true);
|
|
10551
10593
|
}
|
|
10552
10594
|
|
|
10553
|
-
resume(callSession
|
|
10554
|
-
return this.phone && this.phone.resume(callSession
|
|
10595
|
+
resume(callSession ) {
|
|
10596
|
+
return this.phone && this.phone.resume(callSession);
|
|
10555
10597
|
}
|
|
10556
10598
|
|
|
10557
10599
|
reject(callSession ) {
|
|
@@ -12950,7 +12992,7 @@ class Room {
|
|
|
12950
12992
|
|
|
12951
12993
|
|
|
12952
12994
|
|
|
12953
|
-
|
|
12995
|
+
|
|
12954
12996
|
|
|
12955
12997
|
|
|
12956
12998
|
|
|
@@ -12976,7 +13018,7 @@ class SwitchboardCall {
|
|
|
12976
13018
|
|
|
12977
13019
|
|
|
12978
13020
|
|
|
12979
|
-
|
|
13021
|
+
|
|
12980
13022
|
|
|
12981
13023
|
|
|
12982
13024
|
|
|
@@ -12990,7 +13032,7 @@ class SwitchboardCall {
|
|
|
12990
13032
|
callerIdName: plain.caller_id_name || null,
|
|
12991
13033
|
callerIdNumber: plain.caller_id_number || null,
|
|
12992
13034
|
participantId: plain.participantId || null,
|
|
12993
|
-
|
|
13035
|
+
answerTime: plain.startTime,
|
|
12994
13036
|
state: plain.state,
|
|
12995
13037
|
switchboardName: plain.switchboardName,
|
|
12996
13038
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -13003,7 +13045,7 @@ class SwitchboardCall {
|
|
|
13003
13045
|
callerIdName,
|
|
13004
13046
|
callerIdNumber,
|
|
13005
13047
|
participantId,
|
|
13006
|
-
|
|
13048
|
+
answerTime,
|
|
13007
13049
|
state,
|
|
13008
13050
|
switchboardName,
|
|
13009
13051
|
switchboardUuid,
|
|
@@ -13013,7 +13055,7 @@ class SwitchboardCall {
|
|
|
13013
13055
|
this.callerIdName = callerIdName;
|
|
13014
13056
|
this.callerIdNumber = callerIdNumber;
|
|
13015
13057
|
this.participantId = participantId;
|
|
13016
|
-
this.
|
|
13058
|
+
this.answerTime = answerTime;
|
|
13017
13059
|
this.state = state;
|
|
13018
13060
|
this.switchboardName = switchboardName;
|
|
13019
13061
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13650,6 +13692,7 @@ const Wazo = {
|
|
|
13650
13692
|
InvalidAuthorization,
|
|
13651
13693
|
CanceledCallError,
|
|
13652
13694
|
SFUNotAvailableError,
|
|
13695
|
+
NoTenantIdError,
|
|
13653
13696
|
};
|
|
13654
13697
|
|
|
13655
13698
|
if (window) {
|
|
@@ -13663,6 +13706,7 @@ if (global) {
|
|
|
13663
13706
|
|
|
13664
13707
|
class InvalidSubscription extends Error {}
|
|
13665
13708
|
class InvalidAuthorization extends Error {}
|
|
13709
|
+
class NoTenantIdError extends Error {}
|
|
13666
13710
|
|
|
13667
13711
|
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
13668
13712
|
|
|
@@ -13676,11 +13720,15 @@ class Auth {
|
|
|
13676
13720
|
|
|
13677
13721
|
|
|
13678
13722
|
|
|
13723
|
+
|
|
13724
|
+
|
|
13679
13725
|
|
|
13680
13726
|
constructor() {
|
|
13681
13727
|
this.expiration = DETAULT_EXPIRATION;
|
|
13682
13728
|
this.authenticated = false;
|
|
13683
13729
|
this.minSubscriptionType = null;
|
|
13730
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
13731
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
13684
13732
|
}
|
|
13685
13733
|
|
|
13686
13734
|
init(clientId ,
|
|
@@ -13713,12 +13761,18 @@ class Auth {
|
|
|
13713
13761
|
setFetchOptions(options);
|
|
13714
13762
|
}
|
|
13715
13763
|
|
|
13716
|
-
async logIn(username , password ) {
|
|
13764
|
+
async logIn(username , password , backend , tenantId ) {
|
|
13765
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
13766
|
+
throw new NoTenantIdError('No tenant id');
|
|
13767
|
+
}
|
|
13768
|
+
|
|
13717
13769
|
this.authenticated = false;
|
|
13718
13770
|
this.session = null;
|
|
13719
13771
|
const rawSession = await getApiClient().auth.logIn({
|
|
13720
13772
|
username,
|
|
13721
13773
|
password,
|
|
13774
|
+
backend,
|
|
13775
|
+
tenantId,
|
|
13722
13776
|
expiration: this.expiration,
|
|
13723
13777
|
mobile: this.mobile,
|
|
13724
13778
|
});
|
|
@@ -13925,4 +13979,5 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
13925
13979
|
|
|
13926
13980
|
exports.InvalidAuthorization = InvalidAuthorization;
|
|
13927
13981
|
exports.InvalidSubscription = InvalidSubscription;
|
|
13982
|
+
exports.NoTenantIdError = NoTenantIdError;
|
|
13928
13983
|
exports.default = Auth$1;
|