您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

actions.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // @flow
  2. import {
  3. ADD_TRANSCRIPT_MESSAGE,
  4. ENDPOINT_MESSAGE_RECEIVED,
  5. REMOVE_TRANSCRIPT_MESSAGE,
  6. UPDATE_TRANSCRIPT_MESSAGE
  7. } from './actionTypes';
  8. /**
  9. * Signals that a transcript with a new message_id is received.
  10. *
  11. * @param {string} transcriptMessageID - The new message_id.
  12. * @param {string} participantName - The participant name of the sender.
  13. * @returns {{
  14. * type: ADD_TRANSCRIPT_MESSAGE,
  15. * transcriptMessageID: string,
  16. * participantName: string
  17. * }}
  18. */
  19. export function addTranscriptMessage(transcriptMessageID: string,
  20. participantName: string) {
  21. return {
  22. type: ADD_TRANSCRIPT_MESSAGE,
  23. transcriptMessageID,
  24. participantName
  25. };
  26. }
  27. /**
  28. * Signals that a participant sent an endpoint message on the data channel.
  29. *
  30. * @param {Object} participant - The participant details sending the message.
  31. * @param {Object} json - The json carried by the endpoint message.
  32. * @returns {{
  33. * type: ENDPOINT_MESSAGE_RECEIVED,
  34. * participant: Object,
  35. * json: Object
  36. * }}
  37. */
  38. export function endpointMessageReceived(participant: Object, json: Object) {
  39. return {
  40. type: ENDPOINT_MESSAGE_RECEIVED,
  41. participant,
  42. json
  43. };
  44. }
  45. /**
  46. * Signals that a transcript has to be removed from the state.
  47. *
  48. * @param {string} transcriptMessageID - The message_id to be removed.
  49. * @returns {{
  50. * type: REMOVE_TRANSCRIPT_MESSAGE,
  51. * transcriptMessageID: string,
  52. * }}
  53. */
  54. export function removeTranscriptMessage(transcriptMessageID: string) {
  55. return {
  56. type: REMOVE_TRANSCRIPT_MESSAGE,
  57. transcriptMessageID
  58. };
  59. }
  60. /**
  61. * Signals that a transcript with an existing message_id to be updated
  62. * is received.
  63. *
  64. * @param {string} transcriptMessageID -The transcript message_id to be updated.
  65. * @param {Object} newTranscriptMessage - The updated transcript message.
  66. * @returns {{
  67. * type: UPDATE_TRANSCRIPT_MESSAGE,
  68. * transcriptMessageID: string,
  69. * newTranscriptMessage: Object
  70. * }}
  71. */
  72. export function updateTranscriptMessage(transcriptMessageID: string,
  73. newTranscriptMessage: Object) {
  74. return {
  75. type: UPDATE_TRANSCRIPT_MESSAGE,
  76. transcriptMessageID,
  77. newTranscriptMessage
  78. };
  79. }