@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
package/esm/simple/Phone.js
CHANGED
|
@@ -2838,6 +2838,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2838
2838
|
|
|
2839
2839
|
|
|
2840
2840
|
|
|
2841
|
+
|
|
2841
2842
|
) {
|
|
2842
2843
|
const body = {
|
|
2843
2844
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2858,9 +2859,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2858
2859
|
}
|
|
2859
2860
|
|
|
2860
2861
|
if (params.tenantId) {
|
|
2862
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2861
2863
|
body.tenant_id = params.tenantId;
|
|
2862
2864
|
}
|
|
2863
2865
|
|
|
2866
|
+
if (params.domainName) {
|
|
2867
|
+
body.domain_name = params.domainName;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2864
2870
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2865
2871
|
},
|
|
2866
2872
|
|
|
@@ -2873,6 +2879,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2873
2879
|
expiration ,
|
|
2874
2880
|
isMobile = false,
|
|
2875
2881
|
tenantId ,
|
|
2882
|
+
domainName ,
|
|
2876
2883
|
) => {
|
|
2877
2884
|
const body = {
|
|
2878
2885
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2882,9 +2889,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2882
2889
|
};
|
|
2883
2890
|
|
|
2884
2891
|
if (tenantId) {
|
|
2892
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2885
2893
|
body.tenant_id = tenantId;
|
|
2886
2894
|
}
|
|
2887
2895
|
|
|
2896
|
+
if (domainName) {
|
|
2897
|
+
body.domain_name = domainName;
|
|
2898
|
+
}
|
|
2899
|
+
|
|
2888
2900
|
const headers = {
|
|
2889
2901
|
'Content-Type': 'application/json',
|
|
2890
2902
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -5573,6 +5585,7 @@ class ApiClient {
|
|
|
5573
5585
|
|
|
5574
5586
|
|
|
5575
5587
|
|
|
5588
|
+
|
|
5576
5589
|
|
|
5577
5590
|
|
|
5578
5591
|
|
|
@@ -5614,6 +5627,7 @@ class ApiClient {
|
|
|
5614
5627
|
refreshToken: this.refreshToken,
|
|
5615
5628
|
refreshBackend: this.refreshBackend,
|
|
5616
5629
|
refreshTenantId: this.refreshTenantId,
|
|
5630
|
+
refreshDomainName: this.refreshDomainName,
|
|
5617
5631
|
refreshExpiration: this.refreshExpiration,
|
|
5618
5632
|
isMobile: this.isMobile,
|
|
5619
5633
|
});
|
|
@@ -5629,6 +5643,7 @@ class ApiClient {
|
|
|
5629
5643
|
this.refreshExpiration,
|
|
5630
5644
|
this.isMobile,
|
|
5631
5645
|
this.refreshTenantId,
|
|
5646
|
+
this.refreshDomainName,
|
|
5632
5647
|
);
|
|
5633
5648
|
|
|
5634
5649
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5682,9 +5697,14 @@ class ApiClient {
|
|
|
5682
5697
|
}
|
|
5683
5698
|
|
|
5684
5699
|
setRefreshTenantId(tenantId ) {
|
|
5700
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
5685
5701
|
this.refreshTenantId = tenantId;
|
|
5686
5702
|
}
|
|
5687
5703
|
|
|
5704
|
+
setRefreshDomainName(domainName ) {
|
|
5705
|
+
this.refreshDomainName = domainName;
|
|
5706
|
+
}
|
|
5707
|
+
|
|
5688
5708
|
setIsMobile(isMobile ) {
|
|
5689
5709
|
this.isMobile = isMobile;
|
|
5690
5710
|
}
|
|
@@ -5709,6 +5729,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
5709
5729
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
5710
5730
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
5711
5731
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
5732
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
5712
5733
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
5713
5734
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
5714
5735
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -5733,9 +5754,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
5733
5754
|
};
|
|
5734
5755
|
|
|
5735
5756
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
5757
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
5736
5758
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
5737
5759
|
};
|
|
5738
5760
|
|
|
5761
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
5762
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
5763
|
+
};
|
|
5764
|
+
|
|
5739
5765
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
5740
5766
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
5741
5767
|
};
|
|
@@ -5754,6 +5780,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
5754
5780
|
|
|
5755
5781
|
const fillClient = (apiClient ) => {
|
|
5756
5782
|
const { server, token, clientId } = apiClient.client;
|
|
5783
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
5757
5784
|
|
|
5758
5785
|
// try with null server when dealing with non-related server info
|
|
5759
5786
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -5762,8 +5789,12 @@ const fillClient = (apiClient ) => {
|
|
|
5762
5789
|
|
|
5763
5790
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
5764
5791
|
|
|
5765
|
-
|
|
5766
|
-
|
|
5792
|
+
if (tenantId) {
|
|
5793
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
5794
|
+
}
|
|
5795
|
+
|
|
5796
|
+
apiClient.setRefreshDomainName(
|
|
5797
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
5767
5798
|
);
|
|
5768
5799
|
|
|
5769
5800
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -10622,6 +10653,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10622
10653
|
class InvalidSubscription extends Error {}
|
|
10623
10654
|
class InvalidAuthorization extends Error {}
|
|
10624
10655
|
class NoTenantIdError extends Error {}
|
|
10656
|
+
class NoDomainNameError extends Error {}
|
|
10625
10657
|
|
|
10626
10658
|
const logger$7 = IssueReporter$1.loggerFor('simple-auth');
|
|
10627
10659
|
|
|
@@ -10685,9 +10717,24 @@ class Auth {
|
|
|
10685
10717
|
setFetchOptions(options);
|
|
10686
10718
|
}
|
|
10687
10719
|
|
|
10688
|
-
async logIn(username , password , backend ,
|
|
10689
|
-
|
|
10690
|
-
|
|
10720
|
+
async logIn(username , password , backend , extra ) {
|
|
10721
|
+
let tenantId = null;
|
|
10722
|
+
let domainName = null;
|
|
10723
|
+
if (typeof extra === 'string') {
|
|
10724
|
+
tenantId = extra;
|
|
10725
|
+
}
|
|
10726
|
+
if (extra && typeof extra === 'object') {
|
|
10727
|
+
domainName = extra.domainName;
|
|
10728
|
+
}
|
|
10729
|
+
|
|
10730
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
10731
|
+
if (!tenantId) {
|
|
10732
|
+
throw new NoTenantIdError('No tenant id');
|
|
10733
|
+
}
|
|
10734
|
+
|
|
10735
|
+
if (!domainName) {
|
|
10736
|
+
throw new NoDomainNameError('No domain name');
|
|
10737
|
+
}
|
|
10691
10738
|
}
|
|
10692
10739
|
|
|
10693
10740
|
this.authenticated = false;
|
|
@@ -10697,6 +10744,7 @@ class Auth {
|
|
|
10697
10744
|
password,
|
|
10698
10745
|
backend,
|
|
10699
10746
|
tenantId,
|
|
10747
|
+
domainName,
|
|
10700
10748
|
expiration: this.expiration,
|
|
10701
10749
|
mobile: this.mobile,
|
|
10702
10750
|
});
|
|
@@ -10705,7 +10753,13 @@ class Auth {
|
|
|
10705
10753
|
getApiClient().setRefreshBackend(backend);
|
|
10706
10754
|
}
|
|
10707
10755
|
|
|
10708
|
-
|
|
10756
|
+
if (tenantId) {
|
|
10757
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
10758
|
+
}
|
|
10759
|
+
|
|
10760
|
+
if (domainName) {
|
|
10761
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
10762
|
+
}
|
|
10709
10763
|
|
|
10710
10764
|
return this._onAuthenticated(rawSession);
|
|
10711
10765
|
}
|
|
@@ -10804,11 +10858,18 @@ class Auth {
|
|
|
10804
10858
|
}
|
|
10805
10859
|
|
|
10806
10860
|
setRefreshTenantId(refreshTenantId ) {
|
|
10861
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
10807
10862
|
setRefreshTenantId(refreshTenantId);
|
|
10808
10863
|
|
|
10809
10864
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
10810
10865
|
}
|
|
10811
10866
|
|
|
10867
|
+
setRefreshDomainName(domainName ) {
|
|
10868
|
+
setRefreshDomainName(domainName);
|
|
10869
|
+
|
|
10870
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
10871
|
+
}
|
|
10872
|
+
|
|
10812
10873
|
forceRefreshToken() {
|
|
10813
10874
|
getApiClient().forceRefreshToken();
|
|
10814
10875
|
}
|
|
@@ -13900,6 +13961,7 @@ class Softphone {
|
|
|
13900
13961
|
wrapUpDuration,
|
|
13901
13962
|
enableAgent = true,
|
|
13902
13963
|
tenantId,
|
|
13964
|
+
domainName,
|
|
13903
13965
|
debug = false,
|
|
13904
13966
|
} = {}) {
|
|
13905
13967
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -13924,8 +13986,12 @@ class Softphone {
|
|
|
13924
13986
|
config.port = port;
|
|
13925
13987
|
}
|
|
13926
13988
|
if (tenantId) {
|
|
13989
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
13927
13990
|
config.tenantId = tenantId;
|
|
13928
13991
|
}
|
|
13992
|
+
if (domainName) {
|
|
13993
|
+
config.domainName = domainName;
|
|
13994
|
+
}
|
|
13929
13995
|
if (wrapUpDuration) {
|
|
13930
13996
|
config.wrapUpDuration = wrapUpDuration;
|
|
13931
13997
|
}
|
|
@@ -14246,6 +14312,7 @@ const Wazo = {
|
|
|
14246
14312
|
CanceledCallError,
|
|
14247
14313
|
SFUNotAvailableError,
|
|
14248
14314
|
NoTenantIdError,
|
|
14315
|
+
NoDomainNameError,
|
|
14249
14316
|
};
|
|
14250
14317
|
|
|
14251
14318
|
if (window) {
|
package/esm/simple/Softphone.js
CHANGED
|
@@ -107,6 +107,7 @@ class Softphone {
|
|
|
107
107
|
wrapUpDuration,
|
|
108
108
|
enableAgent = true,
|
|
109
109
|
tenantId,
|
|
110
|
+
domainName,
|
|
110
111
|
debug = false,
|
|
111
112
|
} = {}) {
|
|
112
113
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -131,8 +132,12 @@ class Softphone {
|
|
|
131
132
|
config.port = port;
|
|
132
133
|
}
|
|
133
134
|
if (tenantId) {
|
|
135
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
134
136
|
config.tenantId = tenantId;
|
|
135
137
|
}
|
|
138
|
+
if (domainName) {
|
|
139
|
+
config.domainName = domainName;
|
|
140
|
+
}
|
|
136
141
|
if (wrapUpDuration) {
|
|
137
142
|
config.wrapUpDuration = wrapUpDuration;
|
|
138
143
|
}
|
package/esm/simple/index.js
CHANGED
|
@@ -2229,6 +2229,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2229
2229
|
|
|
2230
2230
|
|
|
2231
2231
|
|
|
2232
|
+
|
|
2232
2233
|
) {
|
|
2233
2234
|
const body = {
|
|
2234
2235
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2249,9 +2250,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2249
2250
|
}
|
|
2250
2251
|
|
|
2251
2252
|
if (params.tenantId) {
|
|
2253
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2252
2254
|
body.tenant_id = params.tenantId;
|
|
2253
2255
|
}
|
|
2254
2256
|
|
|
2257
|
+
if (params.domainName) {
|
|
2258
|
+
body.domain_name = params.domainName;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2255
2261
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2256
2262
|
},
|
|
2257
2263
|
|
|
@@ -2264,6 +2270,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2264
2270
|
expiration ,
|
|
2265
2271
|
isMobile = false,
|
|
2266
2272
|
tenantId ,
|
|
2273
|
+
domainName ,
|
|
2267
2274
|
) => {
|
|
2268
2275
|
const body = {
|
|
2269
2276
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2273,9 +2280,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2273
2280
|
};
|
|
2274
2281
|
|
|
2275
2282
|
if (tenantId) {
|
|
2283
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2276
2284
|
body.tenant_id = tenantId;
|
|
2277
2285
|
}
|
|
2278
2286
|
|
|
2287
|
+
if (domainName) {
|
|
2288
|
+
body.domain_name = domainName;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2279
2291
|
const headers = {
|
|
2280
2292
|
'Content-Type': 'application/json',
|
|
2281
2293
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -5573,6 +5585,7 @@ class ApiClient {
|
|
|
5573
5585
|
|
|
5574
5586
|
|
|
5575
5587
|
|
|
5588
|
+
|
|
5576
5589
|
|
|
5577
5590
|
|
|
5578
5591
|
|
|
@@ -5614,6 +5627,7 @@ class ApiClient {
|
|
|
5614
5627
|
refreshToken: this.refreshToken,
|
|
5615
5628
|
refreshBackend: this.refreshBackend,
|
|
5616
5629
|
refreshTenantId: this.refreshTenantId,
|
|
5630
|
+
refreshDomainName: this.refreshDomainName,
|
|
5617
5631
|
refreshExpiration: this.refreshExpiration,
|
|
5618
5632
|
isMobile: this.isMobile,
|
|
5619
5633
|
});
|
|
@@ -5629,6 +5643,7 @@ class ApiClient {
|
|
|
5629
5643
|
this.refreshExpiration,
|
|
5630
5644
|
this.isMobile,
|
|
5631
5645
|
this.refreshTenantId,
|
|
5646
|
+
this.refreshDomainName,
|
|
5632
5647
|
);
|
|
5633
5648
|
|
|
5634
5649
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5682,9 +5697,14 @@ class ApiClient {
|
|
|
5682
5697
|
}
|
|
5683
5698
|
|
|
5684
5699
|
setRefreshTenantId(tenantId ) {
|
|
5700
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
5685
5701
|
this.refreshTenantId = tenantId;
|
|
5686
5702
|
}
|
|
5687
5703
|
|
|
5704
|
+
setRefreshDomainName(domainName ) {
|
|
5705
|
+
this.refreshDomainName = domainName;
|
|
5706
|
+
}
|
|
5707
|
+
|
|
5688
5708
|
setIsMobile(isMobile ) {
|
|
5689
5709
|
this.isMobile = isMobile;
|
|
5690
5710
|
}
|
|
@@ -5709,6 +5729,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
5709
5729
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
5710
5730
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
5711
5731
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
5732
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
5712
5733
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
5713
5734
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
5714
5735
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -5733,9 +5754,14 @@ const setRefreshToken = (newRefreshToken , forServer = null) =>
|
|
|
5733
5754
|
};
|
|
5734
5755
|
|
|
5735
5756
|
const setRefreshTenantId = (refreshTenantId , forServer = null) => {
|
|
5757
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
|
|
5736
5758
|
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
5737
5759
|
};
|
|
5738
5760
|
|
|
5761
|
+
const setRefreshDomainName = (refreshDomainName , forServer = null) => {
|
|
5762
|
+
global.wazoRefreshDomainName[forServer] = refreshDomainName;
|
|
5763
|
+
};
|
|
5764
|
+
|
|
5739
5765
|
const setOnRefreshToken = (onRefreshToken , forServer = null) => {
|
|
5740
5766
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
5741
5767
|
};
|
|
@@ -5754,6 +5780,7 @@ const setFetchOptions = (fetchOptions , forServer = null) => {
|
|
|
5754
5780
|
|
|
5755
5781
|
const fillClient = (apiClient ) => {
|
|
5756
5782
|
const { server, token, clientId } = apiClient.client;
|
|
5783
|
+
const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
|
|
5757
5784
|
|
|
5758
5785
|
// try with null server when dealing with non-related server info
|
|
5759
5786
|
apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
|
|
@@ -5762,8 +5789,12 @@ const fillClient = (apiClient ) => {
|
|
|
5762
5789
|
|
|
5763
5790
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
5764
5791
|
|
|
5765
|
-
|
|
5766
|
-
|
|
5792
|
+
if (tenantId) {
|
|
5793
|
+
apiClient.setRefreshTenantId(tenantId);
|
|
5794
|
+
}
|
|
5795
|
+
|
|
5796
|
+
apiClient.setRefreshDomainName(
|
|
5797
|
+
global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
|
|
5767
5798
|
);
|
|
5768
5799
|
|
|
5769
5800
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
@@ -5805,6 +5836,7 @@ var getApiClient = (forServer = null) => {
|
|
|
5805
5836
|
class InvalidSubscription extends Error {}
|
|
5806
5837
|
class InvalidAuthorization extends Error {}
|
|
5807
5838
|
class NoTenantIdError extends Error {}
|
|
5839
|
+
class NoDomainNameError extends Error {}
|
|
5808
5840
|
|
|
5809
5841
|
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5810
5842
|
|
|
@@ -5868,9 +5900,24 @@ class Auth {
|
|
|
5868
5900
|
setFetchOptions(options);
|
|
5869
5901
|
}
|
|
5870
5902
|
|
|
5871
|
-
async logIn(username , password , backend ,
|
|
5872
|
-
|
|
5873
|
-
|
|
5903
|
+
async logIn(username , password , backend , extra ) {
|
|
5904
|
+
let tenantId = null;
|
|
5905
|
+
let domainName = null;
|
|
5906
|
+
if (typeof extra === 'string') {
|
|
5907
|
+
tenantId = extra;
|
|
5908
|
+
}
|
|
5909
|
+
if (extra && typeof extra === 'object') {
|
|
5910
|
+
domainName = extra.domainName;
|
|
5911
|
+
}
|
|
5912
|
+
|
|
5913
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
|
|
5914
|
+
if (!tenantId) {
|
|
5915
|
+
throw new NoTenantIdError('No tenant id');
|
|
5916
|
+
}
|
|
5917
|
+
|
|
5918
|
+
if (!domainName) {
|
|
5919
|
+
throw new NoDomainNameError('No domain name');
|
|
5920
|
+
}
|
|
5874
5921
|
}
|
|
5875
5922
|
|
|
5876
5923
|
this.authenticated = false;
|
|
@@ -5880,6 +5927,7 @@ class Auth {
|
|
|
5880
5927
|
password,
|
|
5881
5928
|
backend,
|
|
5882
5929
|
tenantId,
|
|
5930
|
+
domainName,
|
|
5883
5931
|
expiration: this.expiration,
|
|
5884
5932
|
mobile: this.mobile,
|
|
5885
5933
|
});
|
|
@@ -5888,7 +5936,13 @@ class Auth {
|
|
|
5888
5936
|
getApiClient().setRefreshBackend(backend);
|
|
5889
5937
|
}
|
|
5890
5938
|
|
|
5891
|
-
|
|
5939
|
+
if (tenantId) {
|
|
5940
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5941
|
+
}
|
|
5942
|
+
|
|
5943
|
+
if (domainName) {
|
|
5944
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
5945
|
+
}
|
|
5892
5946
|
|
|
5893
5947
|
return this._onAuthenticated(rawSession);
|
|
5894
5948
|
}
|
|
@@ -5987,11 +6041,18 @@ class Auth {
|
|
|
5987
6041
|
}
|
|
5988
6042
|
|
|
5989
6043
|
setRefreshTenantId(refreshTenantId ) {
|
|
6044
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
|
|
5990
6045
|
setRefreshTenantId(refreshTenantId);
|
|
5991
6046
|
|
|
5992
6047
|
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
5993
6048
|
}
|
|
5994
6049
|
|
|
6050
|
+
setRefreshDomainName(domainName ) {
|
|
6051
|
+
setRefreshDomainName(domainName);
|
|
6052
|
+
|
|
6053
|
+
getApiClient().setRefreshDomainName(domainName);
|
|
6054
|
+
}
|
|
6055
|
+
|
|
5995
6056
|
forceRefreshToken() {
|
|
5996
6057
|
getApiClient().forceRefreshToken();
|
|
5997
6058
|
}
|
|
@@ -14310,6 +14371,7 @@ class Softphone {
|
|
|
14310
14371
|
wrapUpDuration,
|
|
14311
14372
|
enableAgent = true,
|
|
14312
14373
|
tenantId,
|
|
14374
|
+
domainName,
|
|
14313
14375
|
debug = false,
|
|
14314
14376
|
} = {}) {
|
|
14315
14377
|
this.url = url || 'https://softphone.wazo.io';
|
|
@@ -14334,8 +14396,12 @@ class Softphone {
|
|
|
14334
14396
|
config.port = port;
|
|
14335
14397
|
}
|
|
14336
14398
|
if (tenantId) {
|
|
14399
|
+
console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
|
|
14337
14400
|
config.tenantId = tenantId;
|
|
14338
14401
|
}
|
|
14402
|
+
if (domainName) {
|
|
14403
|
+
config.domainName = domainName;
|
|
14404
|
+
}
|
|
14339
14405
|
if (wrapUpDuration) {
|
|
14340
14406
|
config.wrapUpDuration = wrapUpDuration;
|
|
14341
14407
|
}
|
|
@@ -14656,6 +14722,7 @@ const Wazo = {
|
|
|
14656
14722
|
CanceledCallError,
|
|
14657
14723
|
SFUNotAvailableError,
|
|
14658
14724
|
NoTenantIdError,
|
|
14725
|
+
NoDomainNameError,
|
|
14659
14726
|
};
|
|
14660
14727
|
|
|
14661
14728
|
if (window) {
|