@wazo/sdk 0.38.8 → 0.38.11
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 +31 -6
- 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 +31 -6
- package/esm/checker/checks/aor.js +21 -0
- package/esm/checker/checks/api.js +21 -0
- package/esm/checker/checks/index.js +31 -6
- package/esm/checker/checks/webrtc-transport.js +31 -6
- package/esm/checker/checks/webrtc.js +31 -6
- 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 +4 -5
- package/esm/index.js +86 -17
- package/esm/service/CallApi.js +28 -2
- package/esm/service/getApiClient.js +34 -3
- package/esm/simple/Auth.js +87 -18
- package/esm/simple/Configuration.js +86 -17
- package/esm/simple/Directory.js +28 -2
- package/esm/simple/Phone.js +86 -17
- package/esm/simple/Softphone.js +5 -0
- package/esm/simple/index.js +86 -17
- package/esm/simple/room/LocalParticipant.js +86 -17
- package/esm/simple/room/Participant.js +86 -17
- package/esm/simple/room/RemoteParticipant.js +86 -17
- package/esm/simple/room/Room.js +86 -17
- package/esm/simple/room/SipRoom.js +86 -17
- package/esm/simple/room/Stream.js +86 -17
- package/esm/simple/room/__tests__/Participant.test.js +86 -17
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +86 -17
- package/esm/simple/utils.js +86 -17
- package/esm/web-rtc-client.js +31 -6
- package/lib/__tests__/api-client.test.js +21 -0
- package/lib/__tests__/web-rtc-client.test.js +31 -6
- 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 +31 -6
- package/lib/checker/checks/aor.js +21 -0
- package/lib/checker/checks/api.js +21 -0
- package/lib/checker/checks/index.js +31 -6
- package/lib/checker/checks/webrtc-transport.js +31 -6
- package/lib/checker/checks/webrtc.js +31 -6
- 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 +4 -5
- package/lib/index.js +86 -17
- package/lib/service/CallApi.js +28 -2
- package/lib/service/getApiClient.js +34 -2
- package/lib/simple/Auth.js +87 -17
- package/lib/simple/Configuration.js +86 -17
- package/lib/simple/Directory.js +28 -2
- package/lib/simple/Phone.js +86 -17
- package/lib/simple/Softphone.js +5 -0
- package/lib/simple/index.js +86 -17
- package/lib/simple/room/LocalParticipant.js +86 -17
- package/lib/simple/room/Participant.js +86 -17
- package/lib/simple/room/RemoteParticipant.js +86 -17
- package/lib/simple/room/Room.js +86 -17
- package/lib/simple/room/SipRoom.js +86 -17
- package/lib/simple/room/Stream.js +86 -17
- package/lib/simple/room/__tests__/Participant.test.js +86 -17
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +86 -17
- package/lib/simple/utils.js +86 -17
- package/lib/web-rtc-client.js +31 -6
- 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 +3 -5
- 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 +10 -6
|
@@ -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 || {};
|
|
@@ -4884,9 +4905,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
4884
4905
|
};
|
|
4885
4906
|
|
|
4886
4907
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
4908
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
4887
4909
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
4888
4910
|
};
|
|
4889
4911
|
|
|
4912
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
4913
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
4914
|
+
};
|
|
4915
|
+
|
|
4890
4916
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
4891
4917
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
4892
4918
|
};
|
|
@@ -4913,6 +4939,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
4913
4939
|
|
|
4914
4940
|
const fillClient = (apiClient ) => {
|
|
4915
4941
|
const { server, token, clientId } = apiClient.client;
|
|
4942
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
4916
4943
|
|
|
4917
4944
|
// try with null server when dealing with non-related server info
|
|
4918
4945
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -4921,8 +4948,12 @@ const fillClient = (apiClient ) => {
|
|
|
4921
4948
|
|
|
4922
4949
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
4923
4950
|
|
|
4924
|
-
|
|
4925
|
-
|
|
4951
|
+
if (tenantId) {
|
|
4952
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4955
|
+
apiClient.setRefreshDomainName(
|
|
4956
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
4926
4957
|
);
|
|
4927
4958
|
|
|
4928
4959
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -4960,4 +4991,4 @@ var getApiClient = (forServer = null) => {
|
|
|
4960
4991
|
};
|
|
4961
4992
|
|
|
4962
4993
|
export default getApiClient;
|
|
4963
|
-
export { setApiClientId, setApiToken, setCurrentServer, setFetchOptions, setIsMobile, setOnRefreshToken, setOnRefreshTokenError, setRefreshBackend, setRefreshExpiration, setRefreshTenantId, setRefreshToken };
|
|
4994
|
+
export { setApiClientId, setApiToken, setCurrentServer, setFetchOptions, setIsMobile, setOnRefreshToken, setOnRefreshTokenError, setRefreshBackend, setRefreshDomainName, setRefreshExpiration, setRefreshTenantId, setRefreshToken };
|
package/esm/simple/Auth.js
CHANGED
|
@@ -2229,6 +2229,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2229
2229
|
|
|
2230
2230
|
|
|
2231
2231
|
|
|
2232
|
+
|
|
2232
2233
|
) {
|
|
2233
2234
|
const body = {
|
|
2234
2235
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2249,9 +2250,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2249
2250
|
}
|
|
2250
2251
|
|
|
2251
2252
|
if (params.tenantId) {
|
|
2253
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2252
2254
|
body.tenant_id = params.tenantId;
|
|
2253
2255
|
}
|
|
2254
2256
|
|
|
2257
|
+
if (params.domainName) {
|
|
2258
|
+
body.domain_name = params.domainName;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2255
2261
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2256
2262
|
},
|
|
2257
2263
|
|
|
@@ -2264,6 +2270,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2264
2270
|
expiration ,
|
|
2265
2271
|
isMobile = false,
|
|
2266
2272
|
tenantId ,
|
|
2273
|
+
domainName ,
|
|
2267
2274
|
) => {
|
|
2268
2275
|
const body = {
|
|
2269
2276
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2273,9 +2280,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2273
2280
|
};
|
|
2274
2281
|
|
|
2275
2282
|
if (tenantId) {
|
|
2283
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2276
2284
|
body.tenant_id = tenantId;
|
|
2277
2285
|
}
|
|
2278
2286
|
|
|
2287
|
+
if (domainName) {
|
|
2288
|
+
body.domain_name = domainName;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2279
2291
|
const headers = {
|
|
2280
2292
|
'Content-Type': 'application/json',
|
|
2281
2293
|
...(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);
|
|
@@ -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;
|
|
@@ -9333,9 +9368,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9333
9368
|
|
|
9334
9369
|
try {
|
|
9335
9370
|
if (this.currentScreenShare.stream) {
|
|
9336
|
-
this.currentScreenShare.stream.getTracks()
|
|
9337
|
-
.filter(track => track.kind === 'video')
|
|
9338
|
-
.forEach(track => track.stop());
|
|
9371
|
+
this.currentScreenShare.stream.getTracks().forEach(track => track.stop());
|
|
9339
9372
|
}
|
|
9340
9373
|
|
|
9341
9374
|
if (restoreLocalStream) {
|
|
@@ -9379,7 +9412,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9379
9412
|
const screenTrack = screenStream.getVideoTracks()[0];
|
|
9380
9413
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9381
9414
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9382
|
-
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');
|
|
9383
9416
|
|
|
9384
9417
|
logger$8.info('WebRTC phone - on screensharing', {
|
|
9385
9418
|
hadVideo,
|
|
@@ -14011,6 +14044,7 @@ class Softphone {
|
|
|
14011
14044
|
wrapUpDuration,
|
|
14012
14045
|
enableAgent = true,
|
|
14013
14046
|
tenantId,
|
|
14047
|
+
domainName,
|
|
14014
14048
|
debug = false,
|
|
14015
14049
|
} = {}) {
|
|
14016
14050
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -14035,8 +14069,12 @@ class Softphone {
|
|
|
14035
14069
|
config.port = port;
|
|
14036
14070
|
}
|
|
14037
14071
|
if (tenantId) {
|
|
14072
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
14038
14073
|
config.tenantId = tenantId;
|
|
14039
14074
|
}
|
|
14075
|
+
if (domainName) {
|
|
14076
|
+
config.domainName = domainName;
|
|
14077
|
+
}
|
|
14040
14078
|
if (wrapUpDuration) {
|
|
14041
14079
|
config.wrapUpDuration = wrapUpDuration;
|
|
14042
14080
|
}
|
|
@@ -14357,6 +14395,7 @@ const Wazo = {
|
|
|
14357
14395
|
CanceledCallError,
|
|
14358
14396
|
SFUNotAvailableError,
|
|
14359
14397
|
NoTenantIdError,
|
|
14398
|
+
NoDomainNameError,
|
|
14360
14399
|
};
|
|
14361
14400
|
|
|
14362
14401
|
if (window) {
|
|
@@ -14371,6 +14410,7 @@ if (global) {
|
|
|
14371
14410
|
class InvalidSubscription extends Error {}
|
|
14372
14411
|
class InvalidAuthorization extends Error {}
|
|
14373
14412
|
class NoTenantIdError extends Error {}
|
|
14413
|
+
class NoDomainNameError extends Error {}
|
|
14374
14414
|
|
|
14375
14415
|
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
14376
14416
|
|
|
@@ -14434,9 +14474,24 @@ class Auth {
|
|
|
14434
14474
|
setFetchOptions(options);
|
|
14435
14475
|
}
|
|
14436
14476
|
|
|
14437
|
-
async logIn(username , password , backend ,
|
|
14438
|
-
|
|
14439
|
-
|
|
14477
|
+
async logIn(username , password , backend , extra ) {
|
|
14478
|
+
let tenantId = null;
|
|
14479
|
+
let domainName = null;
|
|
14480
|
+
if (typeof extra === 'string') {
|
|
14481
|
+
tenantId = extra;
|
|
14482
|
+
}
|
|
14483
|
+
if (extra && typeof extra === 'object') {
|
|
14484
|
+
domainName = extra.domainName;
|
|
14485
|
+
}
|
|
14486
|
+
|
|
14487
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
14488
|
+
if (!tenantId) {
|
|
14489
|
+
throw new NoTenantIdError('No tenant id');
|
|
14490
|
+
}
|
|
14491
|
+
|
|
14492
|
+
if (!domainName) {
|
|
14493
|
+
throw new NoDomainNameError('No domain name');
|
|
14494
|
+
}
|
|
14440
14495
|
}
|
|
14441
14496
|
|
|
14442
14497
|
this.authenticated = false;
|
|
@@ -14446,6 +14501,7 @@ class Auth {
|
|
|
14446
14501
|
password,
|
|
14447
14502
|
backend,
|
|
14448
14503
|
tenantId,
|
|
14504
|
+
domainName,
|
|
14449
14505
|
expiration: this.expiration,
|
|
14450
14506
|
mobile: this.mobile,
|
|
14451
14507
|
});
|
|
@@ -14454,7 +14510,13 @@ class Auth {
|
|
|
14454
14510
|
getApiClient().setRefreshBackend(backend);
|
|
14455
14511
|
}
|
|
14456
14512
|
|
|
14457
|
-
|
|
14513
|
+
if (tenantId) {
|
|
14514
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
14515
|
+
}
|
|
14516
|
+
|
|
14517
|
+
if (domainName) {
|
|
14518
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
14519
|
+
}
|
|
14458
14520
|
|
|
14459
14521
|
return this._onAuthenticated(rawSession);
|
|
14460
14522
|
}
|
|
@@ -14553,11 +14615,18 @@ class Auth {
|
|
|
14553
14615
|
}
|
|
14554
14616
|
|
|
14555
14617
|
setRefreshTenantId(refreshTenantId ) {
|
|
14618
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
14556
14619
|
setRefreshTenantId(refreshTenantId);
|
|
14557
14620
|
|
|
14558
14621
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
14559
14622
|
}
|
|
14560
14623
|
|
|
14624
|
+
setRefreshDomainName(domainName ) {
|
|
14625
|
+
setRefreshDomainName(domainName);
|
|
14626
|
+
|
|
14627
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
14628
|
+
}
|
|
14629
|
+
|
|
14561
14630
|
forceRefreshToken() {
|
|
14562
14631
|
getApiClient().forceRefreshToken();
|
|
14563
14632
|
}
|
|
@@ -14668,4 +14737,4 @@ if (!global.wazoAuthInstance) {
|
|
|
14668
14737
|
var Auth$1 = global.wazoAuthInstance;
|
|
14669
14738
|
|
|
14670
14739
|
export default Auth$1;
|
|
14671
|
-
export { InvalidAuthorization, InvalidSubscription, NoTenantIdError };
|
|
14740
|
+
export { InvalidAuthorization, InvalidSubscription, NoDomainNameError, NoTenantIdError };
|