@wazo/sdk 0.42.0 → 0.43.0
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/README.md +32 -21
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +19 -0
- package/esm/__tests__/web-rtc-client.test.js +1 -1
- package/esm/api/auth.js +6 -0
- package/esm/domain/Incall.js +28 -0
- package/esm/domain/Phone/CTIPhone.js +1 -1
- package/esm/domain/Phone/WebRTCPhone.js +4 -4
- package/esm/domain/Profile.js +5 -1
- package/esm/domain/__tests__/Profile.test.js +32 -0
- package/esm/index.js +1 -0
- package/esm/simple/Auth.js +4 -0
- package/esm/simple/Phone.js +1 -1
- package/esm/simple/room/Room.js +2 -2
- package/esm/types/api/auth.d.ts +1 -0
- package/esm/types/api/auth.d.ts.map +1 -1
- package/esm/types/domain/Incall.d.ts +21 -0
- package/esm/types/domain/Incall.d.ts.map +1 -0
- package/esm/types/domain/Line.d.ts +5 -16
- package/esm/types/domain/Line.d.ts.map +1 -1
- package/esm/types/domain/Phone/CTIPhone.d.ts +1 -1
- package/esm/types/domain/Phone/Phone.d.ts +1 -1
- package/esm/types/domain/Phone/Phone.d.ts.map +1 -1
- package/esm/types/domain/Phone/WebRTCPhone.d.ts +2 -2
- package/esm/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/esm/types/domain/Profile.d.ts +5 -1
- package/esm/types/domain/Profile.d.ts.map +1 -1
- package/esm/types/domain/types.d.ts +17 -19
- package/esm/types/domain/types.d.ts.map +1 -1
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.d.ts.map +1 -1
- package/esm/types/simple/Auth.d.ts +1 -0
- package/esm/types/simple/Auth.d.ts.map +1 -1
- package/esm/types/simple/Phone.d.ts +3 -3
- package/esm/types/simple/Phone.d.ts.map +1 -1
- package/esm/types/web-rtc-client.d.ts +8 -10
- package/esm/types/web-rtc-client.d.ts.map +1 -1
- package/esm/web-rtc-client.js +18 -24
- package/lib/__tests__/api-client.test.js +19 -0
- package/lib/__tests__/web-rtc-client.test.js +1 -1
- package/lib/api/auth.js +15 -0
- package/lib/domain/Incall.js +32 -0
- package/lib/domain/Phone/CTIPhone.js +1 -1
- package/lib/domain/Phone/WebRTCPhone.js +9 -7
- package/lib/domain/Profile.js +4 -1
- package/lib/domain/__tests__/Profile.test.js +32 -0
- package/lib/index.js +4 -2
- package/lib/simple/Auth.js +6 -0
- package/lib/simple/Phone.js +1 -1
- package/lib/simple/room/Room.js +5 -5
- package/lib/types/api/auth.d.ts +1 -0
- package/lib/types/api/auth.d.ts.map +1 -1
- package/lib/types/domain/Incall.d.ts +21 -0
- package/lib/types/domain/Incall.d.ts.map +1 -0
- package/lib/types/domain/Line.d.ts +5 -16
- package/lib/types/domain/Line.d.ts.map +1 -1
- package/lib/types/domain/Phone/CTIPhone.d.ts +1 -1
- package/lib/types/domain/Phone/Phone.d.ts +1 -1
- package/lib/types/domain/Phone/Phone.d.ts.map +1 -1
- package/lib/types/domain/Phone/WebRTCPhone.d.ts +2 -2
- package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/lib/types/domain/Profile.d.ts +5 -1
- package/lib/types/domain/Profile.d.ts.map +1 -1
- package/lib/types/domain/types.d.ts +17 -19
- package/lib/types/domain/types.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/simple/Auth.d.ts +1 -0
- package/lib/types/simple/Auth.d.ts.map +1 -1
- package/lib/types/simple/Phone.d.ts +3 -3
- package/lib/types/simple/Phone.d.ts.map +1 -1
- package/lib/types/web-rtc-client.d.ts +8 -10
- package/lib/types/web-rtc-client.d.ts.map +1 -1
- package/lib/web-rtc-client.js +147 -141
- package/package.json +3 -2
- package/src/__tests__/api-client.test.ts +21 -0
- package/src/__tests__/web-rtc-client.test.ts +1 -1
- package/src/api/auth.ts +8 -0
- package/src/domain/Incall.ts +50 -0
- package/src/domain/Line.ts +5 -17
- package/src/domain/Phone/CTIPhone.ts +1 -1
- package/src/domain/Phone/Phone.ts +1 -1
- package/src/domain/Phone/WebRTCPhone.ts +4 -4
- package/src/domain/Profile.ts +8 -0
- package/src/domain/__tests__/Profile.test.ts +32 -0
- package/src/domain/types.ts +52 -44
- package/src/index.ts +1 -0
- package/src/simple/Auth.ts +5 -0
- package/src/simple/Phone.ts +4 -4
- package/src/simple/room/Room.ts +2 -2
- package/src/web-rtc-client.ts +20 -26
package/README.md
CHANGED
|
@@ -30,10 +30,11 @@ Wazo's Javascript SDK allows you to use these features :
|
|
|
30
30
|
+ [Authentication with the simple API](#authentication-with-the-simple-api)
|
|
31
31
|
- [Initializing](#initializing)
|
|
32
32
|
- [Setting the engine host](#setting-the-engine-host)
|
|
33
|
-
- [Authenticating
|
|
33
|
+
- [Authenticating a user](#authenticating-a-user)
|
|
34
|
+
- [Authenticating a user with SAML](#authenticating-a-user-with-SAML)
|
|
34
35
|
- [Validating a token](#validating-a-token)
|
|
35
36
|
- [Setting a callback when a new token is refreshed](#setting-a-callback-when-a-new-token-is-refreshed)
|
|
36
|
-
- [
|
|
37
|
+
- [Logging out](#logging-out)
|
|
37
38
|
+ [Conference](#conference)
|
|
38
39
|
- [Joining a room](#joining-a-room)
|
|
39
40
|
- [Sending a chat message in the room](#sending-a-chat-message-in-the-room)
|
|
@@ -51,7 +52,7 @@ Wazo's Javascript SDK allows you to use these features :
|
|
|
51
52
|
- [Merging sessions in one conference](#merging-sessions-in-one-conference)
|
|
52
53
|
- [Add a session to a conference](#add-a-call-to-a-conference)
|
|
53
54
|
- [Remove a session from a conference](#remove-a-call-from-a-conference)
|
|
54
|
-
- [
|
|
55
|
+
- [Terminating a conference](#terminating-a-conference)
|
|
55
56
|
+ [Accessing the current WebRtc phone](#accessing-the-current-webrtc-phone)
|
|
56
57
|
+ [Domains](#domains)
|
|
57
58
|
- [Participant](#participant)
|
|
@@ -87,7 +88,7 @@ Wazo's Javascript SDK allows you to use these features :
|
|
|
87
88
|
- [WebRTCClient Configuration](#webrtcclient-configuration)
|
|
88
89
|
- [Basic client features](#basic-client-features)
|
|
89
90
|
- [Calling a number](#calling-a-number)
|
|
90
|
-
- [Be notified
|
|
91
|
+
- [Be notified of a phone call](#be-notified-of-a-phone-call)
|
|
91
92
|
- [Answering a call](#answering-a-call)
|
|
92
93
|
- [Hangup a call](#hangup-a-call)
|
|
93
94
|
- [Rejecting a call](#rejecting-a-call)
|
|
@@ -138,7 +139,7 @@ Wazo's Javascript SDK allows you to use these features :
|
|
|
138
139
|
- [Sending a SIP message](#sending-a-sip-message)
|
|
139
140
|
- [Closing the phone](#closing-the-phone)
|
|
140
141
|
- [Starting heartbeat](#starting-heartbeat)
|
|
141
|
-
- [Stopping
|
|
142
|
+
- [Stopping heartbeat](#stopping-heartbeat)
|
|
142
143
|
+ [WebSocketClient](#wazo-websocket)
|
|
143
144
|
- [Web Socket features](#web-socket-features)
|
|
144
145
|
- [Opening the socket](#opening-the-socket)
|
|
@@ -223,7 +224,7 @@ Wazo.Auth.fetchOptions({
|
|
|
223
224
|
- `options`: Object
|
|
224
225
|
- Options passed to all the `fetch` requests of the SDK.
|
|
225
226
|
|
|
226
|
-
|
|
227
|
+
#### Authenticating a user
|
|
227
228
|
```js
|
|
228
229
|
const session = await Wazo.Auth.logIn(username, password, backend, tenantId);
|
|
229
230
|
```
|
|
@@ -244,6 +245,16 @@ Returns as `Wazo.domain.Session`. This object contains, among other information,
|
|
|
244
245
|
|
|
245
246
|
Note: you need to set `clientId` in your WazoAPIClient in order to get a refresh token in the returned `Session`.
|
|
246
247
|
|
|
248
|
+
#### Authenticating a user with SAML
|
|
249
|
+
```js
|
|
250
|
+
const session = await Wazo.Auth.samlLogIn(samlSessionId);
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
- `samlSessionId`: string
|
|
254
|
+
- samlSessionId generated by wazo-auth
|
|
255
|
+
|
|
256
|
+
Returns as `Wazo.domain.Session`. This object contains, among other information, the user's token.
|
|
257
|
+
|
|
247
258
|
#### Validating a token
|
|
248
259
|
|
|
249
260
|
```js
|
|
@@ -272,7 +283,7 @@ Wazo.Auth.setOnRefreshToken(token => { /* Do something with the new token */ });
|
|
|
272
283
|
- `callback`: Function(token: string)
|
|
273
284
|
- A function that is triggered when the user's token will soon expire.
|
|
274
285
|
|
|
275
|
-
####
|
|
286
|
+
#### Logging out
|
|
276
287
|
|
|
277
288
|
Destroys user's token and refreshToken.
|
|
278
289
|
|
|
@@ -427,11 +438,11 @@ Triggered when screensharing is stopped.
|
|
|
427
438
|
room.on(room.ON_TALKING, (channel, participant) => {});
|
|
428
439
|
```
|
|
429
440
|
|
|
430
|
-
Triggered when a participant is talking
|
|
441
|
+
Triggered when a participant is talking or stops talking.
|
|
431
442
|
|
|
432
443
|
- `channel`: Object containing information about the event.
|
|
433
444
|
- `participant`: `Wazo.RemoteParticipant` or `Wazo.LocalParticipant`.
|
|
434
|
-
The participant instance,
|
|
445
|
+
The participant instance, you can access the `participant.isTalking` attribute to know the status.
|
|
435
446
|
|
|
436
447
|
### Ad hoc Conference features
|
|
437
448
|
**`Voice`** **`Video`**
|
|
@@ -456,7 +467,7 @@ adHocConference.removeParticipant(callSession: CallSession);
|
|
|
456
467
|
```
|
|
457
468
|
|
|
458
469
|
#### Terminating a conference
|
|
459
|
-
Use this method to
|
|
470
|
+
Use this method to terminate a conference.
|
|
460
471
|
```js
|
|
461
472
|
adHocConference.hangup();
|
|
462
473
|
```
|
|
@@ -579,11 +590,11 @@ Triggered when the participant is sharing his screen.
|
|
|
579
590
|
participant.on(participant.ON_STOP_SCREENSHARING, () => {});
|
|
580
591
|
```
|
|
581
592
|
|
|
582
|
-
Triggered when the participant
|
|
593
|
+
Triggered when the participant stops sharing his screen.
|
|
583
594
|
|
|
584
595
|
#### Stream
|
|
585
596
|
|
|
586
|
-
`Wazo.Stream` helps
|
|
597
|
+
`Wazo.Stream` helps attach or detach streams to HTML elements:
|
|
587
598
|
|
|
588
599
|
`stream.attach(htmlEmelent)`
|
|
589
600
|
|
|
@@ -704,7 +715,7 @@ client.setOnRefreshToken((newToken, newSession) => {
|
|
|
704
715
|
});
|
|
705
716
|
```
|
|
706
717
|
|
|
707
|
-
Note: you need to set `clientId` in your WazoAPIClient
|
|
718
|
+
Note: you need to set `clientId` in your WazoAPIClient to refresh a token.
|
|
708
719
|
|
|
709
720
|
#### Log Out
|
|
710
721
|
**`Voice`** **`Video`** **`Chat`** **`Fax`** **`Status`** **`Config`** **`Misc`**
|
|
@@ -741,7 +752,7 @@ client.auth.createPolicy(name, description, acl);
|
|
|
741
752
|
client.auth.listPolicies();
|
|
742
753
|
```
|
|
743
754
|
|
|
744
|
-
### Sending logs to fluentd via a
|
|
755
|
+
### Sending logs to fluentd via a HTTP endpoint
|
|
745
756
|
|
|
746
757
|
#### Logger
|
|
747
758
|
**`Log`**
|
|
@@ -793,7 +804,7 @@ client.application.playCall(applicationUuid, callId, language, uri); // play a s
|
|
|
793
804
|
**`Voice`** **`Video`** **`Chat`** **`Fax`** **`Status`**
|
|
794
805
|
|
|
795
806
|
Use Calld to directly control interactions.
|
|
796
|
-
(Please note, ctidNg endpoint is deprecated but
|
|
807
|
+
(Please note, ctidNg endpoint is deprecated but continues to work with old versions. **Please update your code**.)
|
|
797
808
|
|
|
798
809
|
```js
|
|
799
810
|
client.calld.getConferenceParticipantsAsUser(conferenceId); // List participants of a conference the user is part of
|
|
@@ -996,7 +1007,7 @@ Use this method to dial a number.
|
|
|
996
1007
|
client.call(number: string);
|
|
997
1008
|
```
|
|
998
1009
|
|
|
999
|
-
##### Be notified
|
|
1010
|
+
##### Be notified of a phone call
|
|
1000
1011
|
Use this method to be notified of an incoming call.
|
|
1001
1012
|
```js
|
|
1002
1013
|
client.on('invite', (sipSession: SipSession) => {
|
|
@@ -1390,14 +1401,14 @@ See webrtcClient's `heartbeatDelay`, `heartbeatTimeout`, `maxHeartbeats`, [confi
|
|
|
1390
1401
|
phone.startHeartbeat();
|
|
1391
1402
|
```
|
|
1392
1403
|
|
|
1393
|
-
##### Stopping
|
|
1404
|
+
##### Stopping heartbeat
|
|
1394
1405
|
|
|
1395
1406
|
```js
|
|
1396
1407
|
phone.stopHeartbeat();
|
|
1397
1408
|
```
|
|
1398
1409
|
|
|
1399
1410
|
### Wazo WebSocket
|
|
1400
|
-
You can use the Wazo WebSocket to listen for real
|
|
1411
|
+
You can use the Wazo WebSocket to listen for real-time events (eg: receiving a chat message, a presential update...)
|
|
1401
1412
|
|
|
1402
1413
|
#### Web Socket features
|
|
1403
1414
|
**`Voice`** **`Video`** **`Chat`** **`Fax`** **`Status`**
|
|
@@ -1451,15 +1462,15 @@ ws.close();
|
|
|
1451
1462
|
```
|
|
1452
1463
|
|
|
1453
1464
|
|
|
1454
|
-
# Usage with
|
|
1465
|
+
# Usage with Webpack 5
|
|
1455
1466
|
|
|
1456
|
-
As
|
|
1467
|
+
As Webpack 5 dropped some polyfills, you have to add them manually:
|
|
1457
1468
|
|
|
1458
1469
|
```sh
|
|
1459
1470
|
yarn add -D assert buffer https-browserify url stream-http stream-browserify browserify-zlib process
|
|
1460
1471
|
```
|
|
1461
1472
|
|
|
1462
|
-
If you have used `create-react-app` to create your app, you can customize the
|
|
1473
|
+
If you have used `create-react-app` to create your app, you can customize the Webpack configuration with `react-app-rewired` :
|
|
1463
1474
|
|
|
1464
1475
|
```sh
|
|
1465
1476
|
yarn add -D react-app-rewired
|