@wazo/sdk 0.38.9 → 0.38.12
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/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +21 -0
- package/esm/__tests__/web-rtc-client.test.js +32 -7
- package/esm/api/auth.js +12 -0
- package/esm/api/ctid-ng.js +1 -0
- package/esm/api-client.js +21 -0
- package/esm/checker/Checker.js +32 -7
- package/esm/checker/checks/aor.js +21 -0
- package/esm/checker/checks/api.js +21 -0
- package/esm/checker/checks/index.js +32 -7
- package/esm/checker/checks/webrtc-transport.js +32 -7
- package/esm/checker/checks/webrtc.js +32 -7
- package/esm/domain/AdHocAPIConference.js +28 -2
- package/esm/domain/Features.js +28 -2
- package/esm/domain/Phone/CTIPhone.js +28 -2
- package/esm/domain/Phone/WebRTCPhone.js +3 -2
- package/esm/index.js +86 -15
- package/esm/service/CallApi.js +28 -2
- package/esm/service/getApiClient.js +34 -3
- package/esm/simple/Auth.js +87 -16
- package/esm/simple/Configuration.js +86 -15
- package/esm/simple/Directory.js +28 -2
- package/esm/simple/Phone.js +86 -15
- package/esm/simple/Softphone.js +5 -0
- package/esm/simple/index.js +86 -15
- package/esm/simple/room/LocalParticipant.js +86 -15
- package/esm/simple/room/Participant.js +86 -15
- package/esm/simple/room/RemoteParticipant.js +86 -15
- package/esm/simple/room/Room.js +86 -15
- package/esm/simple/room/SipRoom.js +86 -15
- package/esm/simple/room/Stream.js +86 -15
- package/esm/simple/room/__tests__/Participant.test.js +86 -15
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +86 -15
- package/esm/simple/utils.js +86 -15
- package/esm/web-rtc-client.js +32 -7
- package/lib/__tests__/api-client.test.js +21 -0
- package/lib/__tests__/web-rtc-client.test.js +32 -7
- package/lib/api/auth.js +12 -0
- package/lib/api/ctid-ng.js +1 -0
- package/lib/api-client.js +21 -0
- package/lib/checker/Checker.js +32 -7
- package/lib/checker/checks/aor.js +21 -0
- package/lib/checker/checks/api.js +21 -0
- package/lib/checker/checks/index.js +32 -7
- package/lib/checker/checks/webrtc-transport.js +32 -7
- package/lib/checker/checks/webrtc.js +32 -7
- package/lib/domain/AdHocAPIConference.js +28 -2
- package/lib/domain/Features.js +28 -2
- package/lib/domain/Phone/CTIPhone.js +28 -2
- package/lib/domain/Phone/WebRTCPhone.js +3 -2
- package/lib/index.js +86 -15
- package/lib/service/CallApi.js +28 -2
- package/lib/service/getApiClient.js +34 -2
- package/lib/simple/Auth.js +87 -15
- package/lib/simple/Configuration.js +86 -15
- package/lib/simple/Directory.js +28 -2
- package/lib/simple/Phone.js +86 -15
- package/lib/simple/Softphone.js +5 -0
- package/lib/simple/index.js +86 -15
- package/lib/simple/room/LocalParticipant.js +86 -15
- package/lib/simple/room/Participant.js +86 -15
- package/lib/simple/room/RemoteParticipant.js +86 -15
- package/lib/simple/room/Room.js +86 -15
- package/lib/simple/room/SipRoom.js +86 -15
- package/lib/simple/room/Stream.js +86 -15
- package/lib/simple/room/__tests__/Participant.test.js +86 -15
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +86 -15
- package/lib/simple/utils.js +86 -15
- package/lib/web-rtc-client.js +32 -7
- package/package.json +2 -2
- package/src/api/auth.js +12 -0
- package/src/api-client.js +8 -0
- package/src/domain/Phone/WebRTCPhone.js +2 -2
- package/src/service/getApiClient.js +13 -2
- package/src/simple/Auth.js +35 -4
- package/src/simple/Softphone.js +5 -0
- package/src/simple/index.js +2 -1
- package/src/web-rtc-client.js +11 -7
package/esm/simple/Directory.js
CHANGED
|
@@ -2209,6 +2209,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2209
2209
|
|
|
2210
2210
|
|
|
2211
2211
|
|
|
2212
|
+
|
|
2212
2213
|
) {
|
|
2213
2214
|
const body = {
|
|
2214
2215
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2229,9 +2230,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2229
2230
|
}
|
|
2230
2231
|
|
|
2231
2232
|
if (params.tenantId) {
|
|
2233
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2232
2234
|
body.tenant_id = params.tenantId;
|
|
2233
2235
|
}
|
|
2234
2236
|
|
|
2237
|
+
if (params.domainName) {
|
|
2238
|
+
body.domain_name = params.domainName;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2235
2241
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2236
2242
|
},
|
|
2237
2243
|
|
|
@@ -2244,6 +2250,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2244
2250
|
expiration ,
|
|
2245
2251
|
isMobile = false,
|
|
2246
2252
|
tenantId ,
|
|
2253
|
+
domainName ,
|
|
2247
2254
|
) => {
|
|
2248
2255
|
const body = {
|
|
2249
2256
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2253,9 +2260,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2253
2260
|
};
|
|
2254
2261
|
|
|
2255
2262
|
if (tenantId) {
|
|
2263
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2256
2264
|
body.tenant_id = tenantId;
|
|
2257
2265
|
}
|
|
2258
2266
|
|
|
2267
|
+
if (domainName) {
|
|
2268
|
+
body.domain_name = domainName;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2259
2271
|
const headers = {
|
|
2260
2272
|
'Content-Type': 'application/json',
|
|
2261
2273
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -4724,6 +4736,7 @@ class ApiClient {
|
|
|
4724
4736
|
|
|
4725
4737
|
|
|
4726
4738
|
|
|
4739
|
+
|
|
4727
4740
|
|
|
4728
4741
|
|
|
4729
4742
|
|
|
@@ -4765,6 +4778,7 @@ class ApiClient {
|
|
|
4765
4778
|
refreshToken: this.refreshToken,
|
|
4766
4779
|
refreshBackend: this.refreshBackend,
|
|
4767
4780
|
refreshTenantId: this.refreshTenantId,
|
|
4781
|
+
refreshDomainName: this.refreshDomainName,
|
|
4768
4782
|
refreshExpiration: this.refreshExpiration,
|
|
4769
4783
|
isMobile: this.isMobile,
|
|
4770
4784
|
});
|
|
@@ -4780,6 +4794,7 @@ class ApiClient {
|
|
|
4780
4794
|
this.refreshExpiration,
|
|
4781
4795
|
this.isMobile,
|
|
4782
4796
|
this.refreshTenantId,
|
|
4797
|
+
this.refreshDomainName,
|
|
4783
4798
|
);
|
|
4784
4799
|
|
|
4785
4800
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4833,9 +4848,14 @@ class ApiClient {
|
|
|
4833
4848
|
}
|
|
4834
4849
|
|
|
4835
4850
|
setRefreshTenantId(tenantId ) {
|
|
4851
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
4836
4852
|
this.refreshTenantId = tenantId;
|
|
4837
4853
|
}
|
|
4838
4854
|
|
|
4855
|
+
setRefreshDomainName(domainName ) {
|
|
4856
|
+
this.refreshDomainName = domainName;
|
|
4857
|
+
}
|
|
4858
|
+
|
|
4839
4859
|
setIsMobile(isMobile ) {
|
|
4840
4860
|
this.isMobile = isMobile;
|
|
4841
4861
|
}
|
|
@@ -4860,6 +4880,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
4860
4880
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
4861
4881
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
4862
4882
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
4883
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
4863
4884
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
4864
4885
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
4865
4886
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -4869,6 +4890,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
|
|
|
4869
4890
|
|
|
4870
4891
|
const fillClient = (apiClient ) => {
|
|
4871
4892
|
const { server, token, clientId } = apiClient.client;
|
|
4893
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
4872
4894
|
|
|
4873
4895
|
// try with null server when dealing with non-related server info
|
|
4874
4896
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -4877,8 +4899,12 @@ const fillClient = (apiClient ) => {
|
|
|
4877
4899
|
|
|
4878
4900
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
4879
4901
|
|
|
4880
|
-
|
|
4881
|
-
|
|
4902
|
+
if (tenantId) {
|
|
4903
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
4904
|
+
}
|
|
4905
|
+
|
|
4906
|
+
apiClient.setRefreshDomainName(
|
|
4907
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
4882
4908
|
);
|
|
4883
4909
|
|
|
4884
4910
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
package/esm/simple/Phone.js
CHANGED
|
@@ -2838,6 +2838,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2838
2838
|
|
|
2839
2839
|
|
|
2840
2840
|
|
|
2841
|
+
|
|
2841
2842
|
) {
|
|
2842
2843
|
const body = {
|
|
2843
2844
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2858,9 +2859,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2858
2859
|
}
|
|
2859
2860
|
|
|
2860
2861
|
if (params.tenantId) {
|
|
2862
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2861
2863
|
body.tenant_id = params.tenantId;
|
|
2862
2864
|
}
|
|
2863
2865
|
|
|
2866
|
+
if (params.domainName) {
|
|
2867
|
+
body.domain_name = params.domainName;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2864
2870
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2865
2871
|
},
|
|
2866
2872
|
|
|
@@ -2873,6 +2879,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2873
2879
|
expiration ,
|
|
2874
2880
|
isMobile = false,
|
|
2875
2881
|
tenantId ,
|
|
2882
|
+
domainName ,
|
|
2876
2883
|
) => {
|
|
2877
2884
|
const body = {
|
|
2878
2885
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2882,9 +2889,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2882
2889
|
};
|
|
2883
2890
|
|
|
2884
2891
|
if (tenantId) {
|
|
2892
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2885
2893
|
body.tenant_id = tenantId;
|
|
2886
2894
|
}
|
|
2887
2895
|
|
|
2896
|
+
if (domainName) {
|
|
2897
|
+
body.domain_name = domainName;
|
|
2898
|
+
}
|
|
2899
|
+
|
|
2888
2900
|
const headers = {
|
|
2889
2901
|
'Content-Type': 'application/json',
|
|
2890
2902
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -5573,6 +5585,7 @@ class ApiClient {
|
|
|
5573
5585
|
|
|
5574
5586
|
|
|
5575
5587
|
|
|
5588
|
+
|
|
5576
5589
|
|
|
5577
5590
|
|
|
5578
5591
|
|
|
@@ -5614,6 +5627,7 @@ class ApiClient {
|
|
|
5614
5627
|
refreshToken: this.refreshToken,
|
|
5615
5628
|
refreshBackend: this.refreshBackend,
|
|
5616
5629
|
refreshTenantId: this.refreshTenantId,
|
|
5630
|
+
refreshDomainName: this.refreshDomainName,
|
|
5617
5631
|
refreshExpiration: this.refreshExpiration,
|
|
5618
5632
|
isMobile: this.isMobile,
|
|
5619
5633
|
});
|
|
@@ -5629,6 +5643,7 @@ class ApiClient {
|
|
|
5629
5643
|
this.refreshExpiration,
|
|
5630
5644
|
this.isMobile,
|
|
5631
5645
|
this.refreshTenantId,
|
|
5646
|
+
this.refreshDomainName,
|
|
5632
5647
|
);
|
|
5633
5648
|
|
|
5634
5649
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5682,9 +5697,14 @@ class ApiClient {
|
|
|
5682
5697
|
}
|
|
5683
5698
|
|
|
5684
5699
|
setRefreshTenantId(tenantId ) {
|
|
5700
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
5685
5701
|
this.refreshTenantId = tenantId;
|
|
5686
5702
|
}
|
|
5687
5703
|
|
|
5704
|
+
setRefreshDomainName(domainName ) {
|
|
5705
|
+
this.refreshDomainName = domainName;
|
|
5706
|
+
}
|
|
5707
|
+
|
|
5688
5708
|
setIsMobile(isMobile ) {
|
|
5689
5709
|
this.isMobile = isMobile;
|
|
5690
5710
|
}
|
|
@@ -5709,6 +5729,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
5709
5729
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
5710
5730
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
5711
5731
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
5732
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
5712
5733
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
5713
5734
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
5714
5735
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -5733,9 +5754,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
5733
5754
|
};
|
|
5734
5755
|
|
|
5735
5756
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
5757
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
5736
5758
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
5737
5759
|
};
|
|
5738
5760
|
|
|
5761
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
5762
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
5763
|
+
};
|
|
5764
|
+
|
|
5739
5765
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
5740
5766
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
5741
5767
|
};
|
|
@@ -5754,6 +5780,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
5754
5780
|
|
|
5755
5781
|
const fillClient = (apiClient ) => {
|
|
5756
5782
|
const { server, token, clientId } = apiClient.client;
|
|
5783
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
5757
5784
|
|
|
5758
5785
|
// try with null server when dealing with non-related server info
|
|
5759
5786
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -5762,8 +5789,12 @@ const fillClient = (apiClient ) => {
|
|
|
5762
5789
|
|
|
5763
5790
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
5764
5791
|
|
|
5765
|
-
|
|
5766
|
-
|
|
5792
|
+
if (tenantId) {
|
|
5793
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
5794
|
+
}
|
|
5795
|
+
|
|
5796
|
+
apiClient.setRefreshDomainName(
|
|
5797
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
5767
5798
|
);
|
|
5768
5799
|
|
|
5769
5800
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -7419,7 +7450,7 @@ class WebRTCClient extends Emitter {
|
|
|
7419
7450
|
|
|
7420
7451
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7421
7452
|
} else {
|
|
7422
|
-
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
7453
|
+
videoSender = pc && pc.getSenders && pc.getSenders().find(sender => sender.track === null);
|
|
7423
7454
|
}
|
|
7424
7455
|
|
|
7425
7456
|
if (!videoSender) {
|
|
@@ -7460,9 +7491,11 @@ class WebRTCClient extends Emitter {
|
|
|
7460
7491
|
const videoTracks = localStream.getVideoTracks();
|
|
7461
7492
|
|
|
7462
7493
|
// Remove video senders
|
|
7463
|
-
pc.getSenders
|
|
7464
|
-
|
|
7465
|
-
|
|
7494
|
+
if (pc.getSenders) {
|
|
7495
|
+
pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
|
|
7496
|
+
videoSender.replaceTrack(null);
|
|
7497
|
+
});
|
|
7498
|
+
}
|
|
7466
7499
|
|
|
7467
7500
|
videoTracks.forEach(videoTrack => {
|
|
7468
7501
|
videoTrack.enabled = false;
|
|
@@ -7695,7 +7728,8 @@ class WebRTCClient extends Emitter {
|
|
|
7695
7728
|
const constraints = { audio: { deviceId: { exact: deviceId } } };
|
|
7696
7729
|
const stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
7697
7730
|
const audioTrack = stream.getAudioTracks()[0];
|
|
7698
|
-
const sender = pc && pc.getSenders
|
|
7731
|
+
const sender = pc && pc.getSenders
|
|
7732
|
+
&& pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
|
|
7699
7733
|
|
|
7700
7734
|
if (sender) {
|
|
7701
7735
|
if (sender.track) {
|
|
@@ -7758,10 +7792,11 @@ class WebRTCClient extends Emitter {
|
|
|
7758
7792
|
// $FlowFixMe
|
|
7759
7793
|
return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
|
|
7760
7794
|
const videoTrack = stream.getVideoTracks()[0];
|
|
7761
|
-
let sender = pc && pc.getSenders
|
|
7795
|
+
let sender = pc && pc.getSenders
|
|
7796
|
+
&& pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
|
|
7762
7797
|
let wasTrackEnabled = false;
|
|
7763
7798
|
if (!sender) {
|
|
7764
|
-
sender = pc && pc.getSenders().find(s => !s.track);
|
|
7799
|
+
sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
|
|
7765
7800
|
}
|
|
7766
7801
|
|
|
7767
7802
|
if (sender) {
|
|
@@ -9295,7 +9330,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9295
9330
|
const screenTrack = screenShareStream.getVideoTracks()[0];
|
|
9296
9331
|
const sipSession = this.currentSipSession;
|
|
9297
9332
|
const pc = this.client.getPeerConnection(this.getSipSessionId(sipSession));
|
|
9298
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9333
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9299
9334
|
const localStream = this.client.getLocalStream(this.getSipSessionId(sipSession));
|
|
9300
9335
|
const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
|
|
9301
9336
|
const hadVideo = !!videoTrack;
|
|
@@ -9377,7 +9412,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9377
9412
|
const screenTrack = screenStream.getVideoTracks()[0];
|
|
9378
9413
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9379
9414
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9380
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9415
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9381
9416
|
|
|
9382
9417
|
logger$8.info('WebRTC phone - on screensharing', {
|
|
9383
9418
|
hadVideo,
|
|
@@ -10622,6 +10657,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10622
10657
|
class InvalidSubscription extends Error {}
|
|
10623
10658
|
class InvalidAuthorization extends Error {}
|
|
10624
10659
|
class NoTenantIdError extends Error {}
|
|
10660
|
+
class NoDomainNameError extends Error {}
|
|
10625
10661
|
|
|
10626
10662
|
const logger$7 = IssueReporter$1.loggerFor('simple-auth');
|
|
10627
10663
|
|
|
@@ -10685,9 +10721,24 @@ class Auth {
|
|
|
10685
10721
|
setFetchOptions(options);
|
|
10686
10722
|
}
|
|
10687
10723
|
|
|
10688
|
-
async logIn(username , password , backend ,
|
|
10689
|
-
|
|
10690
|
-
|
|
10724
|
+
async logIn(username , password , backend , extra ) {
|
|
10725
|
+
let tenantId = null;
|
|
10726
|
+
let domainName = null;
|
|
10727
|
+
if (typeof extra === 'string') {
|
|
10728
|
+
tenantId = extra;
|
|
10729
|
+
}
|
|
10730
|
+
if (extra && typeof extra === 'object') {
|
|
10731
|
+
domainName = extra.domainName;
|
|
10732
|
+
}
|
|
10733
|
+
|
|
10734
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
10735
|
+
if (!tenantId) {
|
|
10736
|
+
throw new NoTenantIdError('No tenant id');
|
|
10737
|
+
}
|
|
10738
|
+
|
|
10739
|
+
if (!domainName) {
|
|
10740
|
+
throw new NoDomainNameError('No domain name');
|
|
10741
|
+
}
|
|
10691
10742
|
}
|
|
10692
10743
|
|
|
10693
10744
|
this.authenticated = false;
|
|
@@ -10697,6 +10748,7 @@ class Auth {
|
|
|
10697
10748
|
password,
|
|
10698
10749
|
backend,
|
|
10699
10750
|
tenantId,
|
|
10751
|
+
domainName,
|
|
10700
10752
|
expiration: this.expiration,
|
|
10701
10753
|
mobile: this.mobile,
|
|
10702
10754
|
});
|
|
@@ -10705,7 +10757,13 @@ class Auth {
|
|
|
10705
10757
|
getApiClient().setRefreshBackend(backend);
|
|
10706
10758
|
}
|
|
10707
10759
|
|
|
10708
|
-
|
|
10760
|
+
if (tenantId) {
|
|
10761
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
10762
|
+
}
|
|
10763
|
+
|
|
10764
|
+
if (domainName) {
|
|
10765
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
10766
|
+
}
|
|
10709
10767
|
|
|
10710
10768
|
return this._onAuthenticated(rawSession);
|
|
10711
10769
|
}
|
|
@@ -10804,11 +10862,18 @@ class Auth {
|
|
|
10804
10862
|
}
|
|
10805
10863
|
|
|
10806
10864
|
setRefreshTenantId(refreshTenantId ) {
|
|
10865
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
10807
10866
|
setRefreshTenantId(refreshTenantId);
|
|
10808
10867
|
|
|
10809
10868
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
10810
10869
|
}
|
|
10811
10870
|
|
|
10871
|
+
setRefreshDomainName(domainName ) {
|
|
10872
|
+
setRefreshDomainName(domainName);
|
|
10873
|
+
|
|
10874
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
10875
|
+
}
|
|
10876
|
+
|
|
10812
10877
|
forceRefreshToken() {
|
|
10813
10878
|
getApiClient().forceRefreshToken();
|
|
10814
10879
|
}
|
|
@@ -13900,6 +13965,7 @@ class Softphone {
|
|
|
13900
13965
|
wrapUpDuration,
|
|
13901
13966
|
enableAgent = true,
|
|
13902
13967
|
tenantId,
|
|
13968
|
+
domainName,
|
|
13903
13969
|
debug = false,
|
|
13904
13970
|
} = {}) {
|
|
13905
13971
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -13924,8 +13990,12 @@ class Softphone {
|
|
|
13924
13990
|
config.port = port;
|
|
13925
13991
|
}
|
|
13926
13992
|
if (tenantId) {
|
|
13993
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
13927
13994
|
config.tenantId = tenantId;
|
|
13928
13995
|
}
|
|
13996
|
+
if (domainName) {
|
|
13997
|
+
config.domainName = domainName;
|
|
13998
|
+
}
|
|
13929
13999
|
if (wrapUpDuration) {
|
|
13930
14000
|
config.wrapUpDuration = wrapUpDuration;
|
|
13931
14001
|
}
|
|
@@ -14246,6 +14316,7 @@ const Wazo = {
|
|
|
14246
14316
|
CanceledCallError,
|
|
14247
14317
|
SFUNotAvailableError,
|
|
14248
14318
|
NoTenantIdError,
|
|
14319
|
+
NoDomainNameError,
|
|
14249
14320
|
};
|
|
14250
14321
|
|
|
14251
14322
|
if (window) {
|
package/esm/simple/Softphone.js
CHANGED
|
@@ -107,6 +107,7 @@ class Softphone {
|
|
|
107
107
|
wrapUpDuration,
|
|
108
108
|
enableAgent = true,
|
|
109
109
|
tenantId,
|
|
110
|
+
domainName,
|
|
110
111
|
debug = false,
|
|
111
112
|
} = {}) {
|
|
112
113
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -131,8 +132,12 @@ class Softphone {
|
|
|
131
132
|
config.port = port;
|
|
132
133
|
}
|
|
133
134
|
if (tenantId) {
|
|
135
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
134
136
|
config.tenantId = tenantId;
|
|
135
137
|
}
|
|
138
|
+
if (domainName) {
|
|
139
|
+
config.domainName = domainName;
|
|
140
|
+
}
|
|
136
141
|
if (wrapUpDuration) {
|
|
137
142
|
config.wrapUpDuration = wrapUpDuration;
|
|
138
143
|
}
|