@wazo/sdk 0.38.9 → 0.38.10
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 +21 -0
- 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 +21 -0
- package/esm/checker/checks/aor.js +21 -0
- package/esm/checker/checks/api.js +21 -0
- package/esm/checker/checks/index.js +21 -0
- package/esm/checker/checks/webrtc-transport.js +21 -0
- package/esm/checker/checks/webrtc.js +21 -0
- 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 +1 -0
- package/esm/index.js +73 -6
- package/esm/service/CallApi.js +28 -2
- package/esm/service/getApiClient.js +34 -3
- package/esm/simple/Auth.js +74 -7
- package/esm/simple/Configuration.js +73 -6
- package/esm/simple/Directory.js +28 -2
- package/esm/simple/Phone.js +73 -6
- package/esm/simple/Softphone.js +5 -0
- package/esm/simple/index.js +73 -6
- package/esm/simple/room/LocalParticipant.js +73 -6
- package/esm/simple/room/Participant.js +73 -6
- package/esm/simple/room/RemoteParticipant.js +73 -6
- package/esm/simple/room/Room.js +73 -6
- package/esm/simple/room/SipRoom.js +73 -6
- package/esm/simple/room/Stream.js +73 -6
- package/esm/simple/room/__tests__/Participant.test.js +73 -6
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +73 -6
- package/esm/simple/utils.js +73 -6
- package/esm/web-rtc-client.js +21 -0
- package/lib/__tests__/api-client.test.js +21 -0
- package/lib/__tests__/web-rtc-client.test.js +21 -0
- 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 +21 -0
- package/lib/checker/checks/aor.js +21 -0
- package/lib/checker/checks/api.js +21 -0
- package/lib/checker/checks/index.js +21 -0
- package/lib/checker/checks/webrtc-transport.js +21 -0
- package/lib/checker/checks/webrtc.js +21 -0
- 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 +1 -0
- package/lib/index.js +73 -6
- package/lib/service/CallApi.js +28 -2
- package/lib/service/getApiClient.js +34 -2
- package/lib/simple/Auth.js +74 -6
- package/lib/simple/Configuration.js +73 -6
- package/lib/simple/Directory.js +28 -2
- package/lib/simple/Phone.js +73 -6
- package/lib/simple/Softphone.js +5 -0
- package/lib/simple/index.js +73 -6
- package/lib/simple/room/LocalParticipant.js +73 -6
- package/lib/simple/room/Participant.js +73 -6
- package/lib/simple/room/RemoteParticipant.js +73 -6
- package/lib/simple/room/Room.js +73 -6
- package/lib/simple/room/SipRoom.js +73 -6
- package/lib/simple/room/Stream.js +73 -6
- package/lib/simple/room/__tests__/Participant.test.js +73 -6
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +73 -6
- package/lib/simple/utils.js +73 -6
- package/lib/web-rtc-client.js +21 -0
- package/package.json +2 -2
- package/src/api/auth.js +12 -0
- package/src/api-client.js +8 -0
- 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
|
@@ -2239,6 +2239,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2239
2239
|
|
|
2240
2240
|
|
|
2241
2241
|
|
|
2242
|
+
|
|
2242
2243
|
) {
|
|
2243
2244
|
const body = {
|
|
2244
2245
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2259,9 +2260,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2259
2260
|
}
|
|
2260
2261
|
|
|
2261
2262
|
if (params.tenantId) {
|
|
2263
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2262
2264
|
body.tenant_id = params.tenantId;
|
|
2263
2265
|
}
|
|
2264
2266
|
|
|
2267
|
+
if (params.domainName) {
|
|
2268
|
+
body.domain_name = params.domainName;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2265
2271
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2266
2272
|
},
|
|
2267
2273
|
|
|
@@ -2274,6 +2280,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2274
2280
|
expiration ,
|
|
2275
2281
|
isMobile = false,
|
|
2276
2282
|
tenantId ,
|
|
2283
|
+
domainName ,
|
|
2277
2284
|
) => {
|
|
2278
2285
|
const body = {
|
|
2279
2286
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2283,9 +2290,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2283
2290
|
};
|
|
2284
2291
|
|
|
2285
2292
|
if (tenantId) {
|
|
2293
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2286
2294
|
body.tenant_id = tenantId;
|
|
2287
2295
|
}
|
|
2288
2296
|
|
|
2297
|
+
if (domainName) {
|
|
2298
|
+
body.domain_name = domainName;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2289
2301
|
const headers = {
|
|
2290
2302
|
'Content-Type': 'application/json',
|
|
2291
2303
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -5583,6 +5595,7 @@ class ApiClient {
|
|
|
5583
5595
|
|
|
5584
5596
|
|
|
5585
5597
|
|
|
5598
|
+
|
|
5586
5599
|
|
|
5587
5600
|
|
|
5588
5601
|
|
|
@@ -5624,6 +5637,7 @@ class ApiClient {
|
|
|
5624
5637
|
refreshToken: this.refreshToken,
|
|
5625
5638
|
refreshBackend: this.refreshBackend,
|
|
5626
5639
|
refreshTenantId: this.refreshTenantId,
|
|
5640
|
+
refreshDomainName: this.refreshDomainName,
|
|
5627
5641
|
refreshExpiration: this.refreshExpiration,
|
|
5628
5642
|
isMobile: this.isMobile,
|
|
5629
5643
|
});
|
|
@@ -5639,6 +5653,7 @@ class ApiClient {
|
|
|
5639
5653
|
this.refreshExpiration,
|
|
5640
5654
|
this.isMobile,
|
|
5641
5655
|
this.refreshTenantId,
|
|
5656
|
+
this.refreshDomainName,
|
|
5642
5657
|
);
|
|
5643
5658
|
|
|
5644
5659
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5692,9 +5707,14 @@ class ApiClient {
|
|
|
5692
5707
|
}
|
|
5693
5708
|
|
|
5694
5709
|
setRefreshTenantId(tenantId ) {
|
|
5710
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
5695
5711
|
this.refreshTenantId = tenantId;
|
|
5696
5712
|
}
|
|
5697
5713
|
|
|
5714
|
+
setRefreshDomainName(domainName ) {
|
|
5715
|
+
this.refreshDomainName = domainName;
|
|
5716
|
+
}
|
|
5717
|
+
|
|
5698
5718
|
setIsMobile(isMobile ) {
|
|
5699
5719
|
this.isMobile = isMobile;
|
|
5700
5720
|
}
|
|
@@ -5719,6 +5739,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
5719
5739
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
5720
5740
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
5721
5741
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
5742
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
5722
5743
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
5723
5744
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
5724
5745
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -5743,9 +5764,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
5743
5764
|
};
|
|
5744
5765
|
|
|
5745
5766
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
5767
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
5746
5768
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
5747
5769
|
};
|
|
5748
5770
|
|
|
5771
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
5772
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
5773
|
+
};
|
|
5774
|
+
|
|
5749
5775
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
5750
5776
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
5751
5777
|
};
|
|
@@ -5764,6 +5790,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
5764
5790
|
|
|
5765
5791
|
const fillClient = (apiClient ) => {
|
|
5766
5792
|
const { server, token, clientId } = apiClient.client;
|
|
5793
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
5767
5794
|
|
|
5768
5795
|
// try with null server when dealing with non-related server info
|
|
5769
5796
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -5772,8 +5799,12 @@ const fillClient = (apiClient ) => {
|
|
|
5772
5799
|
|
|
5773
5800
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
5774
5801
|
|
|
5775
|
-
|
|
5776
|
-
|
|
5802
|
+
if (tenantId) {
|
|
5803
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
5804
|
+
}
|
|
5805
|
+
|
|
5806
|
+
apiClient.setRefreshDomainName(
|
|
5807
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
5777
5808
|
);
|
|
5778
5809
|
|
|
5779
5810
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -5815,6 +5846,7 @@ var getApiClient = (forServer = null) => {
|
|
|
5815
5846
|
class InvalidSubscription extends Error {}
|
|
5816
5847
|
class InvalidAuthorization extends Error {}
|
|
5817
5848
|
class NoTenantIdError extends Error {}
|
|
5849
|
+
class NoDomainNameError extends Error {}
|
|
5818
5850
|
|
|
5819
5851
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5820
5852
|
|
|
@@ -5878,9 +5910,24 @@ class Auth {
|
|
|
5878
5910
|
setFetchOptions(options);
|
|
5879
5911
|
}
|
|
5880
5912
|
|
|
5881
|
-
async logIn(username , password , backend ,
|
|
5882
|
-
|
|
5883
|
-
|
|
5913
|
+
async logIn(username , password , backend , extra ) {
|
|
5914
|
+
let tenantId = null;
|
|
5915
|
+
let domainName = null;
|
|
5916
|
+
if (typeof extra === 'string') {
|
|
5917
|
+
tenantId = extra;
|
|
5918
|
+
}
|
|
5919
|
+
if (extra && typeof extra === 'object') {
|
|
5920
|
+
domainName = extra.domainName;
|
|
5921
|
+
}
|
|
5922
|
+
|
|
5923
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
5924
|
+
if (!tenantId) {
|
|
5925
|
+
throw new NoTenantIdError('No tenant id');
|
|
5926
|
+
}
|
|
5927
|
+
|
|
5928
|
+
if (!domainName) {
|
|
5929
|
+
throw new NoDomainNameError('No domain name');
|
|
5930
|
+
}
|
|
5884
5931
|
}
|
|
5885
5932
|
|
|
5886
5933
|
this.authenticated = false;
|
|
@@ -5890,6 +5937,7 @@ class Auth {
|
|
|
5890
5937
|
password,
|
|
5891
5938
|
backend,
|
|
5892
5939
|
tenantId,
|
|
5940
|
+
domainName,
|
|
5893
5941
|
expiration: this.expiration,
|
|
5894
5942
|
mobile: this.mobile,
|
|
5895
5943
|
});
|
|
@@ -5898,7 +5946,13 @@ class Auth {
|
|
|
5898
5946
|
getApiClient().setRefreshBackend(backend);
|
|
5899
5947
|
}
|
|
5900
5948
|
|
|
5901
|
-
|
|
5949
|
+
if (tenantId) {
|
|
5950
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5951
|
+
}
|
|
5952
|
+
|
|
5953
|
+
if (domainName) {
|
|
5954
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
5955
|
+
}
|
|
5902
5956
|
|
|
5903
5957
|
return this._onAuthenticated(rawSession);
|
|
5904
5958
|
}
|
|
@@ -5997,11 +6051,18 @@ class Auth {
|
|
|
5997
6051
|
}
|
|
5998
6052
|
|
|
5999
6053
|
setRefreshTenantId(refreshTenantId ) {
|
|
6054
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
6000
6055
|
setRefreshTenantId(refreshTenantId);
|
|
6001
6056
|
|
|
6002
6057
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
6003
6058
|
}
|
|
6004
6059
|
|
|
6060
|
+
setRefreshDomainName(domainName ) {
|
|
6061
|
+
setRefreshDomainName(domainName);
|
|
6062
|
+
|
|
6063
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
6064
|
+
}
|
|
6065
|
+
|
|
6005
6066
|
forceRefreshToken() {
|
|
6006
6067
|
getApiClient().forceRefreshToken();
|
|
6007
6068
|
}
|
|
@@ -14320,6 +14381,7 @@ class Softphone {
|
|
|
14320
14381
|
wrapUpDuration,
|
|
14321
14382
|
enableAgent = true,
|
|
14322
14383
|
tenantId,
|
|
14384
|
+
domainName,
|
|
14323
14385
|
debug = false,
|
|
14324
14386
|
} = {}) {
|
|
14325
14387
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -14344,8 +14406,12 @@ class Softphone {
|
|
|
14344
14406
|
config.port = port;
|
|
14345
14407
|
}
|
|
14346
14408
|
if (tenantId) {
|
|
14409
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
14347
14410
|
config.tenantId = tenantId;
|
|
14348
14411
|
}
|
|
14412
|
+
if (domainName) {
|
|
14413
|
+
config.domainName = domainName;
|
|
14414
|
+
}
|
|
14349
14415
|
if (wrapUpDuration) {
|
|
14350
14416
|
config.wrapUpDuration = wrapUpDuration;
|
|
14351
14417
|
}
|
|
@@ -14666,6 +14732,7 @@ const Wazo = {
|
|
|
14666
14732
|
CanceledCallError,
|
|
14667
14733
|
SFUNotAvailableError,
|
|
14668
14734
|
NoTenantIdError,
|
|
14735
|
+
NoDomainNameError,
|
|
14669
14736
|
};
|
|
14670
14737
|
|
|
14671
14738
|
if (window) {
|
|
@@ -2239,6 +2239,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2239
2239
|
|
|
2240
2240
|
|
|
2241
2241
|
|
|
2242
|
+
|
|
2242
2243
|
) {
|
|
2243
2244
|
const body = {
|
|
2244
2245
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2259,9 +2260,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2259
2260
|
}
|
|
2260
2261
|
|
|
2261
2262
|
if (params.tenantId) {
|
|
2263
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2262
2264
|
body.tenant_id = params.tenantId;
|
|
2263
2265
|
}
|
|
2264
2266
|
|
|
2267
|
+
if (params.domainName) {
|
|
2268
|
+
body.domain_name = params.domainName;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2265
2271
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2266
2272
|
},
|
|
2267
2273
|
|
|
@@ -2274,6 +2280,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2274
2280
|
expiration ,
|
|
2275
2281
|
isMobile = false,
|
|
2276
2282
|
tenantId ,
|
|
2283
|
+
domainName ,
|
|
2277
2284
|
) => {
|
|
2278
2285
|
const body = {
|
|
2279
2286
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2283,9 +2290,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2283
2290
|
};
|
|
2284
2291
|
|
|
2285
2292
|
if (tenantId) {
|
|
2293
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2286
2294
|
body.tenant_id = tenantId;
|
|
2287
2295
|
}
|
|
2288
2296
|
|
|
2297
|
+
if (domainName) {
|
|
2298
|
+
body.domain_name = domainName;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2289
2301
|
const headers = {
|
|
2290
2302
|
'Content-Type': 'application/json',
|
|
2291
2303
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -5583,6 +5595,7 @@ class ApiClient {
|
|
|
5583
5595
|
|
|
5584
5596
|
|
|
5585
5597
|
|
|
5598
|
+
|
|
5586
5599
|
|
|
5587
5600
|
|
|
5588
5601
|
|
|
@@ -5624,6 +5637,7 @@ class ApiClient {
|
|
|
5624
5637
|
refreshToken: this.refreshToken,
|
|
5625
5638
|
refreshBackend: this.refreshBackend,
|
|
5626
5639
|
refreshTenantId: this.refreshTenantId,
|
|
5640
|
+
refreshDomainName: this.refreshDomainName,
|
|
5627
5641
|
refreshExpiration: this.refreshExpiration,
|
|
5628
5642
|
isMobile: this.isMobile,
|
|
5629
5643
|
});
|
|
@@ -5639,6 +5653,7 @@ class ApiClient {
|
|
|
5639
5653
|
this.refreshExpiration,
|
|
5640
5654
|
this.isMobile,
|
|
5641
5655
|
this.refreshTenantId,
|
|
5656
|
+
this.refreshDomainName,
|
|
5642
5657
|
);
|
|
5643
5658
|
|
|
5644
5659
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5692,9 +5707,14 @@ class ApiClient {
|
|
|
5692
5707
|
}
|
|
5693
5708
|
|
|
5694
5709
|
setRefreshTenantId(tenantId ) {
|
|
5710
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
5695
5711
|
this.refreshTenantId = tenantId;
|
|
5696
5712
|
}
|
|
5697
5713
|
|
|
5714
|
+
setRefreshDomainName(domainName ) {
|
|
5715
|
+
this.refreshDomainName = domainName;
|
|
5716
|
+
}
|
|
5717
|
+
|
|
5698
5718
|
setIsMobile(isMobile ) {
|
|
5699
5719
|
this.isMobile = isMobile;
|
|
5700
5720
|
}
|
|
@@ -5719,6 +5739,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
5719
5739
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
5720
5740
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
5721
5741
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
5742
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
5722
5743
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
5723
5744
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
5724
5745
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -5743,9 +5764,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
5743
5764
|
};
|
|
5744
5765
|
|
|
5745
5766
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
5767
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
5746
5768
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
5747
5769
|
};
|
|
5748
5770
|
|
|
5771
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
5772
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
5773
|
+
};
|
|
5774
|
+
|
|
5749
5775
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
5750
5776
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
5751
5777
|
};
|
|
@@ -5764,6 +5790,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
5764
5790
|
|
|
5765
5791
|
const fillClient = (apiClient ) => {
|
|
5766
5792
|
const { server, token, clientId } = apiClient.client;
|
|
5793
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
5767
5794
|
|
|
5768
5795
|
// try with null server when dealing with non-related server info
|
|
5769
5796
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -5772,8 +5799,12 @@ const fillClient = (apiClient ) => {
|
|
|
5772
5799
|
|
|
5773
5800
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
5774
5801
|
|
|
5775
|
-
|
|
5776
|
-
|
|
5802
|
+
if (tenantId) {
|
|
5803
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
5804
|
+
}
|
|
5805
|
+
|
|
5806
|
+
apiClient.setRefreshDomainName(
|
|
5807
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
5777
5808
|
);
|
|
5778
5809
|
|
|
5779
5810
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -5815,6 +5846,7 @@ var getApiClient = (forServer = null) => {
|
|
|
5815
5846
|
class InvalidSubscription extends Error {}
|
|
5816
5847
|
class InvalidAuthorization extends Error {}
|
|
5817
5848
|
class NoTenantIdError extends Error {}
|
|
5849
|
+
class NoDomainNameError extends Error {}
|
|
5818
5850
|
|
|
5819
5851
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5820
5852
|
|
|
@@ -5878,9 +5910,24 @@ class Auth {
|
|
|
5878
5910
|
setFetchOptions(options);
|
|
5879
5911
|
}
|
|
5880
5912
|
|
|
5881
|
-
async logIn(username , password , backend ,
|
|
5882
|
-
|
|
5883
|
-
|
|
5913
|
+
async logIn(username , password , backend , extra ) {
|
|
5914
|
+
let tenantId = null;
|
|
5915
|
+
let domainName = null;
|
|
5916
|
+
if (typeof extra === 'string') {
|
|
5917
|
+
tenantId = extra;
|
|
5918
|
+
}
|
|
5919
|
+
if (extra && typeof extra === 'object') {
|
|
5920
|
+
domainName = extra.domainName;
|
|
5921
|
+
}
|
|
5922
|
+
|
|
5923
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
5924
|
+
if (!tenantId) {
|
|
5925
|
+
throw new NoTenantIdError('No tenant id');
|
|
5926
|
+
}
|
|
5927
|
+
|
|
5928
|
+
if (!domainName) {
|
|
5929
|
+
throw new NoDomainNameError('No domain name');
|
|
5930
|
+
}
|
|
5884
5931
|
}
|
|
5885
5932
|
|
|
5886
5933
|
this.authenticated = false;
|
|
@@ -5890,6 +5937,7 @@ class Auth {
|
|
|
5890
5937
|
password,
|
|
5891
5938
|
backend,
|
|
5892
5939
|
tenantId,
|
|
5940
|
+
domainName,
|
|
5893
5941
|
expiration: this.expiration,
|
|
5894
5942
|
mobile: this.mobile,
|
|
5895
5943
|
});
|
|
@@ -5898,7 +5946,13 @@ class Auth {
|
|
|
5898
5946
|
getApiClient().setRefreshBackend(backend);
|
|
5899
5947
|
}
|
|
5900
5948
|
|
|
5901
|
-
|
|
5949
|
+
if (tenantId) {
|
|
5950
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5951
|
+
}
|
|
5952
|
+
|
|
5953
|
+
if (domainName) {
|
|
5954
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
5955
|
+
}
|
|
5902
5956
|
|
|
5903
5957
|
return this._onAuthenticated(rawSession);
|
|
5904
5958
|
}
|
|
@@ -5997,11 +6051,18 @@ class Auth {
|
|
|
5997
6051
|
}
|
|
5998
6052
|
|
|
5999
6053
|
setRefreshTenantId(refreshTenantId ) {
|
|
6054
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
6000
6055
|
setRefreshTenantId(refreshTenantId);
|
|
6001
6056
|
|
|
6002
6057
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
6003
6058
|
}
|
|
6004
6059
|
|
|
6060
|
+
setRefreshDomainName(domainName ) {
|
|
6061
|
+
setRefreshDomainName(domainName);
|
|
6062
|
+
|
|
6063
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
6064
|
+
}
|
|
6065
|
+
|
|
6005
6066
|
forceRefreshToken() {
|
|
6006
6067
|
getApiClient().forceRefreshToken();
|
|
6007
6068
|
}
|
|
@@ -14320,6 +14381,7 @@ class Softphone {
|
|
|
14320
14381
|
wrapUpDuration,
|
|
14321
14382
|
enableAgent = true,
|
|
14322
14383
|
tenantId,
|
|
14384
|
+
domainName,
|
|
14323
14385
|
debug = false,
|
|
14324
14386
|
} = {}) {
|
|
14325
14387
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -14344,8 +14406,12 @@ class Softphone {
|
|
|
14344
14406
|
config.port = port;
|
|
14345
14407
|
}
|
|
14346
14408
|
if (tenantId) {
|
|
14409
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
14347
14410
|
config.tenantId = tenantId;
|
|
14348
14411
|
}
|
|
14412
|
+
if (domainName) {
|
|
14413
|
+
config.domainName = domainName;
|
|
14414
|
+
}
|
|
14349
14415
|
if (wrapUpDuration) {
|
|
14350
14416
|
config.wrapUpDuration = wrapUpDuration;
|
|
14351
14417
|
}
|
|
@@ -14666,6 +14732,7 @@ const Wazo = {
|
|
|
14666
14732
|
CanceledCallError,
|
|
14667
14733
|
SFUNotAvailableError,
|
|
14668
14734
|
NoTenantIdError,
|
|
14735
|
+
NoDomainNameError,
|
|
14669
14736
|
};
|
|
14670
14737
|
|
|
14671
14738
|
if (window) {
|
package/lib/simple/utils.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);
|
|
@@ -5817,6 +5848,7 @@ var getApiClient = (forServer = null) => {
|
|
|
5817
5848
|
class InvalidSubscription extends Error {}
|
|
5818
5849
|
class InvalidAuthorization extends Error {}
|
|
5819
5850
|
class NoTenantIdError extends Error {}
|
|
5851
|
+
class NoDomainNameError extends Error {}
|
|
5820
5852
|
|
|
5821
5853
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5822
5854
|
|
|
@@ -5880,9 +5912,24 @@ class Auth {
|
|
|
5880
5912
|
setFetchOptions(options);
|
|
5881
5913
|
}
|
|
5882
5914
|
|
|
5883
|
-
async logIn(username , password , backend ,
|
|
5884
|
-
|
|
5885
|
-
|
|
5915
|
+
async logIn(username , password , backend , extra ) {
|
|
5916
|
+
let tenantId = null;
|
|
5917
|
+
let domainName = null;
|
|
5918
|
+
if (typeof extra === 'string') {
|
|
5919
|
+
tenantId = extra;
|
|
5920
|
+
}
|
|
5921
|
+
if (extra && typeof extra === 'object') {
|
|
5922
|
+
domainName = extra.domainName;
|
|
5923
|
+
}
|
|
5924
|
+
|
|
5925
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
5926
|
+
if (!tenantId) {
|
|
5927
|
+
throw new NoTenantIdError('No tenant id');
|
|
5928
|
+
}
|
|
5929
|
+
|
|
5930
|
+
if (!domainName) {
|
|
5931
|
+
throw new NoDomainNameError('No domain name');
|
|
5932
|
+
}
|
|
5886
5933
|
}
|
|
5887
5934
|
|
|
5888
5935
|
this.authenticated = false;
|
|
@@ -5892,6 +5939,7 @@ class Auth {
|
|
|
5892
5939
|
password,
|
|
5893
5940
|
backend,
|
|
5894
5941
|
tenantId,
|
|
5942
|
+
domainName,
|
|
5895
5943
|
expiration: this.expiration,
|
|
5896
5944
|
mobile: this.mobile,
|
|
5897
5945
|
});
|
|
@@ -5900,7 +5948,13 @@ class Auth {
|
|
|
5900
5948
|
getApiClient().setRefreshBackend(backend);
|
|
5901
5949
|
}
|
|
5902
5950
|
|
|
5903
|
-
|
|
5951
|
+
if (tenantId) {
|
|
5952
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5953
|
+
}
|
|
5954
|
+
|
|
5955
|
+
if (domainName) {
|
|
5956
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
5957
|
+
}
|
|
5904
5958
|
|
|
5905
5959
|
return this._onAuthenticated(rawSession);
|
|
5906
5960
|
}
|
|
@@ -5999,11 +6053,18 @@ class Auth {
|
|
|
5999
6053
|
}
|
|
6000
6054
|
|
|
6001
6055
|
setRefreshTenantId(refreshTenantId ) {
|
|
6056
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
6002
6057
|
setRefreshTenantId(refreshTenantId);
|
|
6003
6058
|
|
|
6004
6059
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
6005
6060
|
}
|
|
6006
6061
|
|
|
6062
|
+
setRefreshDomainName(domainName ) {
|
|
6063
|
+
setRefreshDomainName(domainName);
|
|
6064
|
+
|
|
6065
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
6066
|
+
}
|
|
6067
|
+
|
|
6007
6068
|
forceRefreshToken() {
|
|
6008
6069
|
getApiClient().forceRefreshToken();
|
|
6009
6070
|
}
|
|
@@ -14306,6 +14367,7 @@ class Softphone {
|
|
|
14306
14367
|
wrapUpDuration,
|
|
14307
14368
|
enableAgent = true,
|
|
14308
14369
|
tenantId,
|
|
14370
|
+
domainName,
|
|
14309
14371
|
debug = false,
|
|
14310
14372
|
} = {}) {
|
|
14311
14373
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -14330,8 +14392,12 @@ class Softphone {
|
|
|
14330
14392
|
config.port = port;
|
|
14331
14393
|
}
|
|
14332
14394
|
if (tenantId) {
|
|
14395
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
14333
14396
|
config.tenantId = tenantId;
|
|
14334
14397
|
}
|
|
14398
|
+
if (domainName) {
|
|
14399
|
+
config.domainName = domainName;
|
|
14400
|
+
}
|
|
14335
14401
|
if (wrapUpDuration) {
|
|
14336
14402
|
config.wrapUpDuration = wrapUpDuration;
|
|
14337
14403
|
}
|
|
@@ -14652,6 +14718,7 @@ const Wazo = {
|
|
|
14652
14718
|
CanceledCallError,
|
|
14653
14719
|
SFUNotAvailableError,
|
|
14654
14720
|
NoTenantIdError,
|
|
14721
|
+
NoDomainNameError,
|
|
14655
14722
|
};
|
|
14656
14723
|
|
|
14657
14724
|
if (window) {
|