You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // @flow
  2. import {
  3. ENDPOINT_MESSAGE_RECEIVED,
  4. REMOVE_TRANSCRIPT_MESSAGE,
  5. UPDATE_TRANSCRIPT_MESSAGE
  6. } from './actionTypes';
  7. /**
  8. * Signals that a participant sent an endpoint message on the data channel.
  9. *
  10. * @param {Object} participant - The participant details sending the message.
  11. * @param {Object} json - The json carried by the endpoint message.
  12. * @returns {{
  13. * type: ENDPOINT_MESSAGE_RECEIVED,
  14. * participant: Object,
  15. * json: Object
  16. * }}
  17. */
  18. export function endpointMessageReceived(participant: Object, json: Object) {
  19. return {
  20. type: ENDPOINT_MESSAGE_RECEIVED,
  21. participant,
  22. json
  23. };
  24. }
  25. /**
  26. * Signals that a transcript has to be removed from the state.
  27. *
  28. * @param {string} transcriptMessageID - The message_id to be removed.
  29. * @returns {{
  30. * type: REMOVE_TRANSCRIPT_MESSAGE,
  31. * transcriptMessageID: string,
  32. * }}
  33. */
  34. export function removeTranscriptMessage(transcriptMessageID: string) {
  35. return {
  36. type: REMOVE_TRANSCRIPT_MESSAGE,
  37. transcriptMessageID
  38. };
  39. }
  40. /**
  41. * Signals that a transcript with the given message_id to be added or updated
  42. * is received.
  43. *
  44. * @param {string} transcriptMessageID -The transcript message_id to be updated.
  45. * @param {Object} newTranscriptMessage - The updated transcript message.
  46. * @returns {{
  47. * type: UPDATE_TRANSCRIPT_MESSAGE,
  48. * transcriptMessageID: string,
  49. * newTranscriptMessage: Object
  50. * }}
  51. */
  52. export function updateTranscriptMessage(transcriptMessageID: string,
  53. newTranscriptMessage: Object) {
  54. return {
  55. type: UPDATE_TRANSCRIPT_MESSAGE,
  56. transcriptMessageID,
  57. newTranscriptMessage
  58. };
  59. }