@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.
Files changed (71) hide show
  1. package/README.md +7 -2
  2. package/dist/wazo-sdk.js +2 -2
  3. package/esm/__tests__/api-client.test.js +9 -0
  4. package/esm/__tests__/web-rtc-client.test.js +9 -0
  5. package/esm/api/auth.js +4 -1
  6. package/esm/api-client.js +9 -0
  7. package/esm/checker/Checker.js +9 -0
  8. package/esm/checker/checks/aor.js +9 -0
  9. package/esm/checker/checks/api.js +9 -0
  10. package/esm/checker/checks/index.js +9 -0
  11. package/esm/checker/checks/webrtc-transport.js +9 -0
  12. package/esm/checker/checks/webrtc.js +9 -0
  13. package/esm/domain/AdHocAPIConference.js +14 -5
  14. package/esm/domain/Features.js +9 -0
  15. package/esm/domain/Phone/CTIPhone.js +9 -0
  16. package/esm/domain/SwitchboardCall.js +5 -5
  17. package/esm/index.js +40 -11
  18. package/esm/service/CallApi.js +9 -0
  19. package/esm/service/getApiClient.js +9 -0
  20. package/esm/simple/Auth.js +41 -12
  21. package/esm/simple/Configuration.js +40 -11
  22. package/esm/simple/Directory.js +9 -0
  23. package/esm/simple/Phone.js +40 -11
  24. package/esm/simple/index.js +40 -11
  25. package/esm/simple/room/LocalParticipant.js +40 -11
  26. package/esm/simple/room/Participant.js +40 -11
  27. package/esm/simple/room/RemoteParticipant.js +40 -11
  28. package/esm/simple/room/Room.js +40 -11
  29. package/esm/simple/room/SipRoom.js +40 -11
  30. package/esm/simple/room/Stream.js +40 -11
  31. package/esm/simple/room/__tests__/RemoteParticipant.test.js +40 -11
  32. package/esm/simple/utils.js +40 -11
  33. package/esm/web-rtc-client.js +9 -0
  34. package/lib/__tests__/api-client.test.js +9 -0
  35. package/lib/__tests__/web-rtc-client.test.js +9 -0
  36. package/lib/api/auth.js +5 -0
  37. package/lib/api-client.js +9 -0
  38. package/lib/checker/Checker.js +9 -0
  39. package/lib/checker/checks/aor.js +9 -0
  40. package/lib/checker/checks/api.js +9 -0
  41. package/lib/checker/checks/index.js +9 -0
  42. package/lib/checker/checks/webrtc-transport.js +9 -0
  43. package/lib/checker/checks/webrtc.js +9 -0
  44. package/lib/domain/AdHocAPIConference.js +14 -5
  45. package/lib/domain/Features.js +9 -0
  46. package/lib/domain/Phone/CTIPhone.js +9 -0
  47. package/lib/domain/SwitchboardCall.js +5 -5
  48. package/lib/index.js +40 -11
  49. package/lib/service/CallApi.js +9 -0
  50. package/lib/service/getApiClient.js +9 -0
  51. package/lib/simple/Auth.js +41 -11
  52. package/lib/simple/Configuration.js +40 -11
  53. package/lib/simple/Directory.js +9 -0
  54. package/lib/simple/Phone.js +40 -11
  55. package/lib/simple/index.js +40 -11
  56. package/lib/simple/room/LocalParticipant.js +40 -11
  57. package/lib/simple/room/Participant.js +40 -11
  58. package/lib/simple/room/RemoteParticipant.js +40 -11
  59. package/lib/simple/room/Room.js +40 -11
  60. package/lib/simple/room/SipRoom.js +40 -11
  61. package/lib/simple/room/Stream.js +40 -11
  62. package/lib/simple/room/__tests__/RemoteParticipant.test.js +40 -11
  63. package/lib/simple/utils.js +40 -11
  64. package/lib/web-rtc-client.js +9 -0
  65. package/package.json +1 -1
  66. package/src/api/auth.js +4 -1
  67. package/src/api-client.js +7 -0
  68. package/src/domain/AdHocAPIConference.js +5 -5
  69. package/src/domain/SwitchboardCall.js +5 -5
  70. package/src/simple/Auth.js +20 -2
  71. package/src/simple/index.js +2 -1
@@ -2208,6 +2208,7 @@ class ApiRequester {
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
  }
@@ -5630,7 +5640,7 @@ var getApiClient = (forServer ) => {
5630
5640
 
5631
5641
 
5632
5642
 
5633
-
5643
+
5634
5644
 
5635
5645
 
5636
5646
 
@@ -5650,7 +5660,7 @@ class AdHocAPIConference {
5650
5660
 
5651
5661
 
5652
5662
 
5653
-
5663
+
5654
5664
 
5655
5665
 
5656
5666
 
@@ -5662,7 +5672,7 @@ class AdHocAPIConference {
5662
5672
  participants,
5663
5673
  started,
5664
5674
  finished,
5665
- startTime,
5675
+ answerTime,
5666
5676
  conferenceId,
5667
5677
  muted,
5668
5678
  paused,
@@ -5672,7 +5682,7 @@ class AdHocAPIConference {
5672
5682
  this.participants = participants || {};
5673
5683
  this.started = started || false;
5674
5684
  this.finished = finished || false;
5675
- this.startTime = startTime;
5685
+ this.answerTime = answerTime;
5676
5686
  this.conferenceId = conferenceId || '';
5677
5687
  this.muted = muted || false;
5678
5688
  this.paused = paused || false;
@@ -5685,7 +5695,7 @@ class AdHocAPIConference {
5685
5695
  async start() {
5686
5696
  this.started = true;
5687
5697
  // $FlowFixMe
5688
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5698
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5689
5699
 
5690
5700
  const participantIds = Object.keys(this.participants);
5691
5701
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -12962,7 +12972,7 @@ class Room {
12962
12972
 
12963
12973
 
12964
12974
 
12965
-
12975
+
12966
12976
 
12967
12977
 
12968
12978
 
@@ -12988,7 +12998,7 @@ class SwitchboardCall {
12988
12998
 
12989
12999
 
12990
13000
 
12991
-
13001
+
12992
13002
 
12993
13003
 
12994
13004
 
@@ -13002,7 +13012,7 @@ class SwitchboardCall {
13002
13012
  callerIdName: plain.caller_id_name || null,
13003
13013
  callerIdNumber: plain.caller_id_number || null,
13004
13014
  participantId: plain.participantId || null,
13005
- startTime: plain.startTime,
13015
+ answerTime: plain.startTime,
13006
13016
  state: plain.state,
13007
13017
  switchboardName: plain.switchboardName,
13008
13018
  switchboardUuid: plain.switchboardUuid,
@@ -13015,7 +13025,7 @@ class SwitchboardCall {
13015
13025
  callerIdName,
13016
13026
  callerIdNumber,
13017
13027
  participantId,
13018
- startTime,
13028
+ answerTime,
13019
13029
  state,
13020
13030
  switchboardName,
13021
13031
  switchboardUuid,
@@ -13025,7 +13035,7 @@ class SwitchboardCall {
13025
13035
  this.callerIdName = callerIdName;
13026
13036
  this.callerIdNumber = callerIdNumber;
13027
13037
  this.participantId = participantId;
13028
- this.startTime = startTime;
13038
+ this.answerTime = answerTime;
13029
13039
  this.state = state;
13030
13040
  this.switchboardName = switchboardName;
13031
13041
  this.switchboardUuid = switchboardUuid;
@@ -13662,6 +13672,7 @@ const Wazo = {
13662
13672
  InvalidAuthorization,
13663
13673
  CanceledCallError,
13664
13674
  SFUNotAvailableError,
13675
+ NoTenantIdError,
13665
13676
  };
13666
13677
 
13667
13678
  if (window) {
@@ -13675,6 +13686,7 @@ if (global) {
13675
13686
 
13676
13687
  class InvalidSubscription extends Error {}
13677
13688
  class InvalidAuthorization extends Error {}
13689
+ class NoTenantIdError extends Error {}
13678
13690
 
13679
13691
  const logger = IssueReporter$1.loggerFor('simple-auth');
13680
13692
 
@@ -13688,11 +13700,15 @@ class Auth {
13688
13700
 
13689
13701
 
13690
13702
 
13703
+
13704
+
13691
13705
 
13692
13706
  constructor() {
13693
13707
  this.expiration = DETAULT_EXPIRATION;
13694
13708
  this.authenticated = false;
13695
13709
  this.minSubscriptionType = null;
13710
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
13711
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
13696
13712
  }
13697
13713
 
13698
13714
  init(clientId ,
@@ -13725,15 +13741,28 @@ class Auth {
13725
13741
  setFetchOptions(options);
13726
13742
  }
13727
13743
 
13728
- async logIn(username , password ) {
13744
+ async logIn(username , password , backend , tenantId ) {
13745
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
13746
+ throw new NoTenantIdError('No tenant id');
13747
+ }
13748
+
13729
13749
  this.authenticated = false;
13730
13750
  this.session = null;
13731
13751
  const rawSession = await getApiClient().auth.logIn({
13732
13752
  username,
13733
13753
  password,
13754
+ backend,
13755
+ tenantId,
13734
13756
  expiration: this.expiration,
13735
13757
  mobile: this.mobile,
13736
13758
  });
13759
+
13760
+ if (backend) {
13761
+ getApiClient().setRefreshBackend(backend);
13762
+ }
13763
+
13764
+ getApiClient().setRefreshTenantId(tenantId);
13765
+
13737
13766
  return this._onAuthenticated(rawSession);
13738
13767
  }
13739
13768
 
@@ -2238,12 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
2238
2238
  backend ,
2239
2239
  expiration ,
2240
2240
  isMobile = false,
2241
+ tenantId ,
2241
2242
  ) => {
2242
2243
  const body = {
2243
2244
  backend: backend || DEFAULT_BACKEND_USER,
2244
2245
  expiration: expiration || DETAULT_EXPIRATION,
2245
2246
  refresh_token: refreshToken,
2246
2247
  client_id: client.clientId,
2248
+ tenant_id: tenantId,
2247
2249
  };
2248
2250
 
2249
2251
  const headers = {
@@ -4566,6 +4568,7 @@ class ApiClient {
4566
4568
 
4567
4569
 
4568
4570
 
4571
+
4569
4572
 
4570
4573
 
4571
4574
 
@@ -4606,6 +4609,7 @@ class ApiClient {
4606
4609
  logger.info('refresh token callback called', {
4607
4610
  refreshToken: this.refreshToken,
4608
4611
  refreshBackend: this.refreshBackend,
4612
+ refreshTenantId: this.refreshTenantId,
4609
4613
  refreshExpiration: this.refreshExpiration,
4610
4614
  isMobile: this.isMobile,
4611
4615
  });
@@ -4619,6 +4623,7 @@ class ApiClient {
4619
4623
  this.refreshBackend,
4620
4624
  this.refreshExpiration,
4621
4625
  this.isMobile,
4626
+ this.refreshTenantId,
4622
4627
  );
4623
4628
 
4624
4629
  logger.info('token refreshed', { token: session.token });
@@ -4660,6 +4665,10 @@ class ApiClient {
4660
4665
  this.refreshBackend = refreshBackend;
4661
4666
  }
4662
4667
 
4668
+ setRefreshTenantId(tenantId ) {
4669
+ this.refreshTenantId = tenantId;
4670
+ }
4671
+
4663
4672
  setIsMobile(isMobile ) {
4664
4673
  this.isMobile = isMobile;
4665
4674
  }
@@ -2811,6 +2811,7 @@ class Session {
2811
2811
  /* */
2812
2812
 
2813
2813
  const DEFAULT_BACKEND_USER = 'wazo_user';
2814
+ const BACKEND_LDAP_USER = 'ldap_user';
2814
2815
  const DETAULT_EXPIRATION = 3600;
2815
2816
 
2816
2817
  var authMethods = (client , baseUrl ) => ({
@@ -2860,12 +2861,14 @@ var authMethods = (client , baseUrl ) => ({
2860
2861
  backend ,
2861
2862
  expiration ,
2862
2863
  isMobile = false,
2864
+ tenantId ,
2863
2865
  ) => {
2864
2866
  const body = {
2865
2867
  backend: backend || DEFAULT_BACKEND_USER,
2866
2868
  expiration: expiration || DETAULT_EXPIRATION,
2867
2869
  refresh_token: refreshToken,
2868
2870
  client_id: client.clientId,
2871
+ tenant_id: tenantId,
2869
2872
  };
2870
2873
 
2871
2874
  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
  }
@@ -5630,7 +5640,7 @@ var getApiClient = (forServer ) => {
5630
5640
 
5631
5641
 
5632
5642
 
5633
-
5643
+
5634
5644
 
5635
5645
 
5636
5646
 
@@ -5650,7 +5660,7 @@ class AdHocAPIConference {
5650
5660
 
5651
5661
 
5652
5662
 
5653
-
5663
+
5654
5664
 
5655
5665
 
5656
5666
 
@@ -5662,7 +5672,7 @@ class AdHocAPIConference {
5662
5672
  participants,
5663
5673
  started,
5664
5674
  finished,
5665
- startTime,
5675
+ answerTime,
5666
5676
  conferenceId,
5667
5677
  muted,
5668
5678
  paused,
@@ -5672,7 +5682,7 @@ class AdHocAPIConference {
5672
5682
  this.participants = participants || {};
5673
5683
  this.started = started || false;
5674
5684
  this.finished = finished || false;
5675
- this.startTime = startTime;
5685
+ this.answerTime = answerTime;
5676
5686
  this.conferenceId = conferenceId || '';
5677
5687
  this.muted = muted || false;
5678
5688
  this.paused = paused || false;
@@ -5685,7 +5695,7 @@ class AdHocAPIConference {
5685
5695
  async start() {
5686
5696
  this.started = true;
5687
5697
  // $FlowFixMe
5688
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5698
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5689
5699
 
5690
5700
  const participantIds = Object.keys(this.participants);
5691
5701
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -10377,6 +10387,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10377
10387
 
10378
10388
  class InvalidSubscription extends Error {}
10379
10389
  class InvalidAuthorization extends Error {}
10390
+ class NoTenantIdError extends Error {}
10380
10391
 
10381
10392
  const logger$7 = IssueReporter$1.loggerFor('simple-auth');
10382
10393
 
@@ -10390,11 +10401,15 @@ class Auth {
10390
10401
 
10391
10402
 
10392
10403
 
10404
+
10405
+
10393
10406
 
10394
10407
  constructor() {
10395
10408
  this.expiration = DETAULT_EXPIRATION;
10396
10409
  this.authenticated = false;
10397
10410
  this.minSubscriptionType = null;
10411
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
10412
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
10398
10413
  }
10399
10414
 
10400
10415
  init(clientId ,
@@ -10427,15 +10442,28 @@ class Auth {
10427
10442
  setFetchOptions(options);
10428
10443
  }
10429
10444
 
10430
- async logIn(username , password ) {
10445
+ async logIn(username , password , backend , tenantId ) {
10446
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
10447
+ throw new NoTenantIdError('No tenant id');
10448
+ }
10449
+
10431
10450
  this.authenticated = false;
10432
10451
  this.session = null;
10433
10452
  const rawSession = await getApiClient().auth.logIn({
10434
10453
  username,
10435
10454
  password,
10455
+ backend,
10456
+ tenantId,
10436
10457
  expiration: this.expiration,
10437
10458
  mobile: this.mobile,
10438
10459
  });
10460
+
10461
+ if (backend) {
10462
+ getApiClient().setRefreshBackend(backend);
10463
+ }
10464
+
10465
+ getApiClient().setRefreshTenantId(tenantId);
10466
+
10439
10467
  return this._onAuthenticated(rawSession);
10440
10468
  }
10441
10469
 
@@ -12833,7 +12861,7 @@ class Room {
12833
12861
 
12834
12862
 
12835
12863
 
12836
-
12864
+
12837
12865
 
12838
12866
 
12839
12867
 
@@ -12859,7 +12887,7 @@ class SwitchboardCall {
12859
12887
 
12860
12888
 
12861
12889
 
12862
-
12890
+
12863
12891
 
12864
12892
 
12865
12893
 
@@ -12873,7 +12901,7 @@ class SwitchboardCall {
12873
12901
  callerIdName: plain.caller_id_name || null,
12874
12902
  callerIdNumber: plain.caller_id_number || null,
12875
12903
  participantId: plain.participantId || null,
12876
- startTime: plain.startTime,
12904
+ answerTime: plain.startTime,
12877
12905
  state: plain.state,
12878
12906
  switchboardName: plain.switchboardName,
12879
12907
  switchboardUuid: plain.switchboardUuid,
@@ -12886,7 +12914,7 @@ class SwitchboardCall {
12886
12914
  callerIdName,
12887
12915
  callerIdNumber,
12888
12916
  participantId,
12889
- startTime,
12917
+ answerTime,
12890
12918
  state,
12891
12919
  switchboardName,
12892
12920
  switchboardUuid,
@@ -12896,7 +12924,7 @@ class SwitchboardCall {
12896
12924
  this.callerIdName = callerIdName;
12897
12925
  this.callerIdNumber = callerIdNumber;
12898
12926
  this.participantId = participantId;
12899
- this.startTime = startTime;
12927
+ this.answerTime = answerTime;
12900
12928
  this.state = state;
12901
12929
  this.switchboardName = switchboardName;
12902
12930
  this.switchboardUuid = switchboardUuid;
@@ -13533,6 +13561,7 @@ const Wazo = {
13533
13561
  InvalidAuthorization,
13534
13562
  CanceledCallError,
13535
13563
  SFUNotAvailableError,
13564
+ NoTenantIdError,
13536
13565
  };
13537
13566
 
13538
13567
  if (window) {
@@ -2208,6 +2208,7 @@ class ApiRequester {
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
- startTime,
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.startTime = startTime;
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.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
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);
@@ -13243,7 +13271,7 @@ class Room {
13243
13271
 
13244
13272
 
13245
13273
 
13246
-
13274
+
13247
13275
 
13248
13276
 
13249
13277
 
@@ -13269,7 +13297,7 @@ class SwitchboardCall {
13269
13297
 
13270
13298
 
13271
13299
 
13272
-
13300
+
13273
13301
 
13274
13302
 
13275
13303
 
@@ -13283,7 +13311,7 @@ class SwitchboardCall {
13283
13311
  callerIdName: plain.caller_id_name || null,
13284
13312
  callerIdNumber: plain.caller_id_number || null,
13285
13313
  participantId: plain.participantId || null,
13286
- startTime: plain.startTime,
13314
+ answerTime: plain.startTime,
13287
13315
  state: plain.state,
13288
13316
  switchboardName: plain.switchboardName,
13289
13317
  switchboardUuid: plain.switchboardUuid,
@@ -13296,7 +13324,7 @@ class SwitchboardCall {
13296
13324
  callerIdName,
13297
13325
  callerIdNumber,
13298
13326
  participantId,
13299
- startTime,
13327
+ answerTime,
13300
13328
  state,
13301
13329
  switchboardName,
13302
13330
  switchboardUuid,
@@ -13306,7 +13334,7 @@ class SwitchboardCall {
13306
13334
  this.callerIdName = callerIdName;
13307
13335
  this.callerIdNumber = callerIdNumber;
13308
13336
  this.participantId = participantId;
13309
- this.startTime = startTime;
13337
+ this.answerTime = answerTime;
13310
13338
  this.state = state;
13311
13339
  this.switchboardName = switchboardName;
13312
13340
  this.switchboardUuid = switchboardUuid;
@@ -13943,6 +13971,7 @@ const Wazo = {
13943
13971
  InvalidAuthorization,
13944
13972
  CanceledCallError,
13945
13973
  SFUNotAvailableError,
13974
+ NoTenantIdError,
13946
13975
  };
13947
13976
 
13948
13977
  if (window) {