@wazo/sdk 0.37.42 → 0.38.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 (109) hide show
  1. package/README.md +218 -0
  2. package/dist/wazo-sdk.js +5 -5
  3. package/esm/__tests__/api-client.test.js +12 -7
  4. package/esm/__tests__/web-rtc-client.test.js +17 -10
  5. package/esm/api/agentd.js +12 -7
  6. package/esm/api/amid.js +12 -7
  7. package/esm/api/application.js +12 -7
  8. package/esm/api/auth.js +12 -7
  9. package/esm/api/call-logd.js +12 -7
  10. package/esm/api/calld.js +12 -7
  11. package/esm/api/chatd.js +12 -7
  12. package/esm/api/confd.js +12 -7
  13. package/esm/api/ctid-ng.js +12 -7
  14. package/esm/api/dird.js +12 -7
  15. package/esm/api/webhookd.js +12 -7
  16. package/esm/api-client.js +12 -7
  17. package/esm/checker/Checker.js +18 -11
  18. package/esm/checker/checks/aor.js +12 -7
  19. package/esm/checker/checks/api.js +12 -7
  20. package/esm/checker/checks/index.js +18 -11
  21. package/esm/checker/checks/wazo-websocket.js +13 -8
  22. package/esm/checker/checks/webrtc-transport.js +17 -10
  23. package/esm/checker/checks/webrtc.js +17 -10
  24. package/esm/domain/AdHocAPIConference.js +12 -7
  25. package/esm/domain/Features.js +12 -7
  26. package/esm/domain/Phone/CTIPhone.js +12 -7
  27. package/esm/domain/Phone/WebRTCPhone.js +12 -7
  28. package/esm/index.js +347 -11
  29. package/esm/lib/WazoSessionDescriptionHandler.js +12 -7
  30. package/esm/service/CallApi.js +12 -7
  31. package/esm/service/IssueReporter.js +12 -7
  32. package/esm/service/__tests__/IssueReporter.test.js +18 -7
  33. package/esm/service/getApiClient.js +12 -7
  34. package/esm/simple/Auth.js +347 -11
  35. package/esm/simple/Configuration.js +347 -11
  36. package/esm/simple/Directory.js +12 -7
  37. package/esm/simple/Phone.js +347 -11
  38. package/esm/simple/Softphone.js +329 -0
  39. package/esm/simple/Websocket.js +13 -8
  40. package/esm/simple/index.js +347 -11
  41. package/esm/simple/room/LocalParticipant.js +347 -11
  42. package/esm/simple/room/Participant.js +347 -11
  43. package/esm/simple/room/RemoteParticipant.js +347 -11
  44. package/esm/simple/room/Room.js +347 -11
  45. package/esm/simple/room/SipRoom.js +347 -11
  46. package/esm/simple/room/Stream.js +347 -11
  47. package/esm/simple/room/__tests__/RemoteParticipant.test.js +347 -11
  48. package/esm/simple/utils.js +347 -11
  49. package/esm/utils/__tests__/api-requester.test.js +12 -7
  50. package/esm/utils/api-requester.js +12 -7
  51. package/esm/web-rtc-client.js +17 -10
  52. package/esm/websocket-client.js +13 -8
  53. package/lib/__tests__/api-client.test.js +12 -7
  54. package/lib/__tests__/web-rtc-client.test.js +17 -10
  55. package/lib/api/agentd.js +12 -7
  56. package/lib/api/amid.js +12 -7
  57. package/lib/api/application.js +12 -7
  58. package/lib/api/auth.js +12 -7
  59. package/lib/api/call-logd.js +12 -7
  60. package/lib/api/calld.js +12 -7
  61. package/lib/api/chatd.js +12 -7
  62. package/lib/api/confd.js +12 -7
  63. package/lib/api/ctid-ng.js +12 -7
  64. package/lib/api/dird.js +12 -7
  65. package/lib/api/webhookd.js +12 -7
  66. package/lib/api-client.js +12 -7
  67. package/lib/checker/Checker.js +18 -11
  68. package/lib/checker/checks/aor.js +12 -7
  69. package/lib/checker/checks/api.js +12 -7
  70. package/lib/checker/checks/index.js +18 -11
  71. package/lib/checker/checks/wazo-websocket.js +13 -8
  72. package/lib/checker/checks/webrtc-transport.js +17 -10
  73. package/lib/checker/checks/webrtc.js +17 -10
  74. package/lib/domain/AdHocAPIConference.js +12 -7
  75. package/lib/domain/Features.js +12 -7
  76. package/lib/domain/Phone/CTIPhone.js +12 -7
  77. package/lib/domain/Phone/WebRTCPhone.js +12 -7
  78. package/lib/index.js +347 -11
  79. package/lib/lib/WazoSessionDescriptionHandler.js +12 -7
  80. package/lib/service/CallApi.js +12 -7
  81. package/lib/service/IssueReporter.js +12 -7
  82. package/lib/service/__tests__/IssueReporter.test.js +18 -7
  83. package/lib/service/getApiClient.js +12 -7
  84. package/lib/simple/Auth.js +347 -11
  85. package/lib/simple/Configuration.js +347 -11
  86. package/lib/simple/Directory.js +12 -7
  87. package/lib/simple/Phone.js +347 -11
  88. package/lib/simple/Softphone.js +331 -0
  89. package/lib/simple/Websocket.js +13 -8
  90. package/lib/simple/index.js +347 -11
  91. package/lib/simple/room/LocalParticipant.js +347 -11
  92. package/lib/simple/room/Participant.js +347 -11
  93. package/lib/simple/room/RemoteParticipant.js +347 -11
  94. package/lib/simple/room/Room.js +347 -11
  95. package/lib/simple/room/SipRoom.js +347 -11
  96. package/lib/simple/room/Stream.js +347 -11
  97. package/lib/simple/room/__tests__/RemoteParticipant.test.js +347 -11
  98. package/lib/simple/utils.js +347 -11
  99. package/lib/utils/__tests__/api-requester.test.js +12 -7
  100. package/lib/utils/api-requester.js +12 -7
  101. package/lib/web-rtc-client.js +17 -10
  102. package/lib/websocket-client.js +13 -8
  103. package/package.json +1 -1
  104. package/src/service/IssueReporter.js +12 -7
  105. package/src/service/__tests__/IssueReporter.test.js +6 -0
  106. package/src/simple/Softphone.js +327 -0
  107. package/src/simple/index.js +2 -0
  108. package/src/web-rtc-client.js +5 -3
  109. package/src/websocket-client.js +1 -1
package/README.md CHANGED
@@ -57,6 +57,7 @@ Wazo's Javascript SDK allows you to use these features :
57
57
  - [Participant](#participant)
58
58
  - [Participant events](#participant-events)
59
59
  - [Stream](#stream)
60
+ + [Softphone integration](#softphone-integration)
60
61
  * [Advanced API](#advanced-api)
61
62
  + [Libraries](#libraries)
62
63
  - [Require / Import](#require--import)
@@ -599,6 +600,223 @@ Detaches a stream from an existing htmlElement.
599
600
 
600
601
  - `htmlElement`: htmlElement.
601
602
 
603
+ ### Softphone integration
604
+
605
+ To be able to integrate Wazo softphone in any web page, you can add :
606
+
607
+ ```js
608
+ Wazo.Softphone.init({
609
+ url, // Url of the softphone to be loaded in the iframe (optional).
610
+ width, // Width (in px) of the softphone (optional).
611
+ height, // Height (in px) of the softphone (optional).
612
+ server, // Stack host where the softphone should connect user (optional).
613
+ port, // Stack port where the softphone should connect user (optional).
614
+ language, // Softphone language (optional).
615
+ wrapUpDuration, // How long (in seconds) should the softphone display the card after the call (optional).
616
+ // When the user changes anything on the card, this timeout is canceled
617
+ withCard, // boolean: ask the softphone to display a form during and after the call to log infornation (optional).
618
+ });
619
+ ```
620
+
621
+ #### Methods
622
+
623
+ ##### Making a call
624
+ ```js
625
+ Wazo.Softphone.makeCall(number);
626
+ ```
627
+ - `number`: Number to call through the softphone
628
+
629
+ ##### Showing / hidding the softphone
630
+ ```js
631
+ Wazo.Softphone.toggleSoftphoneDisplay();
632
+ Wazo.Softphone.displaySoftphone();
633
+ Wazo.Softphone.hideSoftphone();
634
+ ```
635
+
636
+ ##### Parsing links on the page
637
+ ```js
638
+ Wazo.Softphone.parseLinks();
639
+ ```
640
+
641
+ Each link with a `href="tel:"` or `href="callto:"` will make a call through the softphone.
642
+
643
+ #### Sending search results to the softphone:
644
+ ```js
645
+ Wazo.Softphone.onOptionsResults(fieldId, results);
646
+ ```
647
+
648
+ `onOptionsResults` is used to populate Autocomplete fields
649
+
650
+ #### Customizing card form
651
+
652
+ You can use [JSON schema](http://json-schema.org/) to customize the card form with `Softphone.setFormSchema(schema, uiSchema)` :
653
+
654
+ ```js
655
+ Softphone.setFormSchema({
656
+ type: 'object',
657
+ required: ['title', 'phone'],
658
+ properties: {
659
+ title: { type: 'string', title: 'Title' },
660
+ phone: { type: 'string', title: 'Phone' },
661
+ note: { type: 'string', title: 'Note' },
662
+ },
663
+ }, {
664
+ note: { 'ui:widget': 'textarea' },
665
+ });
666
+ ```
667
+
668
+ ##### Auto complete
669
+ We can use an `autocomplete` widget to search on fields in the `uiSchema`:
670
+
671
+ ```js
672
+ {
673
+ note :{ 'ui:widget': 'textarea'},
674
+ clientId :{ 'ui:field': 'autocomplete'},
675
+ };
676
+ ```
677
+
678
+ In the `schema` field, we can customize if we want to display a `+` button :
679
+ ```js
680
+ clientId: {
681
+ type: 'object',
682
+ title: 'Client id',
683
+ // triggers the `onDisplayLinkedOption` event when changing the value
684
+ triggerDisplay: true,
685
+ // createForm is another JSON schema the description the add option form.
686
+ createForm: {
687
+ optionLabel: '%firstname% %lastname%',
688
+ schema: {
689
+ type: 'object',
690
+ required: ['phone'],
691
+ properties: {
692
+ firstname: { type: 'string', title: 'Firstname' },
693
+ lastname: { type: 'string', title: 'Lastname' },
694
+ phone: { type: 'string', title: 'Phone' },
695
+ }
696
+ },
697
+ uiSchema: {}
698
+ },
699
+ }
700
+ ```
701
+
702
+ #### Callbacks
703
+
704
+ You can listen to softphone callback, with :
705
+
706
+ ```js
707
+ Wazo.Softphone.onLinkEnabled = link => {
708
+ // link is `<a>` html tag in the page with a href="tel:xx" (or callto:xxx) beeing processed
709
+ // You can make change here, like addind className, etc ...
710
+ };
711
+
712
+ Softphone.onCallIncoming = call => {
713
+ // Invoked when a call is incoming in the softphone
714
+ // You can make action here like redirecting to the contact page (by using `call.number).
715
+ };
716
+
717
+ Softphone.onCallEnded = (call, card, direction) => {
718
+ // Invoked when the call is ended
719
+ };
720
+
721
+ Softphone.onCardSaved = card => {
722
+ // Invoked when the user save the card at the end of the call
723
+ };
724
+
725
+ Softphone.onCallMade = call => {
726
+ // Invoked when an outgoing call is made
727
+ };
728
+
729
+ Softphone.onSearchOptions = (fieldId: string, query: string) => {
730
+ // Invoked when the user is making a search from an Autocomplete field in the card form
731
+ // We need to call `onOptionsResults` here to send results to the softphone
732
+ };
733
+
734
+ Softphone.onDisplayLinkedOption = (optionId: string) => {
735
+ // Invoked when the user is selecting a value in a Autocomplete widget
736
+ // useful to display this entity in your application
737
+ };
738
+
739
+ Softphone.onWazoContactSearch = (query: string) => {
740
+ // Invoked when the user is searching from contact page
741
+ };
742
+
743
+ Softphone.onAgentLoggedIn = () => {
744
+ // Invoked when the agent logs in
745
+ };
746
+
747
+ Softphone.onAgentLoggedOut = ) => {
748
+ // Invoked when the agent logs out
749
+ };
750
+
751
+ Softphone.onAgentPaused = () => {
752
+ // Invoked when the agent is paused
753
+ };
754
+
755
+ Softphone.onLanguageChanged = (language: string) => {
756
+ // Invoked when the user changed the softphone language
757
+ };
758
+
759
+ Softphone.onCallHeld = () => {
760
+ // Invoked when the current call is held
761
+ };
762
+
763
+ Softphone.onCallResumed = () => {
764
+ // Invoked when the current call is resumed
765
+ };
766
+
767
+ Softphone.onCallMuted = () => {
768
+ // Invoked when the current call is muted
769
+ };
770
+
771
+ Softphone.onCallUnMuted = () => {
772
+ // Invoked when the current call is un muted
773
+ };
774
+
775
+ Softphone.onDtmfSent = (tone: string) => {
776
+ // Invoked when the user is sending a DTMF in the current call
777
+ };
778
+
779
+ Softphone.onDirectTransfer = (number: string) => {
780
+ // Invoked when the user is transfers the current call directly
781
+ };
782
+
783
+ Softphone.onCreateIndirectTransfer = (number: string) => {
784
+ // Invoked when the user initiates an indirect transfer for the current call
785
+ };
786
+
787
+ Softphone.onCancelIndirectTransfer = () => {
788
+ // Invoked when the user cancels the current indirect transfer
789
+ };
790
+
791
+ Softphone.onConfirmIndirectTransfer = () => {
792
+ // Invoked when the user confirms the current indirect transfer
793
+ };
794
+
795
+ Softphone.onIndirectCallMade = (call: Object) => {
796
+ // Invoked when the current indirect transfer is made
797
+ };
798
+
799
+ Softphone.onIndirectTransferDone = (call: Object) => {
800
+ // Invoked when the current indirect transfer is over
801
+ };
802
+
803
+ Softphone.onStartRecording = () => {
804
+ // Invoked when the user records the current call
805
+ };
806
+
807
+ Softphone.onStopRecording = () => {
808
+ // Invoked when the user stops recording the current call
809
+ };
810
+
811
+ Softphone.onAuthenticated = session => {
812
+ // Invoked when the user is authenticated in the softphone
813
+ };
814
+
815
+ Softphone.onLoggedOut = session => {
816
+ // Invoked when the user is is logged out in the softphone
817
+ };
818
+ ```
819
+
602
820
  ## Advanced API
603
821
 
604
822
  ### Libraries