@wazo/sdk 0.43.0-rc.1 → 0.43.1

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.
Files changed (59) hide show
  1. package/README.md +32 -21
  2. package/dist/wazo-sdk.js +11 -11
  3. package/esm/__tests__/api-client.test.js +19 -0
  4. package/esm/api/auth.js +6 -0
  5. package/esm/domain/Incall.js +28 -0
  6. package/esm/domain/Profile.js +5 -1
  7. package/esm/domain/__tests__/Profile.test.js +32 -0
  8. package/esm/index.js +2 -0
  9. package/esm/simple/Auth.js +4 -0
  10. package/esm/types/api/auth.d.ts +1 -0
  11. package/esm/types/api/auth.d.ts.map +1 -1
  12. package/esm/types/domain/Incall.d.ts +21 -0
  13. package/esm/types/domain/Incall.d.ts.map +1 -0
  14. package/esm/types/domain/Line.d.ts +5 -16
  15. package/esm/types/domain/Line.d.ts.map +1 -1
  16. package/esm/types/domain/Phone/Phone.d.ts +1 -1
  17. package/esm/types/domain/Phone/Phone.d.ts.map +1 -1
  18. package/esm/types/domain/Profile.d.ts +5 -1
  19. package/esm/types/domain/Profile.d.ts.map +1 -1
  20. package/esm/types/domain/types.d.ts +14 -13
  21. package/esm/types/domain/types.d.ts.map +1 -1
  22. package/esm/types/index.d.ts +2 -0
  23. package/esm/types/index.d.ts.map +1 -1
  24. package/esm/types/simple/Auth.d.ts +1 -0
  25. package/esm/types/simple/Auth.d.ts.map +1 -1
  26. package/lib/__tests__/api-client.test.js +19 -0
  27. package/lib/api/auth.js +15 -0
  28. package/lib/domain/Incall.js +32 -0
  29. package/lib/domain/Profile.js +4 -1
  30. package/lib/domain/__tests__/Profile.test.js +32 -0
  31. package/lib/index.js +5 -2
  32. package/lib/simple/Auth.js +6 -0
  33. package/lib/types/api/auth.d.ts +1 -0
  34. package/lib/types/api/auth.d.ts.map +1 -1
  35. package/lib/types/domain/Incall.d.ts +21 -0
  36. package/lib/types/domain/Incall.d.ts.map +1 -0
  37. package/lib/types/domain/Line.d.ts +5 -16
  38. package/lib/types/domain/Line.d.ts.map +1 -1
  39. package/lib/types/domain/Phone/Phone.d.ts +1 -1
  40. package/lib/types/domain/Phone/Phone.d.ts.map +1 -1
  41. package/lib/types/domain/Profile.d.ts +5 -1
  42. package/lib/types/domain/Profile.d.ts.map +1 -1
  43. package/lib/types/domain/types.d.ts +14 -13
  44. package/lib/types/domain/types.d.ts.map +1 -1
  45. package/lib/types/index.d.ts +2 -0
  46. package/lib/types/index.d.ts.map +1 -1
  47. package/lib/types/simple/Auth.d.ts +1 -0
  48. package/lib/types/simple/Auth.d.ts.map +1 -1
  49. package/package.json +3 -2
  50. package/src/__tests__/api-client.test.ts +21 -0
  51. package/src/api/auth.ts +8 -0
  52. package/src/domain/Incall.ts +50 -0
  53. package/src/domain/Line.ts +5 -17
  54. package/src/domain/Phone/Phone.ts +1 -1
  55. package/src/domain/Profile.ts +8 -0
  56. package/src/domain/__tests__/Profile.test.ts +32 -0
  57. package/src/domain/types.ts +49 -38
  58. package/src/index.ts +2 -0
  59. package/src/simple/Auth.ts +5 -0
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 an user](#authenticating-an-user)
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
- - [Loggin out](#loggin-out)
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
- - [Unmerge a sessions from a conference](#terminating-a-conference)
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 to a phone call](#be-notified-to-a-phone-call)
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 heatbeat](#stopping-heatbeat)
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
- ### Authenticating an user
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
- #### Loggin out
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, or stops 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, your can access the `participant.isTalking` attribute to know the status.
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 remove a single participant from a conference.
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 stop sharing his screen.
593
+ Triggered when the participant stops sharing his screen.
583
594
 
584
595
  #### Stream
585
596
 
586
- `Wazo.Stream` helps attaching or detaching streams to html elements:
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 in order to refresh token.
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 http endpoint
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 continue to work with old version. **Please update your code**.)
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 to a phone call
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 heatbeat
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 time events (eg: receiving a chat message, a presential update ...)
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 webpack 5
1465
+ # Usage with Webpack 5
1455
1466
 
1456
- As webpack 5 dropped some polyfill, you have to add them:
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 webpack configuration with `react-app-rewired` :
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