@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
|
@@ -3175,6 +3175,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
3175
3175
|
|
|
3176
3176
|
|
|
3177
3177
|
|
|
3178
|
+
|
|
3178
3179
|
) {
|
|
3179
3180
|
const body = {
|
|
3180
3181
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -3195,9 +3196,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
3195
3196
|
}
|
|
3196
3197
|
|
|
3197
3198
|
if (params.tenantId) {
|
|
3199
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
3198
3200
|
body.tenant_id = params.tenantId;
|
|
3199
3201
|
}
|
|
3200
3202
|
|
|
3203
|
+
if (params.domainName) {
|
|
3204
|
+
body.domain_name = params.domainName;
|
|
3205
|
+
}
|
|
3206
|
+
|
|
3201
3207
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
3202
3208
|
},
|
|
3203
3209
|
|
|
@@ -3210,6 +3216,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
3210
3216
|
expiration ,
|
|
3211
3217
|
isMobile = false,
|
|
3212
3218
|
tenantId ,
|
|
3219
|
+
domainName ,
|
|
3213
3220
|
) => {
|
|
3214
3221
|
const body = {
|
|
3215
3222
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -3219,9 +3226,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
3219
3226
|
};
|
|
3220
3227
|
|
|
3221
3228
|
if (tenantId) {
|
|
3229
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
3222
3230
|
body.tenant_id = tenantId;
|
|
3223
3231
|
}
|
|
3224
3232
|
|
|
3233
|
+
if (domainName) {
|
|
3234
|
+
body.domain_name = domainName;
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3225
3237
|
const headers = {
|
|
3226
3238
|
'Content-Type': 'application/json',
|
|
3227
3239
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -5137,6 +5149,7 @@ class ApiClient {
|
|
|
5137
5149
|
|
|
5138
5150
|
|
|
5139
5151
|
|
|
5152
|
+
|
|
5140
5153
|
|
|
5141
5154
|
|
|
5142
5155
|
|
|
@@ -5178,6 +5191,7 @@ class ApiClient {
|
|
|
5178
5191
|
refreshToken: this.refreshToken,
|
|
5179
5192
|
refreshBackend: this.refreshBackend,
|
|
5180
5193
|
refreshTenantId: this.refreshTenantId,
|
|
5194
|
+
refreshDomainName: this.refreshDomainName,
|
|
5181
5195
|
refreshExpiration: this.refreshExpiration,
|
|
5182
5196
|
isMobile: this.isMobile,
|
|
5183
5197
|
});
|
|
@@ -5193,6 +5207,7 @@ class ApiClient {
|
|
|
5193
5207
|
this.refreshExpiration,
|
|
5194
5208
|
this.isMobile,
|
|
5195
5209
|
this.refreshTenantId,
|
|
5210
|
+
this.refreshDomainName,
|
|
5196
5211
|
);
|
|
5197
5212
|
|
|
5198
5213
|
logger$1.info('token refreshed', { token: session.token });
|
|
@@ -5246,9 +5261,14 @@ class ApiClient {
|
|
|
5246
5261
|
}
|
|
5247
5262
|
|
|
5248
5263
|
setRefreshTenantId(tenantId ) {
|
|
5264
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
5249
5265
|
this.refreshTenantId = tenantId;
|
|
5250
5266
|
}
|
|
5251
5267
|
|
|
5268
|
+
setRefreshDomainName(domainName ) {
|
|
5269
|
+
this.refreshDomainName = domainName;
|
|
5270
|
+
}
|
|
5271
|
+
|
|
5252
5272
|
setIsMobile(isMobile ) {
|
|
5253
5273
|
this.isMobile = isMobile;
|
|
5254
5274
|
}
|
|
@@ -5273,6 +5293,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
5273
5293
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
5274
5294
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
5275
5295
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
5296
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
5276
5297
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
5277
5298
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
5278
5299
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -5282,6 +5303,7 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
|
|
|
5282
5303
|
|
|
5283
5304
|
const fillClient = (apiClient ) => {
|
|
5284
5305
|
const { server, token, clientId } = apiClient.client;
|
|
5306
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
5285
5307
|
|
|
5286
5308
|
// try with null server when dealing with non-related server info
|
|
5287
5309
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -5290,8 +5312,12 @@ const fillClient = (apiClient ) => {
|
|
|
5290
5312
|
|
|
5291
5313
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
5292
5314
|
|
|
5293
|
-
|
|
5294
|
-
|
|
5315
|
+
if (tenantId) {
|
|
5316
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
5317
|
+
}
|
|
5318
|
+
|
|
5319
|
+
apiClient.setRefreshDomainName(
|
|
5320
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
5295
5321
|
);
|
|
5296
5322
|
|
|
5297
5323
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -894,6 +894,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
894
894
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
895
895
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
896
896
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
897
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
897
898
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
898
899
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
899
900
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -1395,7 +1396,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1395
1396
|
const screenTrack = screenShareStream.getVideoTracks()[0];
|
|
1396
1397
|
const sipSession = this.currentSipSession;
|
|
1397
1398
|
const pc = this.client.getPeerConnection(this.getSipSessionId(sipSession));
|
|
1398
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
1399
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
1399
1400
|
const localStream = this.client.getLocalStream(this.getSipSessionId(sipSession));
|
|
1400
1401
|
const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
|
|
1401
1402
|
const hadVideo = !!videoTrack;
|
|
@@ -1477,7 +1478,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1477
1478
|
const screenTrack = screenStream.getVideoTracks()[0];
|
|
1478
1479
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
1479
1480
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
1480
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
1481
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
1481
1482
|
|
|
1482
1483
|
logger.info('WebRTC phone - on screensharing', {
|
|
1483
1484
|
hadVideo,
|
package/esm/index.js
CHANGED
|
@@ -2230,6 +2230,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2230
2230
|
|
|
2231
2231
|
|
|
2232
2232
|
|
|
2233
|
+
|
|
2233
2234
|
) {
|
|
2234
2235
|
const body = {
|
|
2235
2236
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2250,9 +2251,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2250
2251
|
}
|
|
2251
2252
|
|
|
2252
2253
|
if (params.tenantId) {
|
|
2254
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2253
2255
|
body.tenant_id = params.tenantId;
|
|
2254
2256
|
}
|
|
2255
2257
|
|
|
2258
|
+
if (params.domainName) {
|
|
2259
|
+
body.domain_name = params.domainName;
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2256
2262
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2257
2263
|
},
|
|
2258
2264
|
|
|
@@ -2265,6 +2271,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2265
2271
|
expiration ,
|
|
2266
2272
|
isMobile = false,
|
|
2267
2273
|
tenantId ,
|
|
2274
|
+
domainName ,
|
|
2268
2275
|
) => {
|
|
2269
2276
|
const body = {
|
|
2270
2277
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2274,9 +2281,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2274
2281
|
};
|
|
2275
2282
|
|
|
2276
2283
|
if (tenantId) {
|
|
2284
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2277
2285
|
body.tenant_id = tenantId;
|
|
2278
2286
|
}
|
|
2279
2287
|
|
|
2288
|
+
if (domainName) {
|
|
2289
|
+
body.domain_name = domainName;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2280
2292
|
const headers = {
|
|
2281
2293
|
'Content-Type': 'application/json',
|
|
2282
2294
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -4123,6 +4135,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
4123
4135
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
4124
4136
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
4125
4137
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
4138
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
4126
4139
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
4127
4140
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
4128
4141
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -4147,9 +4160,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
4147
4160
|
};
|
|
4148
4161
|
|
|
4149
4162
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
4163
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
4150
4164
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
4151
4165
|
};
|
|
4152
4166
|
|
|
4167
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
4168
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
4169
|
+
};
|
|
4170
|
+
|
|
4153
4171
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
4154
4172
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
4155
4173
|
};
|
|
@@ -4168,6 +4186,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
4168
4186
|
|
|
4169
4187
|
const fillClient = (apiClient ) => {
|
|
4170
4188
|
const { server, token, clientId } = apiClient.client;
|
|
4189
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
4171
4190
|
|
|
4172
4191
|
// try with null server when dealing with non-related server info
|
|
4173
4192
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -4176,8 +4195,12 @@ const fillClient = (apiClient ) => {
|
|
|
4176
4195
|
|
|
4177
4196
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
4178
4197
|
|
|
4179
|
-
|
|
4180
|
-
|
|
4198
|
+
if (tenantId) {
|
|
4199
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
4200
|
+
}
|
|
4201
|
+
|
|
4202
|
+
apiClient.setRefreshDomainName(
|
|
4203
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
4181
4204
|
);
|
|
4182
4205
|
|
|
4183
4206
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -5675,6 +5698,7 @@ class ApiClient {
|
|
|
5675
5698
|
|
|
5676
5699
|
|
|
5677
5700
|
|
|
5701
|
+
|
|
5678
5702
|
|
|
5679
5703
|
|
|
5680
5704
|
|
|
@@ -5716,6 +5740,7 @@ class ApiClient {
|
|
|
5716
5740
|
refreshToken: this.refreshToken,
|
|
5717
5741
|
refreshBackend: this.refreshBackend,
|
|
5718
5742
|
refreshTenantId: this.refreshTenantId,
|
|
5743
|
+
refreshDomainName: this.refreshDomainName,
|
|
5719
5744
|
refreshExpiration: this.refreshExpiration,
|
|
5720
5745
|
isMobile: this.isMobile,
|
|
5721
5746
|
});
|
|
@@ -5731,6 +5756,7 @@ class ApiClient {
|
|
|
5731
5756
|
this.refreshExpiration,
|
|
5732
5757
|
this.isMobile,
|
|
5733
5758
|
this.refreshTenantId,
|
|
5759
|
+
this.refreshDomainName,
|
|
5734
5760
|
);
|
|
5735
5761
|
|
|
5736
5762
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5784,9 +5810,14 @@ class ApiClient {
|
|
|
5784
5810
|
}
|
|
5785
5811
|
|
|
5786
5812
|
setRefreshTenantId(tenantId ) {
|
|
5813
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
5787
5814
|
this.refreshTenantId = tenantId;
|
|
5788
5815
|
}
|
|
5789
5816
|
|
|
5817
|
+
setRefreshDomainName(domainName ) {
|
|
5818
|
+
this.refreshDomainName = domainName;
|
|
5819
|
+
}
|
|
5820
|
+
|
|
5790
5821
|
setIsMobile(isMobile ) {
|
|
5791
5822
|
this.isMobile = isMobile;
|
|
5792
5823
|
}
|
|
@@ -7241,7 +7272,7 @@ class WebRTCClient extends Emitter {
|
|
|
7241
7272
|
|
|
7242
7273
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
7243
7274
|
} else {
|
|
7244
|
-
videoSender = pc.getSenders().find(sender => sender.track === null);
|
|
7275
|
+
videoSender = pc && pc.getSenders && pc.getSenders().find(sender => sender.track === null);
|
|
7245
7276
|
}
|
|
7246
7277
|
|
|
7247
7278
|
if (!videoSender) {
|
|
@@ -7282,9 +7313,11 @@ class WebRTCClient extends Emitter {
|
|
|
7282
7313
|
const videoTracks = localStream.getVideoTracks();
|
|
7283
7314
|
|
|
7284
7315
|
// Remove video senders
|
|
7285
|
-
pc.getSenders
|
|
7286
|
-
|
|
7287
|
-
|
|
7316
|
+
if (pc.getSenders) {
|
|
7317
|
+
pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
|
|
7318
|
+
videoSender.replaceTrack(null);
|
|
7319
|
+
});
|
|
7320
|
+
}
|
|
7288
7321
|
|
|
7289
7322
|
videoTracks.forEach(videoTrack => {
|
|
7290
7323
|
videoTrack.enabled = false;
|
|
@@ -7517,7 +7550,8 @@ class WebRTCClient extends Emitter {
|
|
|
7517
7550
|
const constraints = { audio: { deviceId: { exact: deviceId } } };
|
|
7518
7551
|
const stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
7519
7552
|
const audioTrack = stream.getAudioTracks()[0];
|
|
7520
|
-
const sender = pc && pc.getSenders
|
|
7553
|
+
const sender = pc && pc.getSenders
|
|
7554
|
+
&& pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
|
|
7521
7555
|
|
|
7522
7556
|
if (sender) {
|
|
7523
7557
|
if (sender.track) {
|
|
@@ -7580,10 +7614,11 @@ class WebRTCClient extends Emitter {
|
|
|
7580
7614
|
// $FlowFixMe
|
|
7581
7615
|
return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
|
|
7582
7616
|
const videoTrack = stream.getVideoTracks()[0];
|
|
7583
|
-
let sender = pc && pc.getSenders
|
|
7617
|
+
let sender = pc && pc.getSenders
|
|
7618
|
+
&& pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
|
|
7584
7619
|
let wasTrackEnabled = false;
|
|
7585
7620
|
if (!sender) {
|
|
7586
|
-
sender = pc && pc.getSenders().find(s => !s.track);
|
|
7621
|
+
sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
|
|
7587
7622
|
}
|
|
7588
7623
|
|
|
7589
7624
|
if (sender) {
|
|
@@ -10021,7 +10056,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10021
10056
|
const screenTrack = screenShareStream.getVideoTracks()[0];
|
|
10022
10057
|
const sipSession = this.currentSipSession;
|
|
10023
10058
|
const pc = this.client.getPeerConnection(this.getSipSessionId(sipSession));
|
|
10024
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
10059
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
10025
10060
|
const localStream = this.client.getLocalStream(this.getSipSessionId(sipSession));
|
|
10026
10061
|
const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
|
|
10027
10062
|
const hadVideo = !!videoTrack;
|
|
@@ -10103,7 +10138,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10103
10138
|
const screenTrack = screenStream.getVideoTracks()[0];
|
|
10104
10139
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
10105
10140
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
10106
|
-
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
10141
|
+
const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
10107
10142
|
|
|
10108
10143
|
logger$7.info('WebRTC phone - on screensharing', {
|
|
10109
10144
|
hadVideo,
|
|
@@ -11944,6 +11979,7 @@ const getCallableNumber = (number , country ) => {
|
|
|
11944
11979
|
class InvalidSubscription extends Error {}
|
|
11945
11980
|
class InvalidAuthorization extends Error {}
|
|
11946
11981
|
class NoTenantIdError extends Error {}
|
|
11982
|
+
class NoDomainNameError extends Error {}
|
|
11947
11983
|
|
|
11948
11984
|
const logger$5 = IssueReporter$1.loggerFor('simple-auth');
|
|
11949
11985
|
|
|
@@ -12007,9 +12043,24 @@ class Auth {
|
|
|
12007
12043
|
setFetchOptions(options);
|
|
12008
12044
|
}
|
|
12009
12045
|
|
|
12010
|
-
async logIn(username , password , backend ,
|
|
12011
|
-
|
|
12012
|
-
|
|
12046
|
+
async logIn(username , password , backend , extra ) {
|
|
12047
|
+
let tenantId = null;
|
|
12048
|
+
let domainName = null;
|
|
12049
|
+
if (typeof extra === 'string') {
|
|
12050
|
+
tenantId = extra;
|
|
12051
|
+
}
|
|
12052
|
+
if (extra && typeof extra === 'object') {
|
|
12053
|
+
domainName = extra.domainName;
|
|
12054
|
+
}
|
|
12055
|
+
|
|
12056
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
12057
|
+
if (!tenantId) {
|
|
12058
|
+
throw new NoTenantIdError('No tenant id');
|
|
12059
|
+
}
|
|
12060
|
+
|
|
12061
|
+
if (!domainName) {
|
|
12062
|
+
throw new NoDomainNameError('No domain name');
|
|
12063
|
+
}
|
|
12013
12064
|
}
|
|
12014
12065
|
|
|
12015
12066
|
this.authenticated = false;
|
|
@@ -12019,6 +12070,7 @@ class Auth {
|
|
|
12019
12070
|
password,
|
|
12020
12071
|
backend,
|
|
12021
12072
|
tenantId,
|
|
12073
|
+
domainName,
|
|
12022
12074
|
expiration: this.expiration,
|
|
12023
12075
|
mobile: this.mobile,
|
|
12024
12076
|
});
|
|
@@ -12027,7 +12079,13 @@ class Auth {
|
|
|
12027
12079
|
getApiClient().setRefreshBackend(backend);
|
|
12028
12080
|
}
|
|
12029
12081
|
|
|
12030
|
-
|
|
12082
|
+
if (tenantId) {
|
|
12083
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
12084
|
+
}
|
|
12085
|
+
|
|
12086
|
+
if (domainName) {
|
|
12087
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
12088
|
+
}
|
|
12031
12089
|
|
|
12032
12090
|
return this._onAuthenticated(rawSession);
|
|
12033
12091
|
}
|
|
@@ -12126,11 +12184,18 @@ class Auth {
|
|
|
12126
12184
|
}
|
|
12127
12185
|
|
|
12128
12186
|
setRefreshTenantId(refreshTenantId ) {
|
|
12187
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
12129
12188
|
setRefreshTenantId(refreshTenantId);
|
|
12130
12189
|
|
|
12131
12190
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
12132
12191
|
}
|
|
12133
12192
|
|
|
12193
|
+
setRefreshDomainName(domainName ) {
|
|
12194
|
+
setRefreshDomainName(domainName);
|
|
12195
|
+
|
|
12196
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
12197
|
+
}
|
|
12198
|
+
|
|
12134
12199
|
forceRefreshToken() {
|
|
12135
12200
|
getApiClient().forceRefreshToken();
|
|
12136
12201
|
}
|
|
@@ -14448,6 +14513,7 @@ class Softphone {
|
|
|
14448
14513
|
wrapUpDuration,
|
|
14449
14514
|
enableAgent = true,
|
|
14450
14515
|
tenantId,
|
|
14516
|
+
domainName,
|
|
14451
14517
|
debug = false,
|
|
14452
14518
|
} = {}) {
|
|
14453
14519
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -14472,8 +14538,12 @@ class Softphone {
|
|
|
14472
14538
|
config.port = port;
|
|
14473
14539
|
}
|
|
14474
14540
|
if (tenantId) {
|
|
14541
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
14475
14542
|
config.tenantId = tenantId;
|
|
14476
14543
|
}
|
|
14544
|
+
if (domainName) {
|
|
14545
|
+
config.domainName = domainName;
|
|
14546
|
+
}
|
|
14477
14547
|
if (wrapUpDuration) {
|
|
14478
14548
|
config.wrapUpDuration = wrapUpDuration;
|
|
14479
14549
|
}
|
|
@@ -14794,6 +14864,7 @@ const Wazo = {
|
|
|
14794
14864
|
CanceledCallError,
|
|
14795
14865
|
SFUNotAvailableError,
|
|
14796
14866
|
NoTenantIdError,
|
|
14867
|
+
NoDomainNameError,
|
|
14797
14868
|
};
|
|
14798
14869
|
|
|
14799
14870
|
if (window) {
|
package/esm/service/CallApi.js
CHANGED
|
@@ -2755,6 +2755,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2755
2755
|
|
|
2756
2756
|
|
|
2757
2757
|
|
|
2758
|
+
|
|
2758
2759
|
) {
|
|
2759
2760
|
const body = {
|
|
2760
2761
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2775,9 +2776,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2775
2776
|
}
|
|
2776
2777
|
|
|
2777
2778
|
if (params.tenantId) {
|
|
2779
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2778
2780
|
body.tenant_id = params.tenantId;
|
|
2779
2781
|
}
|
|
2780
2782
|
|
|
2783
|
+
if (params.domainName) {
|
|
2784
|
+
body.domain_name = params.domainName;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2781
2787
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2782
2788
|
},
|
|
2783
2789
|
|
|
@@ -2790,6 +2796,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2790
2796
|
expiration ,
|
|
2791
2797
|
isMobile = false,
|
|
2792
2798
|
tenantId ,
|
|
2799
|
+
domainName ,
|
|
2793
2800
|
) => {
|
|
2794
2801
|
const body = {
|
|
2795
2802
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2799,9 +2806,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2799
2806
|
};
|
|
2800
2807
|
|
|
2801
2808
|
if (tenantId) {
|
|
2809
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2802
2810
|
body.tenant_id = tenantId;
|
|
2803
2811
|
}
|
|
2804
2812
|
|
|
2813
|
+
if (domainName) {
|
|
2814
|
+
body.domain_name = domainName;
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2805
2817
|
const headers = {
|
|
2806
2818
|
'Content-Type': 'application/json',
|
|
2807
2819
|
...(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);
|
|
@@ -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 };
|