@100mslive/react-native-room-kit 1.0.7 → 1.0.9

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 (526) hide show
  1. package/lib/commonjs/HMSContainer.js +26 -5
  2. package/lib/commonjs/HMSContainer.js.map +1 -1
  3. package/lib/commonjs/HMSRoomSetup.js +6 -8
  4. package/lib/commonjs/HMSRoomSetup.js.map +1 -1
  5. package/lib/commonjs/Icons/Chat/assets/chat-on.png +0 -0
  6. package/lib/commonjs/Icons/Chat/assets/chat-on@2x.png +0 -0
  7. package/lib/commonjs/Icons/Chat/assets/chat-on@3x.png +0 -0
  8. package/lib/commonjs/Icons/Chat/index.js +4 -3
  9. package/lib/commonjs/Icons/Chat/index.js.map +1 -1
  10. package/lib/commonjs/Icons/NoEntry/assets/no-entry.png +0 -0
  11. package/lib/commonjs/Icons/NoEntry/assets/no-entry@2x.png +0 -0
  12. package/lib/commonjs/Icons/NoEntry/assets/no-entry@3x.png +0 -0
  13. package/lib/commonjs/Icons/NoEntry/index.js +33 -0
  14. package/lib/commonjs/Icons/NoEntry/index.js.map +1 -0
  15. package/lib/commonjs/Icons/PauseCircle/assets/pause-circle.png +0 -0
  16. package/lib/commonjs/Icons/PauseCircle/assets/pause-circle@2x.png +0 -0
  17. package/lib/commonjs/Icons/PauseCircle/assets/pause-circle@3x.png +0 -0
  18. package/lib/commonjs/Icons/PauseCircle/index.js +29 -0
  19. package/lib/commonjs/Icons/PauseCircle/index.js.map +1 -0
  20. package/lib/commonjs/Icons/Pin/assets/unpin.png +0 -0
  21. package/lib/commonjs/Icons/Pin/assets/unpin@2x.png +0 -0
  22. package/lib/commonjs/Icons/Pin/assets/unpin@3x.png +0 -0
  23. package/lib/commonjs/Icons/Pin/index.js +2 -1
  24. package/lib/commonjs/Icons/Pin/index.js.map +1 -1
  25. package/lib/commonjs/Icons/Recording/assets/recording-pause.png +0 -0
  26. package/lib/commonjs/Icons/Recording/assets/recording-pause@2x.png +0 -0
  27. package/lib/commonjs/Icons/Recording/assets/recording-pause@3x.png +0 -0
  28. package/lib/commonjs/Icons/Recording/index.js.map +1 -1
  29. package/lib/commonjs/Icons/index.js +22 -0
  30. package/lib/commonjs/Icons/index.js.map +1 -1
  31. package/lib/commonjs/components/BottomSheet.js.map +1 -1
  32. package/lib/commonjs/components/Chat/ChatFilterBottomSheet.js +36 -0
  33. package/lib/commonjs/components/Chat/ChatFilterBottomSheet.js.map +1 -0
  34. package/lib/commonjs/components/Chat/ChatFilterBottomSheetOpener.js +90 -23
  35. package/lib/commonjs/components/Chat/ChatFilterBottomSheetOpener.js.map +1 -1
  36. package/lib/commonjs/components/Chat/ChatFilterItem.js +10 -7
  37. package/lib/commonjs/components/Chat/ChatFilterItem.js.map +1 -1
  38. package/lib/commonjs/components/Chat/ChatFilterView.js +54 -45
  39. package/lib/commonjs/components/Chat/ChatFilterView.js.map +1 -1
  40. package/lib/commonjs/components/Chat/ChatList.js +13 -6
  41. package/lib/commonjs/components/Chat/ChatList.js.map +1 -1
  42. package/lib/commonjs/components/Chat/ChatMessage.js +79 -7
  43. package/lib/commonjs/components/Chat/ChatMessage.js.map +1 -1
  44. package/lib/commonjs/components/Chat/ChatMoreActionsModal.js +61 -0
  45. package/lib/commonjs/components/Chat/ChatMoreActionsModal.js.map +1 -0
  46. package/lib/commonjs/components/Chat/ChatMoreActionsSheetView.js +63 -0
  47. package/lib/commonjs/components/Chat/ChatMoreActionsSheetView.js.map +1 -0
  48. package/lib/commonjs/components/Chat/ChatMoreActionsView.js +83 -0
  49. package/lib/commonjs/components/Chat/ChatMoreActionsView.js.map +1 -0
  50. package/lib/commonjs/components/Chat/ChatPaused.js +86 -0
  51. package/lib/commonjs/components/Chat/ChatPaused.js.map +1 -0
  52. package/lib/commonjs/components/Chat/MessageOptionsBottomSheet.js +34 -0
  53. package/lib/commonjs/components/Chat/MessageOptionsBottomSheet.js.map +1 -0
  54. package/lib/commonjs/components/Chat/MessageOptionsBottomSheetView.js +66 -0
  55. package/lib/commonjs/components/Chat/MessageOptionsBottomSheetView.js.map +1 -0
  56. package/lib/commonjs/components/Chat/MessageOptionsView.js +188 -0
  57. package/lib/commonjs/components/Chat/MessageOptionsView.js.map +1 -0
  58. package/lib/commonjs/components/Chat/PeerBlockedFromChat.js +47 -0
  59. package/lib/commonjs/components/Chat/PeerBlockedFromChat.js.map +1 -0
  60. package/lib/commonjs/components/Chat/PinnedMessages.js +297 -0
  61. package/lib/commonjs/components/Chat/PinnedMessages.js.map +1 -0
  62. package/lib/commonjs/components/Chat/index.js +4 -4
  63. package/lib/commonjs/components/Chat/index.js.map +1 -1
  64. package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsBottomSheet.js.map +1 -1
  65. package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsHeader.js +21 -2
  66. package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsHeader.js.map +1 -1
  67. package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsView.js +3 -1
  68. package/lib/commonjs/components/ChatAndParticipants/ChatAndParticipantsView.js.map +1 -1
  69. package/lib/commonjs/components/ChatAndParticipants/ChatView.js +21 -2
  70. package/lib/commonjs/components/ChatAndParticipants/ChatView.js.map +1 -1
  71. package/lib/commonjs/components/EndRoomModalContent.js +6 -9
  72. package/lib/commonjs/components/EndRoomModalContent.js.map +1 -1
  73. package/lib/commonjs/components/Footer.js.map +1 -1
  74. package/lib/commonjs/components/GridView.js.map +1 -1
  75. package/lib/commonjs/components/HLSView.js +8 -6
  76. package/lib/commonjs/components/HLSView.js.map +1 -1
  77. package/lib/commonjs/components/HMSBaseButton.js +10 -2
  78. package/lib/commonjs/components/HMSBaseButton.js.map +1 -1
  79. package/lib/commonjs/components/HMSDangerButton.js +4 -2
  80. package/lib/commonjs/components/HMSDangerButton.js.map +1 -1
  81. package/lib/commonjs/components/HMSHLSMessage.js +86 -1
  82. package/lib/commonjs/components/HMSHLSMessage.js.map +1 -1
  83. package/lib/commonjs/components/HMSHLSMessageList.js +2 -2
  84. package/lib/commonjs/components/HMSHLSMessageList.js.map +1 -1
  85. package/lib/commonjs/components/HMSHandRaiseNotification.js +6 -3
  86. package/lib/commonjs/components/HMSHandRaiseNotification.js.map +1 -1
  87. package/lib/commonjs/components/HMSKeyboardAvoidingView.js +5 -1
  88. package/lib/commonjs/components/HMSKeyboardAvoidingView.js.map +1 -1
  89. package/lib/commonjs/components/HMSLiveIndicator.js +2 -6
  90. package/lib/commonjs/components/HMSLiveIndicator.js.map +1 -1
  91. package/lib/commonjs/components/HMSLiveViewerCount.js +8 -7
  92. package/lib/commonjs/components/HMSLiveViewerCount.js.map +1 -1
  93. package/lib/commonjs/components/HMSLocalScreenshareNotification.js +2 -1
  94. package/lib/commonjs/components/HMSLocalScreenshareNotification.js.map +1 -1
  95. package/lib/commonjs/components/HMSNotification.js +31 -4
  96. package/lib/commonjs/components/HMSNotification.js.map +1 -1
  97. package/lib/commonjs/components/HMSNotifications.js +9 -2
  98. package/lib/commonjs/components/HMSNotifications.js.map +1 -1
  99. package/lib/commonjs/components/HMSOverlayChatView.js +44 -2
  100. package/lib/commonjs/components/HMSOverlayChatView.js.map +1 -1
  101. package/lib/commonjs/components/HMSPreviewEditName.js.map +1 -1
  102. package/lib/commonjs/components/HMSPreviewHLSLiveIndicator.js +2 -6
  103. package/lib/commonjs/components/HMSPreviewHLSLiveIndicator.js.map +1 -1
  104. package/lib/commonjs/components/HMSPrimaryButton.js +4 -2
  105. package/lib/commonjs/components/HMSPrimaryButton.js.map +1 -1
  106. package/lib/commonjs/components/HMSRecordingIndicator.js +11 -16
  107. package/lib/commonjs/components/HMSRecordingIndicator.js.map +1 -1
  108. package/lib/commonjs/components/HMSRoomOptions.js.map +1 -1
  109. package/lib/commonjs/components/HMSTerminalErrorNotification.js +6 -2
  110. package/lib/commonjs/components/HMSTerminalErrorNotification.js.map +1 -1
  111. package/lib/commonjs/components/Header.js.map +1 -1
  112. package/lib/commonjs/components/LeaveRoomBottomSheet.js +3 -6
  113. package/lib/commonjs/components/LeaveRoomBottomSheet.js.map +1 -1
  114. package/lib/commonjs/components/Meeting.js +3 -0
  115. package/lib/commonjs/components/Meeting.js.map +1 -1
  116. package/lib/commonjs/components/MeetingScreenContent.js.map +1 -1
  117. package/lib/commonjs/components/Modals.js +9 -12
  118. package/lib/commonjs/components/Modals.js.map +1 -1
  119. package/lib/commonjs/components/Participants/ParticipantsItemOptions.js +5 -1
  120. package/lib/commonjs/components/Participants/ParticipantsItemOptions.js.map +1 -1
  121. package/lib/commonjs/components/PeerSettingsModalContent.js.map +1 -1
  122. package/lib/commonjs/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
  123. package/lib/commonjs/components/Preview.js +14 -1
  124. package/lib/commonjs/components/Preview.js.map +1 -1
  125. package/lib/commonjs/components/PreviewForRoleChangeModal.js +5 -4
  126. package/lib/commonjs/components/PreviewForRoleChangeModal.js.map +1 -1
  127. package/lib/commonjs/components/RoomSettingsModalContent.js +15 -6
  128. package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
  129. package/lib/commonjs/components/RoomSettingsModalDebugModeContent.js +2 -4
  130. package/lib/commonjs/components/RoomSettingsModalDebugModeContent.js.map +1 -1
  131. package/lib/commonjs/components/WebrtcView.js.map +1 -1
  132. package/lib/commonjs/hooks-sdk-selectors.js +16 -1
  133. package/lib/commonjs/hooks-sdk-selectors.js.map +1 -1
  134. package/lib/commonjs/hooks-sdk.js +27 -1
  135. package/lib/commonjs/hooks-sdk.js.map +1 -1
  136. package/lib/commonjs/hooks-util-selectors.js +3 -3
  137. package/lib/commonjs/hooks-util-selectors.js.map +1 -1
  138. package/lib/commonjs/hooks-util.js +410 -64
  139. package/lib/commonjs/hooks-util.js.map +1 -1
  140. package/lib/commonjs/redux/actionTypes.js +16 -3
  141. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  142. package/lib/commonjs/redux/actions/index.js +44 -4
  143. package/lib/commonjs/redux/actions/index.js.map +1 -1
  144. package/lib/commonjs/redux/reducers/appState.js +41 -1
  145. package/lib/commonjs/redux/reducers/appState.js.map +1 -1
  146. package/lib/commonjs/redux/reducers/chatWindow.js +1 -2
  147. package/lib/commonjs/redux/reducers/chatWindow.js.map +1 -1
  148. package/lib/commonjs/redux/reducers/hmsStates.js +21 -8
  149. package/lib/commonjs/redux/reducers/hmsStates.js.map +1 -1
  150. package/lib/commonjs/redux/reducers/message.js +17 -4
  151. package/lib/commonjs/redux/reducers/message.js.map +1 -1
  152. package/lib/commonjs/types.js +4 -2
  153. package/lib/commonjs/types.js.map +1 -1
  154. package/lib/commonjs/utils/types.js +3 -0
  155. package/lib/commonjs/utils/types.js.map +1 -1
  156. package/lib/commonjs/utils.js +2 -2
  157. package/lib/commonjs/utils.js.map +1 -1
  158. package/lib/module/HMSContainer.js +23 -3
  159. package/lib/module/HMSContainer.js.map +1 -1
  160. package/lib/module/HMSRoomSetup.js +7 -9
  161. package/lib/module/HMSRoomSetup.js.map +1 -1
  162. package/lib/module/Icons/Chat/assets/chat-on.png +0 -0
  163. package/lib/module/Icons/Chat/assets/chat-on@2x.png +0 -0
  164. package/lib/module/Icons/Chat/assets/chat-on@3x.png +0 -0
  165. package/lib/module/Icons/Chat/index.js +4 -3
  166. package/lib/module/Icons/Chat/index.js.map +1 -1
  167. package/lib/module/Icons/NoEntry/assets/no-entry.png +0 -0
  168. package/lib/module/Icons/NoEntry/assets/no-entry@2x.png +0 -0
  169. package/lib/module/Icons/NoEntry/assets/no-entry@3x.png +0 -0
  170. package/lib/module/Icons/NoEntry/index.js +25 -0
  171. package/lib/module/Icons/NoEntry/index.js.map +1 -0
  172. package/lib/module/Icons/PauseCircle/assets/pause-circle.png +0 -0
  173. package/lib/module/Icons/PauseCircle/assets/pause-circle@2x.png +0 -0
  174. package/lib/module/Icons/PauseCircle/assets/pause-circle@3x.png +0 -0
  175. package/lib/module/Icons/PauseCircle/index.js +21 -0
  176. package/lib/module/Icons/PauseCircle/index.js.map +1 -0
  177. package/lib/module/Icons/Pin/assets/unpin.png +0 -0
  178. package/lib/module/Icons/Pin/assets/unpin@2x.png +0 -0
  179. package/lib/module/Icons/Pin/assets/unpin@3x.png +0 -0
  180. package/lib/module/Icons/Pin/index.js +2 -1
  181. package/lib/module/Icons/Pin/index.js.map +1 -1
  182. package/lib/module/Icons/Recording/assets/recording-pause.png +0 -0
  183. package/lib/module/Icons/Recording/assets/recording-pause@2x.png +0 -0
  184. package/lib/module/Icons/Recording/assets/recording-pause@3x.png +0 -0
  185. package/lib/module/Icons/Recording/index.js.map +1 -1
  186. package/lib/module/Icons/index.js +2 -0
  187. package/lib/module/Icons/index.js.map +1 -1
  188. package/lib/module/components/BottomSheet.js.map +1 -1
  189. package/lib/module/components/Chat/ChatFilterBottomSheet.js +28 -0
  190. package/lib/module/components/Chat/ChatFilterBottomSheet.js.map +1 -0
  191. package/lib/module/components/Chat/ChatFilterBottomSheetOpener.js +93 -26
  192. package/lib/module/components/Chat/ChatFilterBottomSheetOpener.js.map +1 -1
  193. package/lib/module/components/Chat/ChatFilterItem.js +11 -8
  194. package/lib/module/components/Chat/ChatFilterItem.js.map +1 -1
  195. package/lib/module/components/Chat/ChatFilterView.js +55 -46
  196. package/lib/module/components/Chat/ChatFilterView.js.map +1 -1
  197. package/lib/module/components/Chat/ChatList.js +14 -7
  198. package/lib/module/components/Chat/ChatList.js.map +1 -1
  199. package/lib/module/components/Chat/ChatMessage.js +81 -9
  200. package/lib/module/components/Chat/ChatMessage.js.map +1 -1
  201. package/lib/module/components/Chat/ChatMoreActionsModal.js +53 -0
  202. package/lib/module/components/Chat/ChatMoreActionsModal.js.map +1 -0
  203. package/lib/module/components/Chat/ChatMoreActionsSheetView.js +55 -0
  204. package/lib/module/components/Chat/ChatMoreActionsSheetView.js.map +1 -0
  205. package/lib/module/components/Chat/ChatMoreActionsView.js +75 -0
  206. package/lib/module/components/Chat/ChatMoreActionsView.js.map +1 -0
  207. package/lib/module/components/Chat/ChatPaused.js +77 -0
  208. package/lib/module/components/Chat/ChatPaused.js.map +1 -0
  209. package/lib/module/components/Chat/MessageOptionsBottomSheet.js +26 -0
  210. package/lib/module/components/Chat/MessageOptionsBottomSheet.js.map +1 -0
  211. package/lib/module/components/Chat/MessageOptionsBottomSheetView.js +58 -0
  212. package/lib/module/components/Chat/MessageOptionsBottomSheetView.js.map +1 -0
  213. package/lib/module/components/Chat/MessageOptionsView.js +180 -0
  214. package/lib/module/components/Chat/MessageOptionsView.js.map +1 -0
  215. package/lib/module/components/Chat/PeerBlockedFromChat.js +38 -0
  216. package/lib/module/components/Chat/PeerBlockedFromChat.js.map +1 -0
  217. package/lib/module/components/Chat/PinnedMessages.js +288 -0
  218. package/lib/module/components/Chat/PinnedMessages.js.map +1 -0
  219. package/lib/module/components/Chat/index.js +1 -1
  220. package/lib/module/components/Chat/index.js.map +1 -1
  221. package/lib/module/components/ChatAndParticipants/ChatAndParticipantsBottomSheet.js.map +1 -1
  222. package/lib/module/components/ChatAndParticipants/ChatAndParticipantsHeader.js +24 -5
  223. package/lib/module/components/ChatAndParticipants/ChatAndParticipantsHeader.js.map +1 -1
  224. package/lib/module/components/ChatAndParticipants/ChatAndParticipantsView.js +3 -1
  225. package/lib/module/components/ChatAndParticipants/ChatAndParticipantsView.js.map +1 -1
  226. package/lib/module/components/ChatAndParticipants/ChatView.js +22 -3
  227. package/lib/module/components/ChatAndParticipants/ChatView.js.map +1 -1
  228. package/lib/module/components/EndRoomModalContent.js +6 -9
  229. package/lib/module/components/EndRoomModalContent.js.map +1 -1
  230. package/lib/module/components/Footer.js.map +1 -1
  231. package/lib/module/components/GridView.js.map +1 -1
  232. package/lib/module/components/HLSView.js +9 -7
  233. package/lib/module/components/HLSView.js.map +1 -1
  234. package/lib/module/components/HMSBaseButton.js +10 -2
  235. package/lib/module/components/HMSBaseButton.js.map +1 -1
  236. package/lib/module/components/HMSDangerButton.js +4 -2
  237. package/lib/module/components/HMSDangerButton.js.map +1 -1
  238. package/lib/module/components/HMSHLSMessage.js +88 -3
  239. package/lib/module/components/HMSHLSMessage.js.map +1 -1
  240. package/lib/module/components/HMSHLSMessageList.js +2 -2
  241. package/lib/module/components/HMSHLSMessageList.js.map +1 -1
  242. package/lib/module/components/HMSHandRaiseNotification.js +6 -3
  243. package/lib/module/components/HMSHandRaiseNotification.js.map +1 -1
  244. package/lib/module/components/HMSKeyboardAvoidingView.js +6 -2
  245. package/lib/module/components/HMSKeyboardAvoidingView.js.map +1 -1
  246. package/lib/module/components/HMSLiveIndicator.js +2 -6
  247. package/lib/module/components/HMSLiveIndicator.js.map +1 -1
  248. package/lib/module/components/HMSLiveViewerCount.js +8 -7
  249. package/lib/module/components/HMSLiveViewerCount.js.map +1 -1
  250. package/lib/module/components/HMSLocalScreenshareNotification.js +2 -1
  251. package/lib/module/components/HMSLocalScreenshareNotification.js.map +1 -1
  252. package/lib/module/components/HMSNotification.js +32 -5
  253. package/lib/module/components/HMSNotification.js.map +1 -1
  254. package/lib/module/components/HMSNotifications.js +9 -2
  255. package/lib/module/components/HMSNotifications.js.map +1 -1
  256. package/lib/module/components/HMSOverlayChatView.js +45 -3
  257. package/lib/module/components/HMSOverlayChatView.js.map +1 -1
  258. package/lib/module/components/HMSPreviewEditName.js.map +1 -1
  259. package/lib/module/components/HMSPreviewHLSLiveIndicator.js +2 -6
  260. package/lib/module/components/HMSPreviewHLSLiveIndicator.js.map +1 -1
  261. package/lib/module/components/HMSPrimaryButton.js +4 -2
  262. package/lib/module/components/HMSPrimaryButton.js.map +1 -1
  263. package/lib/module/components/HMSRecordingIndicator.js +11 -16
  264. package/lib/module/components/HMSRecordingIndicator.js.map +1 -1
  265. package/lib/module/components/HMSRoomOptions.js.map +1 -1
  266. package/lib/module/components/HMSTerminalErrorNotification.js +6 -2
  267. package/lib/module/components/HMSTerminalErrorNotification.js.map +1 -1
  268. package/lib/module/components/Header.js.map +1 -1
  269. package/lib/module/components/LeaveRoomBottomSheet.js +3 -6
  270. package/lib/module/components/LeaveRoomBottomSheet.js.map +1 -1
  271. package/lib/module/components/Meeting.js +4 -1
  272. package/lib/module/components/Meeting.js.map +1 -1
  273. package/lib/module/components/MeetingScreenContent.js.map +1 -1
  274. package/lib/module/components/Modals.js +10 -13
  275. package/lib/module/components/Modals.js.map +1 -1
  276. package/lib/module/components/Participants/ParticipantsItemOptions.js +5 -1
  277. package/lib/module/components/Participants/ParticipantsItemOptions.js.map +1 -1
  278. package/lib/module/components/PeerSettingsModalContent.js.map +1 -1
  279. package/lib/module/components/PeerVideoTile/PeerVideoTileView.js.map +1 -1
  280. package/lib/module/components/Preview.js +13 -2
  281. package/lib/module/components/Preview.js.map +1 -1
  282. package/lib/module/components/PreviewForRoleChangeModal.js +5 -4
  283. package/lib/module/components/PreviewForRoleChangeModal.js.map +1 -1
  284. package/lib/module/components/RoomSettingsModalContent.js +16 -7
  285. package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
  286. package/lib/module/components/RoomSettingsModalDebugModeContent.js +3 -5
  287. package/lib/module/components/RoomSettingsModalDebugModeContent.js.map +1 -1
  288. package/lib/module/components/WebrtcView.js.map +1 -1
  289. package/lib/module/hooks-sdk-selectors.js +12 -0
  290. package/lib/module/hooks-sdk-selectors.js.map +1 -1
  291. package/lib/module/hooks-sdk.js +23 -1
  292. package/lib/module/hooks-sdk.js.map +1 -1
  293. package/lib/module/hooks-util-selectors.js +3 -3
  294. package/lib/module/hooks-util-selectors.js.map +1 -1
  295. package/lib/module/hooks-util.js +400 -65
  296. package/lib/module/hooks-util.js.map +1 -1
  297. package/lib/module/redux/actionTypes.js +16 -3
  298. package/lib/module/redux/actionTypes.js.map +1 -1
  299. package/lib/module/redux/actions/index.js +36 -2
  300. package/lib/module/redux/actions/index.js.map +1 -1
  301. package/lib/module/redux/reducers/appState.js +41 -1
  302. package/lib/module/redux/reducers/appState.js.map +1 -1
  303. package/lib/module/redux/reducers/chatWindow.js +1 -2
  304. package/lib/module/redux/reducers/chatWindow.js.map +1 -1
  305. package/lib/module/redux/reducers/hmsStates.js +21 -8
  306. package/lib/module/redux/reducers/hmsStates.js.map +1 -1
  307. package/lib/module/redux/reducers/message.js +17 -4
  308. package/lib/module/redux/reducers/message.js.map +1 -1
  309. package/lib/module/types.js +4 -2
  310. package/lib/module/types.js.map +1 -1
  311. package/lib/module/utils/types.js +3 -0
  312. package/lib/module/utils/types.js.map +1 -1
  313. package/lib/module/utils.js +2 -2
  314. package/lib/module/utils.js.map +1 -1
  315. package/lib/typescript/HMSContainer.d.ts +1 -1
  316. package/lib/typescript/HMSContainer.d.ts.map +1 -1
  317. package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
  318. package/lib/typescript/Icons/Chat/index.d.ts +1 -0
  319. package/lib/typescript/Icons/Chat/index.d.ts.map +1 -1
  320. package/lib/typescript/Icons/NoEntry/index.d.ts +7 -0
  321. package/lib/typescript/Icons/NoEntry/index.d.ts.map +1 -0
  322. package/lib/typescript/Icons/PauseCircle/index.d.ts +7 -0
  323. package/lib/typescript/Icons/PauseCircle/index.d.ts.map +1 -0
  324. package/lib/typescript/Icons/Pin/index.d.ts +1 -0
  325. package/lib/typescript/Icons/Pin/index.d.ts.map +1 -1
  326. package/lib/typescript/Icons/index.d.ts +2 -0
  327. package/lib/typescript/Icons/index.d.ts.map +1 -1
  328. package/lib/typescript/components/BottomSheet.d.ts.map +1 -1
  329. package/lib/typescript/components/Chat/ChatFilterBottomSheet.d.ts +3 -0
  330. package/lib/typescript/components/Chat/ChatFilterBottomSheet.d.ts.map +1 -0
  331. package/lib/typescript/components/Chat/ChatFilterBottomSheetOpener.d.ts +1 -0
  332. package/lib/typescript/components/Chat/ChatFilterBottomSheetOpener.d.ts.map +1 -1
  333. package/lib/typescript/components/Chat/ChatFilterItem.d.ts +1 -0
  334. package/lib/typescript/components/Chat/ChatFilterItem.d.ts.map +1 -1
  335. package/lib/typescript/components/Chat/ChatFilterView.d.ts +1 -0
  336. package/lib/typescript/components/Chat/ChatFilterView.d.ts.map +1 -1
  337. package/lib/typescript/components/Chat/ChatList.d.ts.map +1 -1
  338. package/lib/typescript/components/Chat/ChatMessage.d.ts.map +1 -1
  339. package/lib/typescript/components/Chat/ChatMoreActionsModal.d.ts +7 -0
  340. package/lib/typescript/components/Chat/ChatMoreActionsModal.d.ts.map +1 -0
  341. package/lib/typescript/components/Chat/ChatMoreActionsSheetView.d.ts +6 -0
  342. package/lib/typescript/components/Chat/ChatMoreActionsSheetView.d.ts.map +1 -0
  343. package/lib/typescript/components/Chat/ChatMoreActionsView.d.ts +7 -0
  344. package/lib/typescript/components/Chat/ChatMoreActionsView.d.ts.map +1 -0
  345. package/lib/typescript/components/Chat/ChatPaused.d.ts +10 -0
  346. package/lib/typescript/components/Chat/ChatPaused.d.ts.map +1 -0
  347. package/lib/typescript/components/Chat/MessageOptionsBottomSheet.d.ts +3 -0
  348. package/lib/typescript/components/Chat/MessageOptionsBottomSheet.d.ts.map +1 -0
  349. package/lib/typescript/components/Chat/MessageOptionsBottomSheetView.d.ts +6 -0
  350. package/lib/typescript/components/Chat/MessageOptionsBottomSheetView.d.ts.map +1 -0
  351. package/lib/typescript/components/Chat/MessageOptionsView.d.ts +7 -0
  352. package/lib/typescript/components/Chat/MessageOptionsView.d.ts.map +1 -0
  353. package/lib/typescript/components/Chat/PeerBlockedFromChat.d.ts +9 -0
  354. package/lib/typescript/components/Chat/PeerBlockedFromChat.d.ts.map +1 -0
  355. package/lib/typescript/components/Chat/PinnedMessages.d.ts +8 -0
  356. package/lib/typescript/components/Chat/PinnedMessages.d.ts.map +1 -0
  357. package/lib/typescript/components/Chat/index.d.ts +1 -1
  358. package/lib/typescript/components/Chat/index.d.ts.map +1 -1
  359. package/lib/typescript/components/ChatAndParticipants/ChatAndParticipantsBottomSheet.d.ts.map +1 -1
  360. package/lib/typescript/components/ChatAndParticipants/ChatAndParticipantsHeader.d.ts.map +1 -1
  361. package/lib/typescript/components/ChatAndParticipants/ChatAndParticipantsView.d.ts.map +1 -1
  362. package/lib/typescript/components/ChatAndParticipants/ChatView.d.ts.map +1 -1
  363. package/lib/typescript/components/EndRoomModalContent.d.ts.map +1 -1
  364. package/lib/typescript/components/Footer.d.ts.map +1 -1
  365. package/lib/typescript/components/GridView.d.ts.map +1 -1
  366. package/lib/typescript/components/HMSBaseButton.d.ts +1 -0
  367. package/lib/typescript/components/HMSBaseButton.d.ts.map +1 -1
  368. package/lib/typescript/components/HMSDangerButton.d.ts +1 -0
  369. package/lib/typescript/components/HMSDangerButton.d.ts.map +1 -1
  370. package/lib/typescript/components/HMSHLSMessage.d.ts +1 -1
  371. package/lib/typescript/components/HMSHLSMessage.d.ts.map +1 -1
  372. package/lib/typescript/components/HMSHandRaiseNotification.d.ts.map +1 -1
  373. package/lib/typescript/components/HMSKeyboardAvoidingView.d.ts.map +1 -1
  374. package/lib/typescript/components/HMSLiveIndicator.d.ts.map +1 -1
  375. package/lib/typescript/components/HMSLiveViewerCount.d.ts.map +1 -1
  376. package/lib/typescript/components/HMSLocalScreenshareNotification.d.ts.map +1 -1
  377. package/lib/typescript/components/HMSNotification.d.ts +2 -1
  378. package/lib/typescript/components/HMSNotification.d.ts.map +1 -1
  379. package/lib/typescript/components/HMSNotifications.d.ts.map +1 -1
  380. package/lib/typescript/components/HMSOverlayChatView.d.ts.map +1 -1
  381. package/lib/typescript/components/HMSPreviewEditName.d.ts.map +1 -1
  382. package/lib/typescript/components/HMSPreviewHLSLiveIndicator.d.ts.map +1 -1
  383. package/lib/typescript/components/HMSPrimaryButton.d.ts +1 -0
  384. package/lib/typescript/components/HMSPrimaryButton.d.ts.map +1 -1
  385. package/lib/typescript/components/HMSRecordingIndicator.d.ts.map +1 -1
  386. package/lib/typescript/components/HMSRoomOptions.d.ts.map +1 -1
  387. package/lib/typescript/components/HMSTerminalErrorNotification.d.ts.map +1 -1
  388. package/lib/typescript/components/Header.d.ts.map +1 -1
  389. package/lib/typescript/components/LeaveRoomBottomSheet.d.ts.map +1 -1
  390. package/lib/typescript/components/Meeting.d.ts.map +1 -1
  391. package/lib/typescript/components/MeetingScreenContent.d.ts.map +1 -1
  392. package/lib/typescript/components/Modals.d.ts.map +1 -1
  393. package/lib/typescript/components/Participants/ParticipantsItemOptions.d.ts.map +1 -1
  394. package/lib/typescript/components/PeerSettingsModalContent.d.ts.map +1 -1
  395. package/lib/typescript/components/PeerVideoTile/PeerVideoTileView.d.ts.map +1 -1
  396. package/lib/typescript/components/Preview.d.ts.map +1 -1
  397. package/lib/typescript/components/PreviewForRoleChangeModal.d.ts.map +1 -1
  398. package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
  399. package/lib/typescript/components/RoomSettingsModalDebugModeContent.d.ts.map +1 -1
  400. package/lib/typescript/components/WebrtcView.d.ts.map +1 -1
  401. package/lib/typescript/hooks-sdk-selectors.d.ts +3 -0
  402. package/lib/typescript/hooks-sdk-selectors.d.ts.map +1 -1
  403. package/lib/typescript/hooks-sdk.d.ts +4 -0
  404. package/lib/typescript/hooks-sdk.d.ts.map +1 -1
  405. package/lib/typescript/hooks-util-selectors.d.ts.map +1 -1
  406. package/lib/typescript/hooks-util.d.ts +35 -3
  407. package/lib/typescript/hooks-util.d.ts.map +1 -1
  408. package/lib/typescript/redux/actionTypes.d.ts +9 -2
  409. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  410. package/lib/typescript/redux/actions/index.d.ts +37 -3
  411. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  412. package/lib/typescript/redux/index.d.ts +7 -2
  413. package/lib/typescript/redux/index.d.ts.map +1 -1
  414. package/lib/typescript/redux/reducers/appState.d.ts +7 -2
  415. package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
  416. package/lib/typescript/redux/reducers/chatWindow.d.ts +1 -1
  417. package/lib/typescript/redux/reducers/chatWindow.d.ts.map +1 -1
  418. package/lib/typescript/redux/reducers/hmsStates.d.ts.map +1 -1
  419. package/lib/typescript/redux/reducers/index.d.ts +7 -2
  420. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  421. package/lib/typescript/redux/reducers/message.d.ts +3 -2
  422. package/lib/typescript/redux/reducers/message.d.ts.map +1 -1
  423. package/lib/typescript/types.d.ts +26 -5
  424. package/lib/typescript/types.d.ts.map +1 -1
  425. package/lib/typescript/utils/types.d.ts +3 -0
  426. package/lib/typescript/utils/types.d.ts.map +1 -1
  427. package/package.json +179 -179
  428. package/src/HMSContainer.tsx +26 -5
  429. package/src/HMSRoomSetup.tsx +9 -9
  430. package/src/Icons/Chat/assets/chat-on.png +0 -0
  431. package/src/Icons/Chat/assets/chat-on@2x.png +0 -0
  432. package/src/Icons/Chat/assets/chat-on@3x.png +0 -0
  433. package/src/Icons/Chat/index.tsx +19 -6
  434. package/src/Icons/NoEntry/assets/no-entry.png +0 -0
  435. package/src/Icons/NoEntry/assets/no-entry@2x.png +0 -0
  436. package/src/Icons/NoEntry/assets/no-entry@3x.png +0 -0
  437. package/src/Icons/NoEntry/index.tsx +33 -0
  438. package/src/Icons/PauseCircle/assets/pause-circle.png +0 -0
  439. package/src/Icons/PauseCircle/assets/pause-circle@2x.png +0 -0
  440. package/src/Icons/PauseCircle/assets/pause-circle@3x.png +0 -0
  441. package/src/Icons/PauseCircle/index.tsx +27 -0
  442. package/src/Icons/Pin/assets/unpin.png +0 -0
  443. package/src/Icons/Pin/assets/unpin@2x.png +0 -0
  444. package/src/Icons/Pin/assets/unpin@3x.png +0 -0
  445. package/src/Icons/Pin/index.tsx +13 -3
  446. package/src/Icons/Recording/assets/recording-pause.png +0 -0
  447. package/src/Icons/Recording/assets/recording-pause@2x.png +0 -0
  448. package/src/Icons/Recording/assets/recording-pause@3x.png +0 -0
  449. package/src/Icons/Recording/index.tsx +2 -2
  450. package/src/Icons/index.ts +2 -0
  451. package/src/components/BottomSheet.tsx +13 -3
  452. package/src/components/Chat/ChatFilterBottomSheet.tsx +35 -0
  453. package/src/components/Chat/ChatFilterBottomSheetOpener.tsx +170 -42
  454. package/src/components/Chat/ChatFilterItem.tsx +8 -4
  455. package/src/components/Chat/ChatFilterView.tsx +102 -75
  456. package/src/components/Chat/ChatList.tsx +18 -6
  457. package/src/components/Chat/ChatMessage.tsx +111 -7
  458. package/src/components/Chat/ChatMoreActionsModal.tsx +75 -0
  459. package/src/components/Chat/ChatMoreActionsSheetView.tsx +77 -0
  460. package/src/components/Chat/ChatMoreActionsView.tsx +84 -0
  461. package/src/components/Chat/ChatPaused.tsx +103 -0
  462. package/src/components/Chat/MessageOptionsBottomSheet.tsx +33 -0
  463. package/src/components/Chat/MessageOptionsBottomSheetView.tsx +82 -0
  464. package/src/components/Chat/MessageOptionsView.tsx +248 -0
  465. package/src/components/Chat/PeerBlockedFromChat.tsx +49 -0
  466. package/src/components/Chat/PinnedMessages.tsx +422 -0
  467. package/src/components/Chat/index.ts +1 -1
  468. package/src/components/ChatAndParticipants/ChatAndParticipantsBottomSheet.tsx +4 -1
  469. package/src/components/ChatAndParticipants/ChatAndParticipantsHeader.tsx +48 -12
  470. package/src/components/ChatAndParticipants/ChatAndParticipantsView.tsx +9 -1
  471. package/src/components/ChatAndParticipants/ChatView.tsx +37 -5
  472. package/src/components/EndRoomModalContent.tsx +11 -14
  473. package/src/components/Footer.tsx +3 -1
  474. package/src/components/GridView.tsx +17 -8
  475. package/src/components/HLSView.tsx +45 -45
  476. package/src/components/HMSBaseButton.tsx +17 -2
  477. package/src/components/HMSDangerButton.tsx +3 -0
  478. package/src/components/HMSHLSMessage.tsx +130 -13
  479. package/src/components/HMSHLSMessageList.tsx +2 -2
  480. package/src/components/HMSHandRaiseNotification.tsx +17 -10
  481. package/src/components/HMSKeyboardAvoidingView.tsx +6 -1
  482. package/src/components/HMSLiveIndicator.tsx +9 -13
  483. package/src/components/HMSLiveViewerCount.tsx +21 -20
  484. package/src/components/HMSLocalScreenshareNotification.tsx +1 -0
  485. package/src/components/HMSNotification.tsx +56 -13
  486. package/src/components/HMSNotifications.tsx +12 -2
  487. package/src/components/HMSOverlayChatView.tsx +74 -17
  488. package/src/components/HMSPreviewEditName.tsx +3 -1
  489. package/src/components/HMSPreviewHLSLiveIndicator.tsx +2 -6
  490. package/src/components/HMSPrimaryButton.tsx +3 -0
  491. package/src/components/HMSRecordingIndicator.tsx +8 -22
  492. package/src/components/HMSRoomOptions.tsx +4 -1
  493. package/src/components/HMSTerminalErrorNotification.tsx +15 -10
  494. package/src/components/Header.tsx +4 -1
  495. package/src/components/LeaveRoomBottomSheet.tsx +13 -11
  496. package/src/components/Meeting.tsx +4 -0
  497. package/src/components/MeetingScreenContent.tsx +24 -21
  498. package/src/components/Modals.tsx +23 -25
  499. package/src/components/Participants/ParticipantsItemOptions.tsx +12 -7
  500. package/src/components/PeerSettingsModalContent.tsx +3 -1
  501. package/src/components/PeerVideoTile/PeerVideoTileView.tsx +3 -1
  502. package/src/components/Preview.tsx +15 -2
  503. package/src/components/PreviewForRoleChangeModal.tsx +4 -3
  504. package/src/components/RoomSettingsModalContent.tsx +62 -18
  505. package/src/components/RoomSettingsModalDebugModeContent.tsx +2 -5
  506. package/src/components/WebrtcView.tsx +6 -2
  507. package/src/hooks-sdk-selectors.tsx +19 -0
  508. package/src/hooks-sdk.ts +37 -0
  509. package/src/hooks-util-selectors.tsx +2 -3
  510. package/src/hooks-util.ts +580 -90
  511. package/src/redux/actionTypes.ts +22 -2
  512. package/src/redux/actions/index.ts +41 -4
  513. package/src/redux/reducers/appState.ts +54 -5
  514. package/src/redux/reducers/chatWindow.ts +2 -2
  515. package/src/redux/reducers/hmsStates.ts +36 -13
  516. package/src/redux/reducers/message.ts +20 -6
  517. package/src/types.ts +36 -6
  518. package/src/utils/types.ts +3 -0
  519. package/src/utils.ts +2 -2
  520. package/lib/commonjs/components/Chat/PinnedMessage.js +0 -81
  521. package/lib/commonjs/components/Chat/PinnedMessage.js.map +0 -1
  522. package/lib/module/components/Chat/PinnedMessage.js +0 -72
  523. package/lib/module/components/Chat/PinnedMessage.js.map +0 -1
  524. package/lib/typescript/components/Chat/PinnedMessage.d.ts +0 -3
  525. package/lib/typescript/components/Chat/PinnedMessage.d.ts.map +0 -1
  526. package/src/components/Chat/PinnedMessage.tsx +0 -89
package/src/hooks-util.ts CHANGED
@@ -7,7 +7,6 @@ import {
7
7
  HMSPIPListenerActions,
8
8
  HMSPeer,
9
9
  HMSPeerUpdate,
10
- HMSRemotePeer,
11
10
  HMSRoleChangeRequest,
12
11
  HMSRoom,
13
12
  HMSRoomUpdate,
@@ -30,8 +29,8 @@ import type {
30
29
  HMSPIPConfig,
31
30
  HMSRole,
32
31
  HMSSessionStore,
33
- HMSSessionStoreValue,
34
32
  HMSSpeaker,
33
+ JsonValue,
35
34
  } from '@100mslive/react-native-hms';
36
35
  import type {
37
36
  ColorPalette,
@@ -59,12 +58,9 @@ import {
59
58
  PeerListRefreshInterval,
60
59
  PipModes,
61
60
  } from './utils/types';
62
- import type {
63
- ChatBroadcastFilter,
64
- OnLeaveHandler,
65
- PeerTrackNode,
66
- } from './utils/types';
67
- import { createPeerTrackNode } from './utils/functions';
61
+ import { ChatBroadcastFilter } from './utils/types';
62
+ import type { OnLeaveHandler, PeerTrackNode } from './utils/types';
63
+ import { createPeerTrackNode, parseMetadata } from './utils/functions';
68
64
  import {
69
65
  batch,
70
66
  shallowEqual,
@@ -78,13 +74,14 @@ import {
78
74
  addNotification,
79
75
  addParticipant,
80
76
  addParticipants,
81
- addPinnedMessage,
77
+ addPinnedMessages,
82
78
  addScreenshareTile,
83
79
  addUpdateParticipant,
84
80
  changeMeetingState,
85
81
  changePipModeStatus,
86
82
  changeStartingHLSStream,
87
83
  clearStore,
84
+ filterOutMsgsFromBlockedPeers,
88
85
  removeNotification,
89
86
  removeParticipant,
90
87
  removeParticipants,
@@ -94,6 +91,8 @@ import {
94
91
  setActiveChatBottomSheetTab,
95
92
  setActiveSpeakers,
96
93
  setAutoEnterPipMode,
94
+ setChatPeerBlacklist,
95
+ setChatState,
97
96
  setEditUsernameDisabled,
98
97
  setFullScreenPeerTrackNode,
99
98
  setHMSLocalPeerState,
@@ -127,7 +126,7 @@ import {
127
126
  replacePeerTrackNodesWithTrack,
128
127
  } from './peerTrackNodeUtils';
129
128
  import { MeetingState } from './types';
130
- import type { HMSPrebuiltProps } from './types';
129
+ import type { ChatState, HMSPrebuiltProps, PinnedMessage } from './types';
131
130
  import {
132
131
  BackHandler,
133
132
  InteractionManager,
@@ -153,6 +152,7 @@ import { getRoomLayout } from './modules/HMSManager';
153
152
  import { DEFAULT_THEME, DEFAULT_TYPOGRAPHY } from './utils/theme';
154
153
  import { NotificationTypes } from './types';
155
154
  import { KeyboardState, useSharedValue } from 'react-native-reanimated';
155
+ import { useHMSActions } from './hooks-sdk';
156
156
 
157
157
  export const useHMSListeners = (
158
158
  setPeerTrackNodes: React.Dispatch<React.SetStateAction<PeerTrackNode[]>>
@@ -220,6 +220,7 @@ const useHMSPeersUpdate = (
220
220
  // const inMeeting = useSelector(
221
221
  // (state: RootState) => state.app.meetingState === MeetingState.IN_MEETING
222
222
  // );
223
+ const hmsActions = useHMSActions();
223
224
 
224
225
  useEffect(() => {
225
226
  const peerUpdateHandler = ({ peer, type }: PeerUpdate) => {
@@ -273,6 +274,7 @@ const useHMSPeersUpdate = (
273
274
  const fullScreenPeerTrackNode = reduxState.app.fullScreenPeerTrackNode;
274
275
  const miniviewPeerTrackNode = reduxState.app.miniviewPeerTrackNode;
275
276
  const localPeerTrackNode = reduxState.app.localPeerTrackNode;
277
+ const initialRole = reduxState.app.initialRole;
276
278
 
277
279
  // Currently Applied Layout config
278
280
  const currentLayoutConfig = selectLayoutConfigForRole(
@@ -343,11 +345,41 @@ const useHMSPeersUpdate = (
343
345
  // - TODO: update local localPeer state
344
346
  // - Pass this updated data to Meeting component -> DisplayView component
345
347
  updateLocalPeer();
348
+
349
+ if (type === HMSPeerUpdate.ROLE_CHANGED) {
350
+ const parsedLocalPeerMetadata = parseMetadata(peer.metadata);
351
+
352
+ if (parsedLocalPeerMetadata.prevRole !== initialRole) {
353
+ const newMetadata = {
354
+ ...parsedLocalPeerMetadata,
355
+ prevRole: initialRole?.name,
356
+ };
357
+
358
+ hmsActions
359
+ .changeMetadata(newMetadata)
360
+ .then((r) => {
361
+ console.log('Metadata changed successfully', r);
362
+ })
363
+ .catch((e) => {
364
+ console.log('Metadata change failed', e);
365
+ });
366
+ }
367
+ }
346
368
  return;
347
369
  }
348
370
  if (type === HMSPeerUpdate.ROLE_CHANGED) {
349
371
  dispatch(addUpdateParticipant(peer));
350
372
 
373
+ // saving current role in peer metadata,
374
+ // so that when peer is removed from stage, we can assign previous role to it.
375
+ // if (localPeerRoleName) {
376
+ // const newMetadata = {
377
+ // ...localPeerMetadata,
378
+ // prevRole: localPeerRoleName,
379
+ // };
380
+ // await hmsActions.changeMetadata(newMetadata);
381
+ // }
382
+
351
383
  // Handling regular tiles list
352
384
  if (
353
385
  peer.role?.publishSettings?.allowed === undefined ||
@@ -1000,6 +1032,7 @@ type SessionStoreListeners = Array<{ remove: () => void }>;
1000
1032
  export const useHMSSessionStoreListeners = (
1001
1033
  gridViewRef: React.MutableRefObject<GridViewRefAttrs | null>
1002
1034
  ) => {
1035
+ const store = useStore<RootState>();
1003
1036
  const dispatch = useDispatch();
1004
1037
  const hmsSessionStore = useSelector(
1005
1038
  (state: RootState) => state.user.hmsSessionStore
@@ -1013,18 +1046,105 @@ export const useHMSSessionStoreListeners = (
1013
1046
 
1014
1047
  const addSessionStoreListeners = () => {
1015
1048
  // Handle 'spotlight' key values
1016
- const handleSpotlightIdChange = (id: HMSSessionStoreValue) => {
1017
- // set value to the state to rerender the component to reflect changes
1018
- dispatch(saveUserData({ spotlightTrackId: id }));
1019
- // Scroll to start of the list
1020
- gridViewRef.current
1021
- ?.getRegularTilesFlatlistRef()
1022
- .current?.scrollToOffset({ animated: true, offset: 0 });
1049
+ const handleSpotlightIdChange = (id: JsonValue) => {
1050
+ if (id === null || id === undefined || typeof id === 'string') {
1051
+ // set value to the state to rerender the component to reflect changes
1052
+ dispatch(saveUserData({ spotlightTrackId: id }));
1053
+ // Scroll to start of the list
1054
+ gridViewRef.current
1055
+ ?.getRegularTilesFlatlistRef()
1056
+ .current?.scrollToOffset({ animated: true, offset: 0 });
1057
+ }
1023
1058
  };
1024
1059
 
1025
- // Handle 'pinnedMessage' key values
1026
- const handlePinnedMessageChange = (data: HMSSessionStoreValue) => {
1027
- dispatch(addPinnedMessage(data));
1060
+ // Handle 'pinnedMessages' key values
1061
+ const handlePinnedMessagesChange = (data: JsonValue) => {
1062
+ if (Array.isArray(data)) {
1063
+ dispatch(addPinnedMessages(data as PinnedMessage[]));
1064
+ }
1065
+ };
1066
+
1067
+ // Handle 'chatState' key values
1068
+ const handleChatStateChange = (data: JsonValue) => {
1069
+ try {
1070
+ if (
1071
+ typeof data !== 'object' ||
1072
+ Array.isArray(data) ||
1073
+ data === null
1074
+ ) {
1075
+ throw new Error('`data` is a falsy value');
1076
+ }
1077
+ if (!('enabled' in data)) {
1078
+ throw new Error("`data` doesn't have `enabled` property");
1079
+ }
1080
+
1081
+ const parsedData = data as ChatState;
1082
+
1083
+ const reduxState = store.getState();
1084
+ const currentChatState = reduxState.app.chatState;
1085
+
1086
+ if (parsedData.enabled === currentChatState?.enabled) {
1087
+ return;
1088
+ }
1089
+
1090
+ const currentLayoutConfig = selectLayoutConfigForRole(
1091
+ reduxState.hmsStates.layoutConfig,
1092
+ reduxState.hmsStates.localPeer?.role ?? null
1093
+ );
1094
+
1095
+ const chatLayoutConfig =
1096
+ selectChatLayoutConfig(currentLayoutConfig);
1097
+
1098
+ const isAllowedToSendMessage =
1099
+ (chatLayoutConfig?.private_chat_enabled ||
1100
+ chatLayoutConfig?.public_chat_enabled ||
1101
+ (chatLayoutConfig?.roles_whitelist &&
1102
+ chatLayoutConfig?.roles_whitelist.length > 0)) ??
1103
+ false;
1104
+
1105
+ batch(() => {
1106
+ if (
1107
+ isAllowedToSendMessage && // Only show notification when allowed to send message, AND
1108
+ (!parsedData.enabled || // Chat is Paused, OR
1109
+ (currentChatState &&
1110
+ parsedData.enabled !== currentChatState.enabled)) // current Chat state is different from previous state
1111
+ ) {
1112
+ dispatch(
1113
+ addNotification({
1114
+ id: `chat-state-enabled-${Math.random()
1115
+ .toString(16)
1116
+ .slice(2)}`,
1117
+ icon: parsedData.enabled ? 'chat-on' : 'chat-off',
1118
+ type: NotificationTypes.INFO,
1119
+ title: `Chat ${parsedData.enabled ? 'Resumed' : 'Paused'}`,
1120
+ message: `Chat ${
1121
+ parsedData.enabled ? 'resumed' : 'paused'
1122
+ } ${
1123
+ parsedData.updatedBy
1124
+ ? `by ${parsedData.updatedBy.userName}`
1125
+ : ''
1126
+ }`,
1127
+ })
1128
+ );
1129
+ }
1130
+ dispatch(setChatState(parsedData));
1131
+ });
1132
+ } catch (error) {
1133
+ dispatch(setChatState(null));
1134
+ }
1135
+ };
1136
+
1137
+ // Handle 'chatPeerBlacklist' key values
1138
+ const handleChatPeerBlacklistChange = (data: JsonValue) => {
1139
+ // Whenever list changes :
1140
+ // - check if local peer is blocked or unblocked
1141
+ // - filter out messages of blocked peers
1142
+ if (Array.isArray(data)) {
1143
+ batch(() => {
1144
+ dispatch(setChatPeerBlacklist(data as string[]));
1145
+ dispatch(filterOutMsgsFromBlockedPeers(data as string[]));
1146
+ });
1147
+ }
1028
1148
  };
1029
1149
 
1030
1150
  // Getting value for 'spotlight' key by using `get` method on HMSSessionStore instance
@@ -1044,19 +1164,53 @@ export const useHMSSessionStoreListeners = (
1044
1164
  )
1045
1165
  );
1046
1166
 
1047
- // Getting value for 'pinnedMessage' key by using `get` method on HMSSessionStore instance
1167
+ // Getting value for 'pinnedMessages' key by using `get` method on HMSSessionStore instance
1168
+ hmsSessionStore
1169
+ .get('pinnedMessages')
1170
+ .then((data) => {
1171
+ console.log(
1172
+ 'Session Store get `pinnedMessages` key value success: ',
1173
+ data
1174
+ );
1175
+ handlePinnedMessagesChange(data);
1176
+ })
1177
+ .catch((error) =>
1178
+ console.log(
1179
+ 'Session Store get `pinnedMessages` key value error: ',
1180
+ error
1181
+ )
1182
+ );
1183
+
1184
+ // Getting value for 'chatState' key by using `get` method on HMSSessionStore instance
1185
+ hmsSessionStore
1186
+ .get('chatState')
1187
+ .then((data) => {
1188
+ console.log(
1189
+ 'Session Store get `chatState` key value success: ',
1190
+ data
1191
+ );
1192
+ handleChatStateChange(data);
1193
+ })
1194
+ .catch((error) =>
1195
+ console.log(
1196
+ 'Session Store get `chatState` key value error: ',
1197
+ error
1198
+ )
1199
+ );
1200
+
1201
+ // Getting value for 'chatPeerBlacklist' key by using `get` method on HMSSessionStore instance
1048
1202
  hmsSessionStore
1049
- .get('pinnedMessage')
1203
+ .get('chatPeerBlacklist')
1050
1204
  .then((data) => {
1051
1205
  console.log(
1052
- 'Session Store get `pinnedMessage` key value success: ',
1206
+ 'Session Store get `chatPeerBlacklist` key value success: ',
1053
1207
  data
1054
1208
  );
1055
- handlePinnedMessageChange(data);
1209
+ handleChatPeerBlacklistChange(data);
1056
1210
  })
1057
1211
  .catch((error) =>
1058
1212
  console.log(
1059
- 'Session Store get `pinnedMessage` key value error: ',
1213
+ 'Session Store get `chatPeerBlacklist` key value error: ',
1060
1214
  error
1061
1215
  )
1062
1216
  );
@@ -1064,66 +1218,44 @@ export const useHMSSessionStoreListeners = (
1064
1218
  // let lastSpotlightValue: HMSSessionStoreValue = null;
1065
1219
  // let lastPinnedMessageValue: HMSSessionStoreValue = null;
1066
1220
 
1067
- // Add subscription for `spotlight` & `pinnedMessage` keys updates on Session Store
1221
+ // Add subscription for `spotlight`, `pinnedMessages`, `chatState` & `chatPeerBlacklist` keys updates on Session Store
1068
1222
  const subscription = hmsSessionStore.addKeyChangeListener<
1069
- ['spotlight', 'pinnedMessage']
1070
- >(['spotlight', 'pinnedMessage'], (error, data) => {
1071
- // If error occurs, handle error and return early
1072
- if (error !== null) {
1073
- console.log(
1074
- '`spotlight` & `pinnedMessage` key listener Error -> ',
1075
- error
1076
- );
1077
- return;
1078
- }
1223
+ ['spotlight', 'pinnedMessages', 'chatState', 'chatPeerBlacklist']
1224
+ >(
1225
+ ['spotlight', 'pinnedMessages', 'chatState', 'chatPeerBlacklist'],
1226
+ (error, data) => {
1227
+ // If error occurs, handle error and return early
1228
+ if (error !== null) {
1229
+ console.log(
1230
+ '`spotlight`, `pinnedMessages`, `chatState` & `chatPeerBlacklist` key listener Error -> ',
1231
+ error
1232
+ );
1233
+ return;
1234
+ }
1079
1235
 
1080
- // If no error, handle data
1081
- if (data !== null) {
1082
- switch (data.key) {
1083
- case 'spotlight': {
1084
- handleSpotlightIdChange(data.value);
1085
-
1086
- // Showing Toast message if value has actually changed
1087
- // if (
1088
- // data.value !== lastSpotlightValue &&
1089
- // (data.value || lastSpotlightValue)
1090
- // ) {
1091
- // Toast.showWithGravity(
1092
- // `SessionStore: \`spotlight\` key's value changed to ${data.value}`,
1093
- // Toast.LONG,
1094
- // Toast.TOP
1095
- // );
1096
- // }
1097
-
1098
- // lastSpotlightValue = data.value;
1099
- break;
1100
- }
1101
- case 'pinnedMessage': {
1102
- handlePinnedMessageChange(data.value);
1103
-
1104
- // Showing Toast message if value has actually changed
1105
- // if (
1106
- // data.value !== lastPinnedMessageValue &&
1107
- // (data.value || lastPinnedMessageValue)
1108
- // ) {
1109
- // if (toastTimeoutId !== null) {
1110
- // clearTimeout(toastTimeoutId);
1111
- // }
1112
- // toastTimeoutId = setTimeout(() => {
1113
- // Toast.showWithGravity(
1114
- // `SessionStore: \`pinnedMessage\` key's value changed to ${data.value}`,
1115
- // Toast.LONG,
1116
- // Toast.TOP
1117
- // );
1118
- // }, 1500);
1119
- // }
1120
-
1121
- // lastPinnedMessageValue = data.value;
1122
- break;
1236
+ // If no error, handle data
1237
+ if (data !== null) {
1238
+ switch (data.key) {
1239
+ case 'spotlight': {
1240
+ handleSpotlightIdChange(data.value);
1241
+ break;
1242
+ }
1243
+ case 'pinnedMessages': {
1244
+ handlePinnedMessagesChange(data.value);
1245
+ break;
1246
+ }
1247
+ case 'chatState': {
1248
+ handleChatStateChange(data.value);
1249
+ break;
1250
+ }
1251
+ case 'chatPeerBlacklist': {
1252
+ handleChatPeerBlacklistChange(data.value);
1253
+ break;
1254
+ }
1123
1255
  }
1124
1256
  }
1125
1257
  }
1126
- });
1258
+ );
1127
1259
 
1128
1260
  // Save reference of `subscription` in a ref
1129
1261
  sessionStoreListenersRef.current.push(subscription);
@@ -1140,7 +1272,7 @@ export const useHMSSessionStoreListeners = (
1140
1272
  // if (toastTimeoutId !== null) clearTimeout(toastTimeoutId);
1141
1273
  };
1142
1274
  }
1143
- }, [hmsSessionStore]);
1275
+ }, [store, hmsSessionStore]);
1144
1276
  };
1145
1277
 
1146
1278
  export const useHMSSessionStore = () => {
@@ -2017,18 +2149,17 @@ export const useLeaveMethods = () => {
2017
2149
  const onLeave = reduxStore.getState().user.onLeave;
2018
2150
 
2019
2151
  if (typeof onLeave === 'function') {
2152
+ dispatch(changeMeetingState(MeetingState.EXITED));
2020
2153
  onLeave(reason);
2021
- dispatch(clearStore());
2022
2154
  } else if (
2023
2155
  navigation &&
2024
2156
  typeof navigation.canGoBack === 'function' &&
2025
2157
  navigation.canGoBack()
2026
2158
  ) {
2159
+ dispatch(changeMeetingState(MeetingState.EXITED));
2027
2160
  navigation.goBack();
2028
- dispatch(clearStore());
2029
2161
  } else {
2030
2162
  // Otherwise default action is to show "Meeting Ended" screen
2031
- dispatch(clearStore()); // TODO: We need different clearStore for MeetingEnded
2032
2163
  dispatch(changeMeetingState(MeetingState.MEETING_ENDED));
2033
2164
  }
2034
2165
  } catch (e) {
@@ -2202,12 +2333,9 @@ export const useSendMessage = () => {
2202
2333
  const chatWindowState = reduxStore.getState().chatWindow;
2203
2334
 
2204
2335
  const message = chatWindowState.typedMessage;
2205
- const sendingTo = chatWindowState.sendTo as
2206
- | HMSRole
2207
- | HMSRemotePeer
2208
- | typeof ChatBroadcastFilter;
2336
+ const sendingTo = chatWindowState.sendTo;
2209
2337
 
2210
- if (message.length <= 0) return;
2338
+ if (message.length <= 0 || !sendingTo) return;
2211
2339
 
2212
2340
  const hmsMessageRecipient = new HMSMessageRecipient({
2213
2341
  recipientType:
@@ -2271,6 +2399,72 @@ export const useSendMessage = () => {
2271
2399
  };
2272
2400
  };
2273
2401
 
2402
+ export const useHMSCanDisableChat = () => {
2403
+ return useHMSChatLayoutConfig<boolean>(
2404
+ (chatLayoutConfig) =>
2405
+ chatLayoutConfig?.real_time_controls?.can_disable_chat ?? false
2406
+ );
2407
+ };
2408
+
2409
+ type ChatRecipients = {
2410
+ privateChat: boolean;
2411
+ publicChat: boolean;
2412
+ roles: HMSRole[];
2413
+ };
2414
+
2415
+ export const useHMSChatRecipientSelector = (): ChatRecipients => {
2416
+ const roles = useSelector((state: RootState) => state.hmsStates.roles);
2417
+
2418
+ const defaultChatRecipient = useMemo(
2419
+ () => ({
2420
+ privateChat: false,
2421
+ publicChat: false,
2422
+ roles: [],
2423
+ }),
2424
+ []
2425
+ );
2426
+
2427
+ const chatLayoutConfig = useHMSChatLayoutConfig(
2428
+ (_chatLayoutConfig) => _chatLayoutConfig
2429
+ );
2430
+
2431
+ const rolesWhitelist = chatLayoutConfig?.roles_whitelist;
2432
+
2433
+ const whitelistedRoles = useMemo(() => {
2434
+ if (!rolesWhitelist) {
2435
+ return defaultChatRecipient.roles;
2436
+ }
2437
+ return rolesWhitelist
2438
+ .map((roleStr) => roles.find((role) => role.name === roleStr))
2439
+ .filter((role): role is HMSRole => !!role);
2440
+ }, [roles, rolesWhitelist, defaultChatRecipient]);
2441
+
2442
+ const privateChat =
2443
+ chatLayoutConfig?.private_chat_enabled ?? defaultChatRecipient.privateChat;
2444
+ const publicChat =
2445
+ chatLayoutConfig?.public_chat_enabled ?? defaultChatRecipient.publicChat;
2446
+
2447
+ if (chatLayoutConfig) {
2448
+ return {
2449
+ privateChat,
2450
+ publicChat,
2451
+ roles: whitelistedRoles,
2452
+ };
2453
+ }
2454
+
2455
+ return defaultChatRecipient;
2456
+ };
2457
+
2458
+ export const useIsAllowedToSendMessage = () => {
2459
+ const chatRecipients = useHMSChatRecipientSelector();
2460
+
2461
+ return (
2462
+ chatRecipients.privateChat ||
2463
+ chatRecipients.publicChat ||
2464
+ chatRecipients.roles.length > 0
2465
+ );
2466
+ };
2467
+
2274
2468
  export const useHMSChatLayoutConfig = <Selected = unknown>(
2275
2469
  selector: (chatConfig: ChatConfig | null) => Selected,
2276
2470
  equalityFn?: (left: Selected, right: Selected) => boolean
@@ -2388,7 +2582,7 @@ export const useStartRecording = () => {
2388
2582
  addNotification({
2389
2583
  id: Math.random().toString(16).slice(2),
2390
2584
  type: NotificationTypes.ERROR,
2391
- message: error.message,
2585
+ title: error.message,
2392
2586
  })
2393
2587
  );
2394
2588
  });
@@ -2400,6 +2594,185 @@ export const useStartRecording = () => {
2400
2594
  };
2401
2595
  };
2402
2596
 
2597
+ export const useHMSChatState = () => {
2598
+ const hmsSessionStore = useSelector(
2599
+ (state: RootState) => state.user.hmsSessionStore
2600
+ );
2601
+ const localPeerName = useSelector(
2602
+ (state: RootState) => state.hmsStates.localPeer?.name
2603
+ );
2604
+ const localPeerID = useSelector(
2605
+ (state: RootState) => state.hmsStates.localPeer?.peerID
2606
+ );
2607
+ const localPeerUserID = useSelector(
2608
+ (state: RootState) => state.hmsStates.localPeer?.customerUserID
2609
+ );
2610
+ const _chatState = useSelector((state: RootState) => state.app.chatState);
2611
+
2612
+ const chatState = useMemo(
2613
+ () => _chatState || ({ enabled: true } as const),
2614
+ [_chatState]
2615
+ );
2616
+
2617
+ const setChatState = useCallback(
2618
+ async (enabled: boolean) => {
2619
+ // If instance of HMSSessionStore is available
2620
+ if (hmsSessionStore) {
2621
+ try {
2622
+ const value = {
2623
+ enabled,
2624
+ updatedBy: {
2625
+ peerID: localPeerID ?? null,
2626
+ userID: localPeerUserID ?? null,
2627
+ userName: localPeerName ?? '',
2628
+ },
2629
+ updatedAt: Date.now(),
2630
+ };
2631
+ // set `value` on `session` with key 'chatState'
2632
+ const response = await hmsSessionStore.set(value, 'chatState');
2633
+ console.log('setSessionMetaData Response -> ', response);
2634
+ } catch (error) {
2635
+ console.log('setSessionMetaData Error -> ', error);
2636
+ }
2637
+ }
2638
+ },
2639
+ [localPeerName, hmsSessionStore, localPeerUserID, localPeerID]
2640
+ );
2641
+
2642
+ return { chatState, setChatState };
2643
+ };
2644
+
2645
+ export const useIsMessagePinned = (message: HMSMessage | null) => {
2646
+ return useSelector((state: RootState) =>
2647
+ message
2648
+ ? state.messages.pinnedMessages.findIndex(
2649
+ (pinnedMessage) => pinnedMessage.id === message.messageId
2650
+ ) >= 0
2651
+ : false
2652
+ );
2653
+ };
2654
+
2655
+ export const useHMSMessagePinningActions = () => {
2656
+ const store = useStore<RootState>();
2657
+ const hmsSessionStore = useSelector(
2658
+ (state: RootState) => state.user.hmsSessionStore
2659
+ );
2660
+
2661
+ const pinMessage = useCallback(
2662
+ async (message: HMSMessage | HMSMessage[]) => {
2663
+ let messages = message;
2664
+ if (!Array.isArray(messages)) {
2665
+ messages = [messages];
2666
+ }
2667
+
2668
+ // If instance of HMSSessionStore is available
2669
+ if (hmsSessionStore) {
2670
+ try {
2671
+ const reduxState = store.getState();
2672
+ const localPeerName = reduxState.hmsStates.localPeer?.name;
2673
+ const pinnedMessages = reduxState.messages.pinnedMessages;
2674
+
2675
+ let payload = messages.map((message) => ({
2676
+ authorId: message.sender?.customerUserID ?? '',
2677
+ id: message.messageId,
2678
+ pinnedBy: localPeerName ?? '',
2679
+ text: `${message.sender?.name}: ${message.message}`,
2680
+ }));
2681
+
2682
+ let updatedPinnedMessages = [...pinnedMessages, ...payload];
2683
+
2684
+ if (updatedPinnedMessages.length > 3) {
2685
+ updatedPinnedMessages = updatedPinnedMessages.slice(
2686
+ updatedPinnedMessages.length - 3
2687
+ );
2688
+ }
2689
+
2690
+ const response = await hmsSessionStore.set(
2691
+ updatedPinnedMessages,
2692
+ 'pinnedMessages'
2693
+ );
2694
+ console.log('setSessionMetaData Response -> ', response);
2695
+ } catch (error) {
2696
+ console.log('setSessionMetaData Error -> ', error);
2697
+ return Promise.reject(error);
2698
+ }
2699
+ }
2700
+ },
2701
+ [hmsSessionStore]
2702
+ );
2703
+
2704
+ const unpinMessage = useCallback(
2705
+ async (
2706
+ message: HMSMessage | PinnedMessage | (HMSMessage | PinnedMessage)[]
2707
+ ) => {
2708
+ let messages = message;
2709
+ if (!Array.isArray(messages)) {
2710
+ messages = [messages];
2711
+ }
2712
+
2713
+ // If instance of HMSSessionStore is available
2714
+ if (hmsSessionStore) {
2715
+ try {
2716
+ const pinnedMessages = store.getState().messages.pinnedMessages;
2717
+ const messageIdsToUnpin = messages.map((msg) =>
2718
+ 'messageId' in msg ? msg.messageId : msg.id
2719
+ );
2720
+ const updatedPinnedMessages = pinnedMessages.filter(
2721
+ (pinnedMessage) => !messageIdsToUnpin.includes(pinnedMessage.id)
2722
+ );
2723
+ const response = await hmsSessionStore.set(
2724
+ updatedPinnedMessages,
2725
+ 'pinnedMessages'
2726
+ );
2727
+ console.log('setSessionMetaData Response -> ', response);
2728
+ } catch (error) {
2729
+ console.log('setSessionMetaData Error -> ', error);
2730
+ return Promise.reject(error);
2731
+ }
2732
+ }
2733
+ },
2734
+ [hmsSessionStore]
2735
+ );
2736
+
2737
+ return { pinMessage, unpinMessage };
2738
+ };
2739
+
2740
+ export const useSetDefaultChatRecipient = () => {
2741
+ const dispatch = useDispatch();
2742
+ const localPeerRoleName = useSelector(
2743
+ (state: RootState) => state.hmsStates.localPeer?.role?.name
2744
+ );
2745
+
2746
+ const {
2747
+ privateChat,
2748
+ publicChat,
2749
+ roles: whitelistedRoles,
2750
+ } = useHMSChatRecipientSelector();
2751
+
2752
+ useEffect(() => {
2753
+ if (publicChat) {
2754
+ dispatch({ type: 'SET_SENDTO', sendTo: ChatBroadcastFilter });
2755
+ }
2756
+ // If Role is enabled, Select a role
2757
+ else if (Array.isArray(whitelistedRoles) && whitelistedRoles.length > 0) {
2758
+ const roleObj =
2759
+ whitelistedRoles.length === 1
2760
+ ? whitelistedRoles[0]
2761
+ : whitelistedRoles.filter(
2762
+ (whitelistRole) => whitelistRole.name !== localPeerRoleName
2763
+ )[0];
2764
+
2765
+ if (roleObj) {
2766
+ dispatch({ type: 'SET_SENDTO', sendTo: roleObj });
2767
+ }
2768
+ }
2769
+ // If private is enabled, Select None
2770
+ else if (privateChat) {
2771
+ dispatch({ type: 'SET_SENDTO', sendTo: null });
2772
+ }
2773
+ }, [privateChat, publicChat, whitelistedRoles, localPeerRoleName, dispatch]);
2774
+ };
2775
+
2403
2776
  export const useAndroidSoftInputAdjustResize = () => {
2404
2777
  const currentSoftInputRef = useRef<null | SoftInputModes>(null);
2405
2778
 
@@ -2474,3 +2847,120 @@ export const useKeyboardState = () => {
2474
2847
 
2475
2848
  return { keyboardState };
2476
2849
  };
2850
+
2851
+ export const useAllowPinningMessage = () => {
2852
+ return useHMSChatLayoutConfig(
2853
+ (config) => config?.allow_pinning_messages ?? false
2854
+ );
2855
+ };
2856
+
2857
+ export const useIsLocalPeerBlockedFromChat = () => {
2858
+ return useSelector((state: RootState) => {
2859
+ const chatPeerBlacklist = state.app.chatPeerBlacklist;
2860
+ const localPeerUserId = state.hmsStates.localPeer?.customerUserID;
2861
+
2862
+ return localPeerUserId
2863
+ ? chatPeerBlacklist.includes(localPeerUserId)
2864
+ : false;
2865
+ });
2866
+ };
2867
+
2868
+ export const useIsPeerBlocked = (peer: HMSPeer | null) => {
2869
+ return useSelector((state: RootState) => {
2870
+ const chatPeerBlacklist = state.app.chatPeerBlacklist;
2871
+ const localPeerUserId = peer?.customerUserID;
2872
+
2873
+ return localPeerUserId
2874
+ ? chatPeerBlacklist.includes(localPeerUserId)
2875
+ : false;
2876
+ });
2877
+ };
2878
+
2879
+ export const useBlockPeerActions = () => {
2880
+ const store = useStore<RootState>();
2881
+ const hmsSessionStore = useSelector(
2882
+ (state: RootState) => state.user.hmsSessionStore
2883
+ );
2884
+ const { unpinMessage } = useHMSMessagePinningActions();
2885
+
2886
+ const blockPeer = useCallback(
2887
+ async (peer: HMSPeer) => {
2888
+ // If instance of HMSSessionStore is available
2889
+ if (hmsSessionStore) {
2890
+ try {
2891
+ const reduxState = store.getState();
2892
+ const chatPeerBlacklist = reduxState.app.chatPeerBlacklist;
2893
+ const pinnedMessages = reduxState.messages.pinnedMessages;
2894
+
2895
+ if (
2896
+ peer.customerUserID &&
2897
+ !chatPeerBlacklist.includes(peer.customerUserID)
2898
+ ) {
2899
+ let updatedChatPeerBlacklist = [
2900
+ ...chatPeerBlacklist,
2901
+ peer.customerUserID,
2902
+ ];
2903
+ const response = await hmsSessionStore.set(
2904
+ updatedChatPeerBlacklist,
2905
+ 'chatPeerBlacklist'
2906
+ );
2907
+ console.log('setSessionMetaData Response -> ', response);
2908
+
2909
+ // Unpin messages from sent by the peer
2910
+ const msgsToUnpin = pinnedMessages.filter(
2911
+ (pinnedMessage) => pinnedMessage.authorId === peer.customerUserID
2912
+ );
2913
+ if (msgsToUnpin.length > 0) {
2914
+ await unpinMessage(msgsToUnpin);
2915
+ }
2916
+
2917
+ return response;
2918
+ }
2919
+ return Promise.reject('Peer is already blocked!');
2920
+ } catch (error) {
2921
+ console.log('setSessionMetaData Error -> ', error);
2922
+ return Promise.reject(error);
2923
+ }
2924
+ }
2925
+ },
2926
+ [hmsSessionStore, unpinMessage]
2927
+ );
2928
+
2929
+ const unblockPeer = useCallback(
2930
+ async (peer: HMSPeer) => {
2931
+ // If instance of HMSSessionStore is available
2932
+ if (hmsSessionStore) {
2933
+ try {
2934
+ const chatPeerBlacklist = store.getState().app.chatPeerBlacklist;
2935
+ if (
2936
+ peer.customerUserID &&
2937
+ chatPeerBlacklist.includes(peer.customerUserID)
2938
+ ) {
2939
+ const updatedChatPeerBlacklist = chatPeerBlacklist.filter(
2940
+ (peerUserId) => peerUserId !== peer.customerUserID
2941
+ );
2942
+ const response = await hmsSessionStore.set(
2943
+ updatedChatPeerBlacklist,
2944
+ 'chatPeerBlacklist'
2945
+ );
2946
+ console.log('setSessionMetaData Response -> ', response);
2947
+ return response;
2948
+ }
2949
+ return Promise.reject('Peer is already unblocked!');
2950
+ } catch (error) {
2951
+ console.log('setSessionMetaData Error -> ', error);
2952
+ return Promise.reject(error);
2953
+ }
2954
+ }
2955
+ },
2956
+ [hmsSessionStore]
2957
+ );
2958
+
2959
+ return { blockPeer, unblockPeer };
2960
+ };
2961
+
2962
+ export const useAllowBlockingPeerFromChat = () => {
2963
+ return useHMSChatLayoutConfig(
2964
+ (config) => config?.real_time_controls?.can_block_user ?? false
2965
+ );
2966
+ };