@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
@@ -54,7 +54,7 @@ var updateFrom = (instance , from ) => {
54
54
 
55
55
 
56
56
 
57
-
57
+
58
58
 
59
59
 
60
60
 
@@ -80,7 +80,7 @@ class SwitchboardCall {
80
80
 
81
81
 
82
82
 
83
-
83
+
84
84
 
85
85
 
86
86
 
@@ -94,7 +94,7 @@ class SwitchboardCall {
94
94
  callerIdName: plain.caller_id_name || null,
95
95
  callerIdNumber: plain.caller_id_number || null,
96
96
  participantId: plain.participantId || null,
97
- startTime: plain.startTime,
97
+ answerTime: plain.startTime,
98
98
  state: plain.state,
99
99
  switchboardName: plain.switchboardName,
100
100
  switchboardUuid: plain.switchboardUuid,
@@ -107,7 +107,7 @@ class SwitchboardCall {
107
107
  callerIdName,
108
108
  callerIdNumber,
109
109
  participantId,
110
- startTime,
110
+ answerTime,
111
111
  state,
112
112
  switchboardName,
113
113
  switchboardUuid,
@@ -117,7 +117,7 @@ class SwitchboardCall {
117
117
  this.callerIdName = callerIdName;
118
118
  this.callerIdNumber = callerIdNumber;
119
119
  this.participantId = participantId;
120
- this.startTime = startTime;
120
+ this.answerTime = answerTime;
121
121
  this.state = state;
122
122
  this.switchboardName = switchboardName;
123
123
  this.switchboardUuid = switchboardUuid;
package/esm/index.js CHANGED
@@ -2209,6 +2209,7 @@ class Session {
2209
2209
  /* */
2210
2210
 
2211
2211
  const DEFAULT_BACKEND_USER = 'wazo_user';
2212
+ const BACKEND_LDAP_USER = 'ldap_user';
2212
2213
  const DETAULT_EXPIRATION = 3600;
2213
2214
 
2214
2215
  var authMethods = (client , baseUrl ) => ({
@@ -2258,12 +2259,14 @@ var authMethods = (client , baseUrl ) => ({
2258
2259
  backend ,
2259
2260
  expiration ,
2260
2261
  isMobile = false,
2262
+ tenantId ,
2261
2263
  ) => {
2262
2264
  const body = {
2263
2265
  backend: backend || DEFAULT_BACKEND_USER,
2264
2266
  expiration: expiration || DETAULT_EXPIRATION,
2265
2267
  refresh_token: refreshToken,
2266
2268
  client_id: client.clientId,
2269
+ tenant_id: tenantId,
2267
2270
  };
2268
2271
 
2269
2272
  const headers = {
@@ -5498,6 +5501,7 @@ class ApiClient {
5498
5501
 
5499
5502
 
5500
5503
 
5504
+
5501
5505
 
5502
5506
 
5503
5507
 
@@ -5538,6 +5542,7 @@ class ApiClient {
5538
5542
  logger$a.info('refresh token callback called', {
5539
5543
  refreshToken: this.refreshToken,
5540
5544
  refreshBackend: this.refreshBackend,
5545
+ refreshTenantId: this.refreshTenantId,
5541
5546
  refreshExpiration: this.refreshExpiration,
5542
5547
  isMobile: this.isMobile,
5543
5548
  });
@@ -5551,6 +5556,7 @@ class ApiClient {
5551
5556
  this.refreshBackend,
5552
5557
  this.refreshExpiration,
5553
5558
  this.isMobile,
5559
+ this.refreshTenantId,
5554
5560
  );
5555
5561
 
5556
5562
  logger$a.info('token refreshed', { token: session.token });
@@ -5592,6 +5598,10 @@ class ApiClient {
5592
5598
  this.refreshBackend = refreshBackend;
5593
5599
  }
5594
5600
 
5601
+ setRefreshTenantId(tenantId ) {
5602
+ this.refreshTenantId = tenantId;
5603
+ }
5604
+
5595
5605
  setIsMobile(isMobile ) {
5596
5606
  this.isMobile = isMobile;
5597
5607
  }
@@ -9201,7 +9211,7 @@ class Room$1 {
9201
9211
 
9202
9212
 
9203
9213
 
9204
-
9214
+
9205
9215
 
9206
9216
 
9207
9217
 
@@ -9227,7 +9237,7 @@ class SwitchboardCall {
9227
9237
 
9228
9238
 
9229
9239
 
9230
-
9240
+
9231
9241
 
9232
9242
 
9233
9243
 
@@ -9241,7 +9251,7 @@ class SwitchboardCall {
9241
9251
  callerIdName: plain.caller_id_name || null,
9242
9252
  callerIdNumber: plain.caller_id_number || null,
9243
9253
  participantId: plain.participantId || null,
9244
- startTime: plain.startTime,
9254
+ answerTime: plain.startTime,
9245
9255
  state: plain.state,
9246
9256
  switchboardName: plain.switchboardName,
9247
9257
  switchboardUuid: plain.switchboardUuid,
@@ -9254,7 +9264,7 @@ class SwitchboardCall {
9254
9264
  callerIdName,
9255
9265
  callerIdNumber,
9256
9266
  participantId,
9257
- startTime,
9267
+ answerTime,
9258
9268
  state,
9259
9269
  switchboardName,
9260
9270
  switchboardUuid,
@@ -9264,7 +9274,7 @@ class SwitchboardCall {
9264
9274
  this.callerIdName = callerIdName;
9265
9275
  this.callerIdNumber = callerIdNumber;
9266
9276
  this.participantId = participantId;
9267
- this.startTime = startTime;
9277
+ this.answerTime = answerTime;
9268
9278
  this.state = state;
9269
9279
  this.switchboardName = switchboardName;
9270
9280
  this.switchboardUuid = switchboardUuid;
@@ -11696,6 +11706,7 @@ const getCallableNumber = (number , country ) => {
11696
11706
 
11697
11707
  class InvalidSubscription extends Error {}
11698
11708
  class InvalidAuthorization extends Error {}
11709
+ class NoTenantIdError extends Error {}
11699
11710
 
11700
11711
  const logger$5 = IssueReporter$1.loggerFor('simple-auth');
11701
11712
 
@@ -11709,11 +11720,15 @@ class Auth {
11709
11720
 
11710
11721
 
11711
11722
 
11723
+
11724
+
11712
11725
 
11713
11726
  constructor() {
11714
11727
  this.expiration = DETAULT_EXPIRATION;
11715
11728
  this.authenticated = false;
11716
11729
  this.minSubscriptionType = null;
11730
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
11731
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
11717
11732
  }
11718
11733
 
11719
11734
  init(clientId ,
@@ -11746,15 +11761,28 @@ class Auth {
11746
11761
  setFetchOptions(options);
11747
11762
  }
11748
11763
 
11749
- async logIn(username , password ) {
11764
+ async logIn(username , password , backend , tenantId ) {
11765
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
11766
+ throw new NoTenantIdError('No tenant id');
11767
+ }
11768
+
11750
11769
  this.authenticated = false;
11751
11770
  this.session = null;
11752
11771
  const rawSession = await getApiClient().auth.logIn({
11753
11772
  username,
11754
11773
  password,
11774
+ backend,
11775
+ tenantId,
11755
11776
  expiration: this.expiration,
11756
11777
  mobile: this.mobile,
11757
11778
  });
11779
+
11780
+ if (backend) {
11781
+ getApiClient().setRefreshBackend(backend);
11782
+ }
11783
+
11784
+ getApiClient().setRefreshTenantId(tenantId);
11785
+
11758
11786
  return this._onAuthenticated(rawSession);
11759
11787
  }
11760
11788
 
@@ -11981,7 +12009,7 @@ var Auth$1 = global.wazoAuthInstance;
11981
12009
 
11982
12010
 
11983
12011
 
11984
-
12012
+
11985
12013
 
11986
12014
 
11987
12015
 
@@ -12001,7 +12029,7 @@ class AdHocAPIConference {
12001
12029
 
12002
12030
 
12003
12031
 
12004
-
12032
+
12005
12033
 
12006
12034
 
12007
12035
 
@@ -12013,7 +12041,7 @@ class AdHocAPIConference {
12013
12041
  participants,
12014
12042
  started,
12015
12043
  finished,
12016
- startTime,
12044
+ answerTime,
12017
12045
  conferenceId,
12018
12046
  muted,
12019
12047
  paused,
@@ -12023,7 +12051,7 @@ class AdHocAPIConference {
12023
12051
  this.participants = participants || {};
12024
12052
  this.started = started || false;
12025
12053
  this.finished = finished || false;
12026
- this.startTime = startTime;
12054
+ this.answerTime = answerTime;
12027
12055
  this.conferenceId = conferenceId || '';
12028
12056
  this.muted = muted || false;
12029
12057
  this.paused = paused || false;
@@ -12036,7 +12064,7 @@ class AdHocAPIConference {
12036
12064
  async start() {
12037
12065
  this.started = true;
12038
12066
  // $FlowFixMe
12039
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
12067
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
12040
12068
 
12041
12069
  const participantIds = Object.keys(this.participants);
12042
12070
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -14081,6 +14109,7 @@ const Wazo = {
14081
14109
  InvalidAuthorization,
14082
14110
  CanceledCallError,
14083
14111
  SFUNotAvailableError,
14112
+ NoTenantIdError,
14084
14113
  };
14085
14114
 
14086
14115
  if (window) {
@@ -2778,12 +2778,14 @@ var authMethods = (client , baseUrl ) => ({
2778
2778
  backend ,
2779
2779
  expiration ,
2780
2780
  isMobile = false,
2781
+ tenantId ,
2781
2782
  ) => {
2782
2783
  const body = {
2783
2784
  backend: backend || DEFAULT_BACKEND_USER,
2784
2785
  expiration: expiration || DETAULT_EXPIRATION,
2785
2786
  refresh_token: refreshToken,
2786
2787
  client_id: client.clientId,
2788
+ tenant_id: tenantId,
2787
2789
  };
2788
2790
 
2789
2791
  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
  }
@@ -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
  }
@@ -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);
@@ -12979,7 +12989,7 @@ class Room {
12979
12989
 
12980
12990
 
12981
12991
 
12982
-
12992
+
12983
12993
 
12984
12994
 
12985
12995
 
@@ -13005,7 +13015,7 @@ class SwitchboardCall {
13005
13015
 
13006
13016
 
13007
13017
 
13008
-
13018
+
13009
13019
 
13010
13020
 
13011
13021
 
@@ -13019,7 +13029,7 @@ class SwitchboardCall {
13019
13029
  callerIdName: plain.caller_id_name || null,
13020
13030
  callerIdNumber: plain.caller_id_number || null,
13021
13031
  participantId: plain.participantId || null,
13022
- startTime: plain.startTime,
13032
+ answerTime: plain.startTime,
13023
13033
  state: plain.state,
13024
13034
  switchboardName: plain.switchboardName,
13025
13035
  switchboardUuid: plain.switchboardUuid,
@@ -13032,7 +13042,7 @@ class SwitchboardCall {
13032
13042
  callerIdName,
13033
13043
  callerIdNumber,
13034
13044
  participantId,
13035
- startTime,
13045
+ answerTime,
13036
13046
  state,
13037
13047
  switchboardName,
13038
13048
  switchboardUuid,
@@ -13042,7 +13052,7 @@ class SwitchboardCall {
13042
13052
  this.callerIdName = callerIdName;
13043
13053
  this.callerIdNumber = callerIdNumber;
13044
13054
  this.participantId = participantId;
13045
- this.startTime = startTime;
13055
+ this.answerTime = answerTime;
13046
13056
  this.state = state;
13047
13057
  this.switchboardName = switchboardName;
13048
13058
  this.switchboardUuid = switchboardUuid;
@@ -13679,6 +13689,7 @@ const Wazo = {
13679
13689
  InvalidAuthorization,
13680
13690
  CanceledCallError,
13681
13691
  SFUNotAvailableError,
13692
+ NoTenantIdError,
13682
13693
  };
13683
13694
 
13684
13695
  if (window) {
@@ -13692,6 +13703,7 @@ if (global) {
13692
13703
 
13693
13704
  class InvalidSubscription extends Error {}
13694
13705
  class InvalidAuthorization extends Error {}
13706
+ class NoTenantIdError extends Error {}
13695
13707
 
13696
13708
  const logger = IssueReporter$1.loggerFor('simple-auth');
13697
13709
 
@@ -13705,11 +13717,15 @@ class Auth {
13705
13717
 
13706
13718
 
13707
13719
 
13720
+
13721
+
13708
13722
 
13709
13723
  constructor() {
13710
13724
  this.expiration = DETAULT_EXPIRATION;
13711
13725
  this.authenticated = false;
13712
13726
  this.minSubscriptionType = null;
13727
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
13728
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
13713
13729
  }
13714
13730
 
13715
13731
  init(clientId ,
@@ -13742,15 +13758,28 @@ class Auth {
13742
13758
  setFetchOptions(options);
13743
13759
  }
13744
13760
 
13745
- async logIn(username , password ) {
13761
+ async logIn(username , password , backend , tenantId ) {
13762
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
13763
+ throw new NoTenantIdError('No tenant id');
13764
+ }
13765
+
13746
13766
  this.authenticated = false;
13747
13767
  this.session = null;
13748
13768
  const rawSession = await getApiClient().auth.logIn({
13749
13769
  username,
13750
13770
  password,
13771
+ backend,
13772
+ tenantId,
13751
13773
  expiration: this.expiration,
13752
13774
  mobile: this.mobile,
13753
13775
  });
13776
+
13777
+ if (backend) {
13778
+ getApiClient().setRefreshBackend(backend);
13779
+ }
13780
+
13781
+ getApiClient().setRefreshTenantId(tenantId);
13782
+
13754
13783
  return this._onAuthenticated(rawSession);
13755
13784
  }
13756
13785
 
@@ -13953,4 +13982,4 @@ if (!global.wazoAuthInstance) {
13953
13982
  var Auth$1 = global.wazoAuthInstance;
13954
13983
 
13955
13984
  export default Auth$1;
13956
- export { InvalidAuthorization, InvalidSubscription };
13985
+ export { InvalidAuthorization, InvalidSubscription, NoTenantIdError };