@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/lib/service/CallApi.js
CHANGED
|
@@ -2761,6 +2761,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2761
2761
|
|
|
2762
2762
|
|
|
2763
2763
|
|
|
2764
|
+
|
|
2764
2765
|
) {
|
|
2765
2766
|
const body = {
|
|
2766
2767
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2781,9 +2782,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2781
2782
|
}
|
|
2782
2783
|
|
|
2783
2784
|
if (params.tenantId) {
|
|
2785
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2784
2786
|
body.tenant_id = params.tenantId;
|
|
2785
2787
|
}
|
|
2786
2788
|
|
|
2789
|
+
if (params.domainName) {
|
|
2790
|
+
body.domain_name = params.domainName;
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2787
2793
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2788
2794
|
},
|
|
2789
2795
|
|
|
@@ -2796,6 +2802,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2796
2802
|
expiration ,
|
|
2797
2803
|
isMobile = false,
|
|
2798
2804
|
tenantId ,
|
|
2805
|
+
domainName ,
|
|
2799
2806
|
) => {
|
|
2800
2807
|
const body = {
|
|
2801
2808
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2805,9 +2812,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2805
2812
|
};
|
|
2806
2813
|
|
|
2807
2814
|
if (tenantId) {
|
|
2815
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2808
2816
|
body.tenant_id = tenantId;
|
|
2809
2817
|
}
|
|
2810
2818
|
|
|
2819
|
+
if (domainName) {
|
|
2820
|
+
body.domain_name = domainName;
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2811
2823
|
const headers = {
|
|
2812
2824
|
'Content-Type': 'application/json',
|
|
2813
2825
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -4730,6 +4742,7 @@ class ApiClient {
|
|
|
4730
4742
|
|
|
4731
4743
|
|
|
4732
4744
|
|
|
4745
|
+
|
|
4733
4746
|
|
|
4734
4747
|
|
|
4735
4748
|
|
|
@@ -4771,6 +4784,7 @@ class ApiClient {
|
|
|
4771
4784
|
refreshToken: this.refreshToken,
|
|
4772
4785
|
refreshBackend: this.refreshBackend,
|
|
4773
4786
|
refreshTenantId: this.refreshTenantId,
|
|
4787
|
+
refreshDomainName: this.refreshDomainName,
|
|
4774
4788
|
refreshExpiration: this.refreshExpiration,
|
|
4775
4789
|
isMobile: this.isMobile,
|
|
4776
4790
|
});
|
|
@@ -4786,6 +4800,7 @@ class ApiClient {
|
|
|
4786
4800
|
this.refreshExpiration,
|
|
4787
4801
|
this.isMobile,
|
|
4788
4802
|
this.refreshTenantId,
|
|
4803
|
+
this.refreshDomainName,
|
|
4789
4804
|
);
|
|
4790
4805
|
|
|
4791
4806
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4839,9 +4854,14 @@ class ApiClient {
|
|
|
4839
4854
|
}
|
|
4840
4855
|
|
|
4841
4856
|
setRefreshTenantId(tenantId ) {
|
|
4857
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
4842
4858
|
this.refreshTenantId = tenantId;
|
|
4843
4859
|
}
|
|
4844
4860
|
|
|
4861
|
+
setRefreshDomainName(domainName ) {
|
|
4862
|
+
this.refreshDomainName = domainName;
|
|
4863
|
+
}
|
|
4864
|
+
|
|
4845
4865
|
setIsMobile(isMobile ) {
|
|
4846
4866
|
this.isMobile = isMobile;
|
|
4847
4867
|
}
|
|
@@ -4866,6 +4886,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
4866
4886
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
4867
4887
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
4868
4888
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
4889
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
4869
4890
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
4870
4891
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
4871
4892
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -4875,6 +4896,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
|
|
|
4875
4896
|
|
|
4876
4897
|
const fillClient = (apiClient ) => {
|
|
4877
4898
|
const { server, token, clientId } = apiClient.client;
|
|
4899
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
4878
4900
|
|
|
4879
4901
|
// try with null server when dealing with non-related server info
|
|
4880
4902
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -4883,8 +4905,12 @@ const fillClient = (apiClient ) => {
|
|
|
4883
4905
|
|
|
4884
4906
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
4885
4907
|
|
|
4886
|
-
|
|
4887
|
-
|
|
4908
|
+
if (tenantId) {
|
|
4909
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
4910
|
+
}
|
|
4911
|
+
|
|
4912
|
+
apiClient.setRefreshDomainName(
|
|
4913
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
4888
4914
|
);
|
|
4889
4915
|
|
|
4890
4916
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -2217,6 +2217,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2217
2217
|
|
|
2218
2218
|
|
|
2219
2219
|
|
|
2220
|
+
|
|
2220
2221
|
) {
|
|
2221
2222
|
const body = {
|
|
2222
2223
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2237,9 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2237
2238
|
}
|
|
2238
2239
|
|
|
2239
2240
|
if (params.tenantId) {
|
|
2241
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2240
2242
|
body.tenant_id = params.tenantId;
|
|
2241
2243
|
}
|
|
2242
2244
|
|
|
2245
|
+
if (params.domainName) {
|
|
2246
|
+
body.domain_name = params.domainName;
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2243
2249
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2244
2250
|
},
|
|
2245
2251
|
|
|
@@ -2252,6 +2258,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2252
2258
|
expiration ,
|
|
2253
2259
|
isMobile = false,
|
|
2254
2260
|
tenantId ,
|
|
2261
|
+
domainName ,
|
|
2255
2262
|
) => {
|
|
2256
2263
|
const body = {
|
|
2257
2264
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2261,9 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2261
2268
|
};
|
|
2262
2269
|
|
|
2263
2270
|
if (tenantId) {
|
|
2271
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2264
2272
|
body.tenant_id = tenantId;
|
|
2265
2273
|
}
|
|
2266
2274
|
|
|
2275
|
+
if (domainName) {
|
|
2276
|
+
body.domain_name = domainName;
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2267
2279
|
const headers = {
|
|
2268
2280
|
'Content-Type': 'application/json',
|
|
2269
2281
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -4732,6 +4744,7 @@ class ApiClient {
|
|
|
4732
4744
|
|
|
4733
4745
|
|
|
4734
4746
|
|
|
4747
|
+
|
|
4735
4748
|
|
|
4736
4749
|
|
|
4737
4750
|
|
|
@@ -4773,6 +4786,7 @@ class ApiClient {
|
|
|
4773
4786
|
refreshToken: this.refreshToken,
|
|
4774
4787
|
refreshBackend: this.refreshBackend,
|
|
4775
4788
|
refreshTenantId: this.refreshTenantId,
|
|
4789
|
+
refreshDomainName: this.refreshDomainName,
|
|
4776
4790
|
refreshExpiration: this.refreshExpiration,
|
|
4777
4791
|
isMobile: this.isMobile,
|
|
4778
4792
|
});
|
|
@@ -4788,6 +4802,7 @@ class ApiClient {
|
|
|
4788
4802
|
this.refreshExpiration,
|
|
4789
4803
|
this.isMobile,
|
|
4790
4804
|
this.refreshTenantId,
|
|
4805
|
+
this.refreshDomainName,
|
|
4791
4806
|
);
|
|
4792
4807
|
|
|
4793
4808
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4841,9 +4856,14 @@ class ApiClient {
|
|
|
4841
4856
|
}
|
|
4842
4857
|
|
|
4843
4858
|
setRefreshTenantId(tenantId ) {
|
|
4859
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
4844
4860
|
this.refreshTenantId = tenantId;
|
|
4845
4861
|
}
|
|
4846
4862
|
|
|
4863
|
+
setRefreshDomainName(domainName ) {
|
|
4864
|
+
this.refreshDomainName = domainName;
|
|
4865
|
+
}
|
|
4866
|
+
|
|
4847
4867
|
setIsMobile(isMobile ) {
|
|
4848
4868
|
this.isMobile = isMobile;
|
|
4849
4869
|
}
|
|
@@ -4868,6 +4888,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
4868
4888
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
4869
4889
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
4870
4890
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
4891
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
4871
4892
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
4872
4893
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
4873
4894
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -4892,9 +4913,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
4892
4913
|
};
|
|
4893
4914
|
|
|
4894
4915
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
4916
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
4895
4917
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
4896
4918
|
};
|
|
4897
4919
|
|
|
4920
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
4921
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
4922
|
+
};
|
|
4923
|
+
|
|
4898
4924
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
4899
4925
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
4900
4926
|
};
|
|
@@ -4921,6 +4947,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
4921
4947
|
|
|
4922
4948
|
const fillClient = (apiClient ) => {
|
|
4923
4949
|
const { server, token, clientId } = apiClient.client;
|
|
4950
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
4924
4951
|
|
|
4925
4952
|
// try with null server when dealing with non-related server info
|
|
4926
4953
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -4929,8 +4956,12 @@ const fillClient = (apiClient ) => {
|
|
|
4929
4956
|
|
|
4930
4957
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
4931
4958
|
|
|
4932
|
-
|
|
4933
|
-
|
|
4959
|
+
if (tenantId) {
|
|
4960
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
4961
|
+
}
|
|
4962
|
+
|
|
4963
|
+
apiClient.setRefreshDomainName(
|
|
4964
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
4934
4965
|
);
|
|
4935
4966
|
|
|
4936
4967
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -4976,6 +5007,7 @@ exports.setIsMobile = setIsMobile;
|
|
|
4976
5007
|
exports.setOnRefreshToken = setOnRefreshToken;
|
|
4977
5008
|
exports.setOnRefreshTokenError = setOnRefreshTokenError;
|
|
4978
5009
|
exports.setRefreshBackend = setRefreshBackend;
|
|
5010
|
+
exports.setRefreshDomainName = setRefreshDomainName;
|
|
4979
5011
|
exports.setRefreshExpiration = setRefreshExpiration;
|
|
4980
5012
|
exports.setRefreshTenantId = setRefreshTenantId;
|
|
4981
5013
|
exports.setRefreshToken = setRefreshToken;
|
package/lib/simple/Auth.js
CHANGED
|
@@ -2241,6 +2241,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2241
2241
|
|
|
2242
2242
|
|
|
2243
2243
|
|
|
2244
|
+
|
|
2244
2245
|
) {
|
|
2245
2246
|
const body = {
|
|
2246
2247
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2261,9 +2262,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2261
2262
|
}
|
|
2262
2263
|
|
|
2263
2264
|
if (params.tenantId) {
|
|
2265
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2264
2266
|
body.tenant_id = params.tenantId;
|
|
2265
2267
|
}
|
|
2266
2268
|
|
|
2269
|
+
if (params.domainName) {
|
|
2270
|
+
body.domain_name = params.domainName;
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2267
2273
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2268
2274
|
},
|
|
2269
2275
|
|
|
@@ -2276,6 +2282,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2276
2282
|
expiration ,
|
|
2277
2283
|
isMobile = false,
|
|
2278
2284
|
tenantId ,
|
|
2285
|
+
domainName ,
|
|
2279
2286
|
) => {
|
|
2280
2287
|
const body = {
|
|
2281
2288
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2285,9 +2292,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2285
2292
|
};
|
|
2286
2293
|
|
|
2287
2294
|
if (tenantId) {
|
|
2295
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2288
2296
|
body.tenant_id = tenantId;
|
|
2289
2297
|
}
|
|
2290
2298
|
|
|
2299
|
+
if (domainName) {
|
|
2300
|
+
body.domain_name = domainName;
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2291
2303
|
const headers = {
|
|
2292
2304
|
'Content-Type': 'application/json',
|
|
2293
2305
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -5585,6 +5597,7 @@ class ApiClient {
|
|
|
5585
5597
|
|
|
5586
5598
|
|
|
5587
5599
|
|
|
5600
|
+
|
|
5588
5601
|
|
|
5589
5602
|
|
|
5590
5603
|
|
|
@@ -5626,6 +5639,7 @@ class ApiClient {
|
|
|
5626
5639
|
refreshToken: this.refreshToken,
|
|
5627
5640
|
refreshBackend: this.refreshBackend,
|
|
5628
5641
|
refreshTenantId: this.refreshTenantId,
|
|
5642
|
+
refreshDomainName: this.refreshDomainName,
|
|
5629
5643
|
refreshExpiration: this.refreshExpiration,
|
|
5630
5644
|
isMobile: this.isMobile,
|
|
5631
5645
|
});
|
|
@@ -5641,6 +5655,7 @@ class ApiClient {
|
|
|
5641
5655
|
this.refreshExpiration,
|
|
5642
5656
|
this.isMobile,
|
|
5643
5657
|
this.refreshTenantId,
|
|
5658
|
+
this.refreshDomainName,
|
|
5644
5659
|
);
|
|
5645
5660
|
|
|
5646
5661
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5694,9 +5709,14 @@ class ApiClient {
|
|
|
5694
5709
|
}
|
|
5695
5710
|
|
|
5696
5711
|
setRefreshTenantId(tenantId ) {
|
|
5712
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
5697
5713
|
this.refreshTenantId = tenantId;
|
|
5698
5714
|
}
|
|
5699
5715
|
|
|
5716
|
+
setRefreshDomainName(domainName ) {
|
|
5717
|
+
this.refreshDomainName = domainName;
|
|
5718
|
+
}
|
|
5719
|
+
|
|
5700
5720
|
setIsMobile(isMobile ) {
|
|
5701
5721
|
this.isMobile = isMobile;
|
|
5702
5722
|
}
|
|
@@ -5721,6 +5741,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
5721
5741
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
5722
5742
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
5723
5743
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
5744
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
5724
5745
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
5725
5746
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
5726
5747
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -5745,9 +5766,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
5745
5766
|
};
|
|
5746
5767
|
|
|
5747
5768
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
5769
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
5748
5770
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
5749
5771
|
};
|
|
5750
5772
|
|
|
5773
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
5774
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
5775
|
+
};
|
|
5776
|
+
|
|
5751
5777
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
5752
5778
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
5753
5779
|
};
|
|
@@ -5766,6 +5792,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
5766
5792
|
|
|
5767
5793
|
const fillClient = (apiClient ) => {
|
|
5768
5794
|
const { server, token, clientId } = apiClient.client;
|
|
5795
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
5769
5796
|
|
|
5770
5797
|
// try with null server when dealing with non-related server info
|
|
5771
5798
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -5774,8 +5801,12 @@ const fillClient = (apiClient ) => {
|
|
|
5774
5801
|
|
|
5775
5802
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
5776
5803
|
|
|
5777
|
-
|
|
5778
|
-
|
|
5804
|
+
if (tenantId) {
|
|
5805
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
5806
|
+
}
|
|
5807
|
+
|
|
5808
|
+
apiClient.setRefreshDomainName(
|
|
5809
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
5779
5810
|
);
|
|
5780
5811
|
|
|
5781
5812
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -7431,7 +7462,7 @@ class WebRTCClient extends Emitter {
|
|
|
7431
7462
|
|
|
7432
7463
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7433
7464
|
} else {
|
|
7434
|
-
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
7465
|
+
videoSender = pc && pc.getSenders && pc.getSenders().find(sender => sender.track === null);
|
|
7435
7466
|
}
|
|
7436
7467
|
|
|
7437
7468
|
if (!videoSender) {
|
|
@@ -7472,9 +7503,11 @@ class WebRTCClient extends Emitter {
|
|
|
7472
7503
|
const videoTracks = localStream.getVideoTracks();
|
|
7473
7504
|
|
|
7474
7505
|
// Remove video senders
|
|
7475
|
-
pc.getSenders
|
|
7476
|
-
|
|
7477
|
-
|
|
7506
|
+
if (pc.getSenders) {
|
|
7507
|
+
pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
|
|
7508
|
+
videoSender.replaceTrack(null);
|
|
7509
|
+
});
|
|
7510
|
+
}
|
|
7478
7511
|
|
|
7479
7512
|
videoTracks.forEach(videoTrack => {
|
|
7480
7513
|
videoTrack.enabled = false;
|
|
@@ -7707,7 +7740,8 @@ class WebRTCClient extends Emitter {
|
|
|
7707
7740
|
const constraints = { audio: { deviceId: { exact: deviceId } } };
|
|
7708
7741
|
const stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
7709
7742
|
const audioTrack = stream.getAudioTracks()[0];
|
|
7710
|
-
const sender = pc && pc.getSenders
|
|
7743
|
+
const sender = pc && pc.getSenders
|
|
7744
|
+
&& pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
|
|
7711
7745
|
|
|
7712
7746
|
if (sender) {
|
|
7713
7747
|
if (sender.track) {
|
|
@@ -7770,10 +7804,11 @@ class WebRTCClient extends Emitter {
|
|
|
7770
7804
|
// $FlowFixMe
|
|
7771
7805
|
return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
|
|
7772
7806
|
const videoTrack = stream.getVideoTracks()[0];
|
|
7773
|
-
let sender = pc && pc.getSenders
|
|
7807
|
+
let sender = pc && pc.getSenders
|
|
7808
|
+
&& pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
|
|
7774
7809
|
let wasTrackEnabled = false;
|
|
7775
7810
|
if (!sender) {
|
|
7776
|
-
sender = pc && pc.getSenders().find(s => !s.track);
|
|
7811
|
+
sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
|
|
7777
7812
|
}
|
|
7778
7813
|
|
|
7779
7814
|
if (sender) {
|
|
@@ -9307,7 +9342,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9307
9342
|
const screenTrack = screenShareStream.getVideoTracks()[0];
|
|
9308
9343
|
const sipSession = this.currentSipSession;
|
|
9309
9344
|
const pc = this.client.getPeerConnection(this.getSipSessionId(sipSession));
|
|
9310
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9345
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9311
9346
|
const localStream = this.client.getLocalStream(this.getSipSessionId(sipSession));
|
|
9312
9347
|
const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
|
|
9313
9348
|
const hadVideo = !!videoTrack;
|
|
@@ -9389,7 +9424,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9389
9424
|
const screenTrack = screenStream.getVideoTracks()[0];
|
|
9390
9425
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9391
9426
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9392
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9427
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9393
9428
|
|
|
9394
9429
|
logger$8.info('WebRTC phone - on screensharing', {
|
|
9395
9430
|
hadVideo,
|
|
@@ -14021,6 +14056,7 @@ class Softphone {
|
|
|
14021
14056
|
wrapUpDuration,
|
|
14022
14057
|
enableAgent = true,
|
|
14023
14058
|
tenantId,
|
|
14059
|
+
domainName,
|
|
14024
14060
|
debug = false,
|
|
14025
14061
|
} = {}) {
|
|
14026
14062
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -14045,8 +14081,12 @@ class Softphone {
|
|
|
14045
14081
|
config.port = port;
|
|
14046
14082
|
}
|
|
14047
14083
|
if (tenantId) {
|
|
14084
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
14048
14085
|
config.tenantId = tenantId;
|
|
14049
14086
|
}
|
|
14087
|
+
if (domainName) {
|
|
14088
|
+
config.domainName = domainName;
|
|
14089
|
+
}
|
|
14050
14090
|
if (wrapUpDuration) {
|
|
14051
14091
|
config.wrapUpDuration = wrapUpDuration;
|
|
14052
14092
|
}
|
|
@@ -14367,6 +14407,7 @@ const Wazo = {
|
|
|
14367
14407
|
CanceledCallError,
|
|
14368
14408
|
SFUNotAvailableError,
|
|
14369
14409
|
NoTenantIdError,
|
|
14410
|
+
NoDomainNameError,
|
|
14370
14411
|
};
|
|
14371
14412
|
|
|
14372
14413
|
if (window) {
|
|
@@ -14381,6 +14422,7 @@ if (global) {
|
|
|
14381
14422
|
class InvalidSubscription extends Error {}
|
|
14382
14423
|
class InvalidAuthorization extends Error {}
|
|
14383
14424
|
class NoTenantIdError extends Error {}
|
|
14425
|
+
class NoDomainNameError extends Error {}
|
|
14384
14426
|
|
|
14385
14427
|
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
14386
14428
|
|
|
@@ -14444,9 +14486,24 @@ class Auth {
|
|
|
14444
14486
|
setFetchOptions(options);
|
|
14445
14487
|
}
|
|
14446
14488
|
|
|
14447
|
-
async logIn(username , password , backend ,
|
|
14448
|
-
|
|
14449
|
-
|
|
14489
|
+
async logIn(username , password , backend , extra ) {
|
|
14490
|
+
let tenantId = null;
|
|
14491
|
+
let domainName = null;
|
|
14492
|
+
if (typeof extra === 'string') {
|
|
14493
|
+
tenantId = extra;
|
|
14494
|
+
}
|
|
14495
|
+
if (extra && typeof extra === 'object') {
|
|
14496
|
+
domainName = extra.domainName;
|
|
14497
|
+
}
|
|
14498
|
+
|
|
14499
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
14500
|
+
if (!tenantId) {
|
|
14501
|
+
throw new NoTenantIdError('No tenant id');
|
|
14502
|
+
}
|
|
14503
|
+
|
|
14504
|
+
if (!domainName) {
|
|
14505
|
+
throw new NoDomainNameError('No domain name');
|
|
14506
|
+
}
|
|
14450
14507
|
}
|
|
14451
14508
|
|
|
14452
14509
|
this.authenticated = false;
|
|
@@ -14456,6 +14513,7 @@ class Auth {
|
|
|
14456
14513
|
password,
|
|
14457
14514
|
backend,
|
|
14458
14515
|
tenantId,
|
|
14516
|
+
domainName,
|
|
14459
14517
|
expiration: this.expiration,
|
|
14460
14518
|
mobile: this.mobile,
|
|
14461
14519
|
});
|
|
@@ -14464,7 +14522,13 @@ class Auth {
|
|
|
14464
14522
|
getApiClient().setRefreshBackend(backend);
|
|
14465
14523
|
}
|
|
14466
14524
|
|
|
14467
|
-
|
|
14525
|
+
if (tenantId) {
|
|
14526
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
14527
|
+
}
|
|
14528
|
+
|
|
14529
|
+
if (domainName) {
|
|
14530
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
14531
|
+
}
|
|
14468
14532
|
|
|
14469
14533
|
return this._onAuthenticated(rawSession);
|
|
14470
14534
|
}
|
|
@@ -14563,11 +14627,18 @@ class Auth {
|
|
|
14563
14627
|
}
|
|
14564
14628
|
|
|
14565
14629
|
setRefreshTenantId(refreshTenantId ) {
|
|
14630
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
14566
14631
|
setRefreshTenantId(refreshTenantId);
|
|
14567
14632
|
|
|
14568
14633
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
14569
14634
|
}
|
|
14570
14635
|
|
|
14636
|
+
setRefreshDomainName(domainName ) {
|
|
14637
|
+
setRefreshDomainName(domainName);
|
|
14638
|
+
|
|
14639
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
14640
|
+
}
|
|
14641
|
+
|
|
14571
14642
|
forceRefreshToken() {
|
|
14572
14643
|
getApiClient().forceRefreshToken();
|
|
14573
14644
|
}
|
|
@@ -14679,5 +14750,6 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
14679
14750
|
|
|
14680
14751
|
exports.InvalidAuthorization = InvalidAuthorization;
|
|
14681
14752
|
exports.InvalidSubscription = InvalidSubscription;
|
|
14753
|
+
exports.NoDomainNameError = NoDomainNameError;
|
|
14682
14754
|
exports.NoTenantIdError = NoTenantIdError;
|
|
14683
14755
|
exports.default = Auth$1;
|