@ethora/chat-component-rn 26.10.9 → 26.10.11

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 (608) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +126 -1
  3. package/lib/commonjs/booking/index.js +44 -0
  4. package/lib/commonjs/booking/index.js.map +1 -0
  5. package/lib/commonjs/booking/pendingScheduledCall.js +275 -0
  6. package/lib/commonjs/booking/pendingScheduledCall.js.map +1 -0
  7. package/lib/commonjs/booking/scheduleForm.js +91 -0
  8. package/lib/commonjs/booking/scheduleForm.js.map +1 -0
  9. package/lib/commonjs/booking/scheduledCall.js +141 -0
  10. package/lib/commonjs/booking/scheduledCall.js.map +1 -0
  11. package/lib/commonjs/booking/scheduledCallActions.js +128 -0
  12. package/lib/commonjs/booking/scheduledCallActions.js.map +1 -0
  13. package/lib/commonjs/booking/scheduledCallLink.js +143 -0
  14. package/lib/commonjs/booking/scheduledCallLink.js.map +1 -0
  15. package/lib/commonjs/booking/scheduledCallStore.js +64 -0
  16. package/lib/commonjs/booking/scheduledCallStore.js.map +1 -0
  17. package/lib/commonjs/booking/startRoomCall.js +84 -0
  18. package/lib/commonjs/booking/startRoomCall.js.map +1 -0
  19. package/lib/commonjs/calls/callBusy.js +18 -0
  20. package/lib/commonjs/calls/callBusy.js.map +1 -0
  21. package/lib/commonjs/calls/callDisplay.js +73 -0
  22. package/lib/commonjs/calls/callDisplay.js.map +1 -0
  23. package/lib/commonjs/calls/callMode.js +175 -0
  24. package/lib/commonjs/calls/callMode.js.map +1 -0
  25. package/lib/commonjs/calls/declineReport.js +20 -0
  26. package/lib/commonjs/calls/declineReport.js.map +1 -0
  27. package/lib/commonjs/calls/p2p/P2PCallController.js +724 -0
  28. package/lib/commonjs/calls/p2p/P2PCallController.js.map +1 -0
  29. package/lib/commonjs/calls/p2p/icePolicy.js +107 -0
  30. package/lib/commonjs/calls/p2p/icePolicy.js.map +1 -0
  31. package/lib/commonjs/calls/p2p/negotiator.js +202 -0
  32. package/lib/commonjs/calls/p2p/negotiator.js.map +1 -0
  33. package/lib/commonjs/calls/p2p/p2pRuntime.js +147 -0
  34. package/lib/commonjs/calls/p2p/p2pRuntime.js.map +1 -0
  35. package/lib/commonjs/calls/p2p/signalInbox.js +98 -0
  36. package/lib/commonjs/calls/p2p/signalInbox.js.map +1 -0
  37. package/lib/commonjs/calls/p2p/signalStanza.js +141 -0
  38. package/lib/commonjs/calls/p2p/signalStanza.js.map +1 -0
  39. package/lib/commonjs/calls/p2p/webrtcRuntime.js +53 -0
  40. package/lib/commonjs/calls/p2p/webrtcRuntime.js.map +1 -0
  41. package/lib/commonjs/calls/senderTrust.js +43 -0
  42. package/lib/commonjs/calls/senderTrust.js.map +1 -0
  43. package/lib/commonjs/calls/startCall.js +51 -0
  44. package/lib/commonjs/calls/startCall.js.map +1 -0
  45. package/lib/commonjs/components/Booking/BookingIcons.js +55 -0
  46. package/lib/commonjs/components/Booking/BookingIcons.js.map +1 -0
  47. package/lib/commonjs/components/Booking/ScheduleCallButton.js +64 -0
  48. package/lib/commonjs/components/Booking/ScheduleCallButton.js.map +1 -0
  49. package/lib/commonjs/components/Booking/ScheduleCallSheet.js +351 -0
  50. package/lib/commonjs/components/Booking/ScheduleCallSheet.js.map +1 -0
  51. package/lib/commonjs/components/Booking/ScheduledCallCard.js +203 -0
  52. package/lib/commonjs/components/Booking/ScheduledCallCard.js.map +1 -0
  53. package/lib/commonjs/components/Booking/ScheduledCallHost.js +23 -0
  54. package/lib/commonjs/components/Booking/ScheduledCallHost.js.map +1 -0
  55. package/lib/commonjs/components/Booking/ScheduledCallMessage.js +55 -0
  56. package/lib/commonjs/components/Booking/ScheduledCallMessage.js.map +1 -0
  57. package/lib/commonjs/components/Booking/ScheduledCallPreJoin.js +235 -0
  58. package/lib/commonjs/components/Booking/ScheduledCallPreJoin.js.map +1 -0
  59. package/lib/commonjs/components/Booking/bookingShared.js +305 -0
  60. package/lib/commonjs/components/Booking/bookingShared.js.map +1 -0
  61. package/lib/commonjs/components/MainComponents/AlbumGrid.js +6 -2
  62. package/lib/commonjs/components/MainComponents/AlbumGrid.js.map +1 -1
  63. package/lib/commonjs/components/MainComponents/ChatHeader.js +18 -12
  64. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  65. package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js +5 -2
  66. package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js.map +1 -1
  67. package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js +6 -3
  68. package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js.map +1 -1
  69. package/lib/commonjs/components/MainComponents/MediaMessage.js +13 -0
  70. package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
  71. package/lib/commonjs/components/MainComponents/MessageContainer.js +13 -0
  72. package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
  73. package/lib/commonjs/components/MainComponents/ReduxWrapper.js +10 -0
  74. package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
  75. package/lib/commonjs/components/MainComponents/RoomList.js +7 -16
  76. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  77. package/lib/commonjs/components/MessageBubble/Message.js +27 -1
  78. package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
  79. package/lib/commonjs/components/Modals/ChatProfileModal/ChatMediaGrid.js +159 -0
  80. package/lib/commonjs/components/Modals/ChatProfileModal/ChatMediaGrid.js.map +1 -0
  81. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +203 -134
  82. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  83. package/lib/commonjs/components/Modals/ChatProfileModal/LeaveChatModal.js +180 -0
  84. package/lib/commonjs/components/Modals/ChatProfileModal/LeaveChatModal.js.map +1 -0
  85. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +19 -15
  86. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
  87. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +100 -162
  88. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  89. package/lib/commonjs/components/Modals/FilePreviewModal/MediaViewer.js +824 -0
  90. package/lib/commonjs/components/Modals/FilePreviewModal/MediaViewer.js.map +1 -0
  91. package/lib/commonjs/components/Modals/FilePreviewModal/useSaveFile.js +179 -0
  92. package/lib/commonjs/components/Modals/FilePreviewModal/useSaveFile.js.map +1 -0
  93. package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js +22 -5
  94. package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -1
  95. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +15 -8
  96. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  97. package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js +1 -1
  98. package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -1
  99. package/lib/commonjs/components/VideoCalls/ActiveCallBar.js +3 -2
  100. package/lib/commonjs/components/VideoCalls/ActiveCallBar.js.map +1 -1
  101. package/lib/commonjs/components/VideoCalls/CallButtons.js +19 -11
  102. package/lib/commonjs/components/VideoCalls/CallButtons.js.map +1 -1
  103. package/lib/commonjs/components/VideoCalls/CallControlBar.js +119 -0
  104. package/lib/commonjs/components/VideoCalls/CallControlBar.js.map +1 -0
  105. package/lib/commonjs/components/VideoCalls/CallVideo.js +49 -0
  106. package/lib/commonjs/components/VideoCalls/CallVideo.js.map +1 -0
  107. package/lib/commonjs/components/VideoCalls/GroupCallView.js +281 -0
  108. package/lib/commonjs/components/VideoCalls/GroupCallView.js.map +1 -0
  109. package/lib/commonjs/components/VideoCalls/P2PCallRunner.js +151 -0
  110. package/lib/commonjs/components/VideoCalls/P2PCallRunner.js.map +1 -0
  111. package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js +38 -14
  112. package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js.map +1 -1
  113. package/lib/commonjs/components/VideoCalls/VideoCallSession.js +57 -128
  114. package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
  115. package/lib/commonjs/components/VideoCalls/callActions.js +3 -0
  116. package/lib/commonjs/components/VideoCalls/callActions.js.map +1 -1
  117. package/lib/commonjs/components/VideoCalls/callElapsed.js +38 -0
  118. package/lib/commonjs/components/VideoCalls/callElapsed.js.map +1 -0
  119. package/lib/commonjs/components/VideoCalls/callLive.js +15 -0
  120. package/lib/commonjs/components/VideoCalls/callLive.js.map +1 -0
  121. package/lib/commonjs/components/VideoCalls/callSessionController.js +81 -24
  122. package/lib/commonjs/components/VideoCalls/callSessionController.js.map +1 -1
  123. package/lib/commonjs/components/VideoCalls/callSessionTypes.js +41 -0
  124. package/lib/commonjs/components/VideoCalls/callSessionTypes.js.map +1 -0
  125. package/lib/commonjs/components/VideoCalls/groupLayout.js +43 -0
  126. package/lib/commonjs/components/VideoCalls/groupLayout.js.map +1 -0
  127. package/lib/commonjs/components/VideoCalls/p2pCallSession.js +272 -0
  128. package/lib/commonjs/components/VideoCalls/p2pCallSession.js.map +1 -0
  129. package/lib/commonjs/components/VideoCalls/useCallKeep.js +7 -2
  130. package/lib/commonjs/components/VideoCalls/useCallKeep.js.map +1 -1
  131. package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js +2 -1
  132. package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js.map +1 -1
  133. package/lib/commonjs/components/styled/MessageImage.js +4 -1
  134. package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
  135. package/lib/commonjs/components/styled/VideoMessage.js +5 -1
  136. package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
  137. package/lib/commonjs/context/MediaSourceContext.js +18 -0
  138. package/lib/commonjs/context/MediaSourceContext.js.map +1 -0
  139. package/lib/commonjs/context/xmppProvider.js +2 -1
  140. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  141. package/lib/commonjs/helpers/callPush.js +3 -1
  142. package/lib/commonjs/helpers/callPush.js.map +1 -1
  143. package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js +3 -1
  144. package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
  145. package/lib/commonjs/helpers/constants/MODAL_TYPES.js +2 -0
  146. package/lib/commonjs/helpers/constants/MODAL_TYPES.js.map +1 -1
  147. package/lib/commonjs/helpers/incomingCallFromPush.js +63 -7
  148. package/lib/commonjs/helpers/incomingCallFromPush.js.map +1 -1
  149. package/lib/commonjs/helpers/publicChatsEntry.js +8 -6
  150. package/lib/commonjs/helpers/publicChatsEntry.js.map +1 -1
  151. package/lib/commonjs/helpers/pushPayload.js +5 -0
  152. package/lib/commonjs/helpers/pushPayload.js.map +1 -1
  153. package/lib/commonjs/helpers/reportRoom.js +76 -0
  154. package/lib/commonjs/helpers/reportRoom.js.map +1 -0
  155. package/lib/commonjs/helpers/roomMedia.js +118 -0
  156. package/lib/commonjs/helpers/roomMedia.js.map +1 -0
  157. package/lib/commonjs/i18n/strings.js +480 -0
  158. package/lib/commonjs/i18n/strings.js.map +1 -1
  159. package/lib/commonjs/main.js +93 -0
  160. package/lib/commonjs/main.js.map +1 -1
  161. package/lib/commonjs/networking/api-requests/callState.api.js +75 -0
  162. package/lib/commonjs/networking/api-requests/callState.api.js.map +1 -0
  163. package/lib/commonjs/networking/api-requests/push.api.js +29 -6
  164. package/lib/commonjs/networking/api-requests/push.api.js.map +1 -1
  165. package/lib/commonjs/networking/api-requests/rooms.api.js +17 -15
  166. package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
  167. package/lib/commonjs/networking/api-requests/scheduledCalls.api.js +141 -0
  168. package/lib/commonjs/networking/api-requests/scheduledCalls.api.js.map +1 -0
  169. package/lib/commonjs/networking/callTokenStanza.js +210 -50
  170. package/lib/commonjs/networking/callTokenStanza.js.map +1 -1
  171. package/lib/commonjs/roomStore/callSlice.js +59 -4
  172. package/lib/commonjs/roomStore/callSlice.js.map +1 -1
  173. package/lib/commonjs/services/appBadge.js +80 -0
  174. package/lib/commonjs/services/appBadge.js.map +1 -0
  175. package/lib/commonjs/services/languageSettings.js +47 -15
  176. package/lib/commonjs/services/languageSettings.js.map +1 -1
  177. package/lib/commonjs/services/pushRegistration.js +21 -5
  178. package/lib/commonjs/services/pushRegistration.js.map +1 -1
  179. package/lib/commonjs/version.js +1 -1
  180. package/lib/commonjs/version.js.map +1 -1
  181. package/lib/module/booking/index.js +5 -0
  182. package/lib/module/booking/index.js.map +1 -0
  183. package/lib/module/booking/pendingScheduledCall.js +261 -0
  184. package/lib/module/booking/pendingScheduledCall.js.map +1 -0
  185. package/lib/module/booking/scheduleForm.js +79 -0
  186. package/lib/module/booking/scheduleForm.js.map +1 -0
  187. package/lib/module/booking/scheduledCall.js +129 -0
  188. package/lib/module/booking/scheduledCall.js.map +1 -0
  189. package/lib/module/booking/scheduledCallActions.js +118 -0
  190. package/lib/module/booking/scheduledCallActions.js.map +1 -0
  191. package/lib/module/booking/scheduledCallLink.js +136 -0
  192. package/lib/module/booking/scheduledCallLink.js.map +1 -0
  193. package/lib/module/booking/scheduledCallStore.js +60 -0
  194. package/lib/module/booking/scheduledCallStore.js.map +1 -0
  195. package/lib/module/booking/startRoomCall.js +80 -0
  196. package/lib/module/booking/startRoomCall.js.map +1 -0
  197. package/lib/module/calls/callBusy.js +13 -0
  198. package/lib/module/calls/callBusy.js.map +1 -0
  199. package/lib/module/calls/callDisplay.js +65 -0
  200. package/lib/module/calls/callDisplay.js.map +1 -0
  201. package/lib/module/calls/callMode.js +168 -0
  202. package/lib/module/calls/callMode.js.map +1 -0
  203. package/lib/module/calls/declineReport.js +16 -0
  204. package/lib/module/calls/declineReport.js.map +1 -0
  205. package/lib/module/calls/p2p/P2PCallController.js +718 -0
  206. package/lib/module/calls/p2p/P2PCallController.js.map +1 -0
  207. package/lib/module/calls/p2p/icePolicy.js +102 -0
  208. package/lib/module/calls/p2p/icePolicy.js.map +1 -0
  209. package/lib/module/calls/p2p/negotiator.js +197 -0
  210. package/lib/module/calls/p2p/negotiator.js.map +1 -0
  211. package/lib/module/calls/p2p/p2pRuntime.js +137 -0
  212. package/lib/module/calls/p2p/p2pRuntime.js.map +1 -0
  213. package/lib/module/calls/p2p/signalInbox.js +93 -0
  214. package/lib/module/calls/p2p/signalInbox.js.map +1 -0
  215. package/lib/module/calls/p2p/signalStanza.js +135 -0
  216. package/lib/module/calls/p2p/signalStanza.js.map +1 -0
  217. package/lib/module/calls/p2p/webrtcRuntime.js +46 -0
  218. package/lib/module/calls/p2p/webrtcRuntime.js.map +1 -0
  219. package/lib/module/calls/senderTrust.js +38 -0
  220. package/lib/module/calls/senderTrust.js.map +1 -0
  221. package/lib/module/calls/startCall.js +47 -0
  222. package/lib/module/calls/startCall.js.map +1 -0
  223. package/lib/module/components/Booking/BookingIcons.js +48 -0
  224. package/lib/module/components/Booking/BookingIcons.js.map +1 -0
  225. package/lib/module/components/Booking/ScheduleCallButton.js +59 -0
  226. package/lib/module/components/Booking/ScheduleCallButton.js.map +1 -0
  227. package/lib/module/components/Booking/ScheduleCallSheet.js +345 -0
  228. package/lib/module/components/Booking/ScheduleCallSheet.js.map +1 -0
  229. package/lib/module/components/Booking/ScheduledCallCard.js +197 -0
  230. package/lib/module/components/Booking/ScheduledCallCard.js.map +1 -0
  231. package/lib/module/components/Booking/ScheduledCallHost.js +18 -0
  232. package/lib/module/components/Booking/ScheduledCallHost.js.map +1 -0
  233. package/lib/module/components/Booking/ScheduledCallMessage.js +48 -0
  234. package/lib/module/components/Booking/ScheduledCallMessage.js.map +1 -0
  235. package/lib/module/components/Booking/ScheduledCallPreJoin.js +229 -0
  236. package/lib/module/components/Booking/ScheduledCallPreJoin.js.map +1 -0
  237. package/lib/module/components/Booking/bookingShared.js +291 -0
  238. package/lib/module/components/Booking/bookingShared.js.map +1 -0
  239. package/lib/module/components/MainComponents/AlbumGrid.js +6 -2
  240. package/lib/module/components/MainComponents/AlbumGrid.js.map +1 -1
  241. package/lib/module/components/MainComponents/ChatHeader.js +20 -14
  242. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  243. package/lib/module/components/MainComponents/LanguageSelectorButton.js +5 -2
  244. package/lib/module/components/MainComponents/LanguageSelectorButton.js.map +1 -1
  245. package/lib/module/components/MainComponents/LanguageSelectorModal.js +7 -4
  246. package/lib/module/components/MainComponents/LanguageSelectorModal.js.map +1 -1
  247. package/lib/module/components/MainComponents/MediaMessage.js +13 -0
  248. package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
  249. package/lib/module/components/MainComponents/MessageContainer.js +13 -0
  250. package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
  251. package/lib/module/components/MainComponents/ReduxWrapper.js +10 -0
  252. package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
  253. package/lib/module/components/MainComponents/RoomList.js +7 -16
  254. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  255. package/lib/module/components/MessageBubble/Message.js +27 -1
  256. package/lib/module/components/MessageBubble/Message.js.map +1 -1
  257. package/lib/module/components/Modals/ChatProfileModal/ChatMediaGrid.js +154 -0
  258. package/lib/module/components/Modals/ChatProfileModal/ChatMediaGrid.js.map +1 -0
  259. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +204 -136
  260. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  261. package/lib/module/components/Modals/ChatProfileModal/LeaveChatModal.js +175 -0
  262. package/lib/module/components/Modals/ChatProfileModal/LeaveChatModal.js.map +1 -0
  263. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +21 -15
  264. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
  265. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +100 -163
  266. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  267. package/lib/module/components/Modals/FilePreviewModal/MediaViewer.js +819 -0
  268. package/lib/module/components/Modals/FilePreviewModal/MediaViewer.js.map +1 -0
  269. package/lib/module/components/Modals/FilePreviewModal/useSaveFile.js +172 -0
  270. package/lib/module/components/Modals/FilePreviewModal/useSaveFile.js.map +1 -0
  271. package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js +20 -4
  272. package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -1
  273. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +17 -10
  274. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  275. package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js +1 -1
  276. package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -1
  277. package/lib/module/components/VideoCalls/ActiveCallBar.js +3 -2
  278. package/lib/module/components/VideoCalls/ActiveCallBar.js.map +1 -1
  279. package/lib/module/components/VideoCalls/CallButtons.js +19 -11
  280. package/lib/module/components/VideoCalls/CallButtons.js.map +1 -1
  281. package/lib/module/components/VideoCalls/CallControlBar.js +113 -0
  282. package/lib/module/components/VideoCalls/CallControlBar.js.map +1 -0
  283. package/lib/module/components/VideoCalls/CallVideo.js +43 -0
  284. package/lib/module/components/VideoCalls/CallVideo.js.map +1 -0
  285. package/lib/module/components/VideoCalls/GroupCallView.js +275 -0
  286. package/lib/module/components/VideoCalls/GroupCallView.js.map +1 -0
  287. package/lib/module/components/VideoCalls/P2PCallRunner.js +147 -0
  288. package/lib/module/components/VideoCalls/P2PCallRunner.js.map +1 -0
  289. package/lib/module/components/VideoCalls/VideoCallOverlay.js +38 -14
  290. package/lib/module/components/VideoCalls/VideoCallOverlay.js.map +1 -1
  291. package/lib/module/components/VideoCalls/VideoCallSession.js +46 -127
  292. package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
  293. package/lib/module/components/VideoCalls/callActions.js +3 -0
  294. package/lib/module/components/VideoCalls/callActions.js.map +1 -1
  295. package/lib/module/components/VideoCalls/callElapsed.js +33 -0
  296. package/lib/module/components/VideoCalls/callElapsed.js.map +1 -0
  297. package/lib/module/components/VideoCalls/callLive.js +10 -0
  298. package/lib/module/components/VideoCalls/callLive.js.map +1 -0
  299. package/lib/module/components/VideoCalls/callSessionController.js +80 -24
  300. package/lib/module/components/VideoCalls/callSessionController.js.map +1 -1
  301. package/lib/module/components/VideoCalls/callSessionTypes.js +37 -0
  302. package/lib/module/components/VideoCalls/callSessionTypes.js.map +1 -0
  303. package/lib/module/components/VideoCalls/groupLayout.js +36 -0
  304. package/lib/module/components/VideoCalls/groupLayout.js.map +1 -0
  305. package/lib/module/components/VideoCalls/p2pCallSession.js +256 -0
  306. package/lib/module/components/VideoCalls/p2pCallSession.js.map +1 -0
  307. package/lib/module/components/VideoCalls/useCallKeep.js +8 -2
  308. package/lib/module/components/VideoCalls/useCallKeep.js.map +1 -1
  309. package/lib/module/components/VideoCalls/useOngoingCallNotification.js +2 -1
  310. package/lib/module/components/VideoCalls/useOngoingCallNotification.js.map +1 -1
  311. package/lib/module/components/styled/MessageImage.js +4 -1
  312. package/lib/module/components/styled/MessageImage.js.map +1 -1
  313. package/lib/module/components/styled/VideoMessage.js +5 -1
  314. package/lib/module/components/styled/VideoMessage.js.map +1 -1
  315. package/lib/module/context/MediaSourceContext.js +13 -0
  316. package/lib/module/context/MediaSourceContext.js.map +1 -0
  317. package/lib/module/context/xmppProvider.js +2 -1
  318. package/lib/module/context/xmppProvider.js.map +1 -1
  319. package/lib/module/helpers/callPush.js +3 -1
  320. package/lib/module/helpers/callPush.js.map +1 -1
  321. package/lib/module/helpers/constants/MODAL_COMPONENTS.js +2 -1
  322. package/lib/module/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
  323. package/lib/module/helpers/constants/MODAL_TYPES.js +2 -0
  324. package/lib/module/helpers/constants/MODAL_TYPES.js.map +1 -1
  325. package/lib/module/helpers/incomingCallFromPush.js +63 -7
  326. package/lib/module/helpers/incomingCallFromPush.js.map +1 -1
  327. package/lib/module/helpers/publicChatsEntry.js +8 -6
  328. package/lib/module/helpers/publicChatsEntry.js.map +1 -1
  329. package/lib/module/helpers/pushPayload.js +5 -0
  330. package/lib/module/helpers/pushPayload.js.map +1 -1
  331. package/lib/module/helpers/reportRoom.js +70 -0
  332. package/lib/module/helpers/reportRoom.js.map +1 -0
  333. package/lib/module/helpers/roomMedia.js +112 -0
  334. package/lib/module/helpers/roomMedia.js.map +1 -0
  335. package/lib/module/i18n/strings.js +480 -0
  336. package/lib/module/i18n/strings.js.map +1 -1
  337. package/lib/module/main.js +5 -0
  338. package/lib/module/main.js.map +1 -1
  339. package/lib/module/networking/api-requests/callState.api.js +66 -0
  340. package/lib/module/networking/api-requests/callState.api.js.map +1 -0
  341. package/lib/module/networking/api-requests/push.api.js +29 -6
  342. package/lib/module/networking/api-requests/push.api.js.map +1 -1
  343. package/lib/module/networking/api-requests/rooms.api.js +17 -15
  344. package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
  345. package/lib/module/networking/api-requests/scheduledCalls.api.js +130 -0
  346. package/lib/module/networking/api-requests/scheduledCalls.api.js.map +1 -0
  347. package/lib/module/networking/callTokenStanza.js +210 -50
  348. package/lib/module/networking/callTokenStanza.js.map +1 -1
  349. package/lib/module/roomStore/callSlice.js +57 -3
  350. package/lib/module/roomStore/callSlice.js.map +1 -1
  351. package/lib/module/services/appBadge.js +74 -0
  352. package/lib/module/services/appBadge.js.map +1 -0
  353. package/lib/module/services/languageSettings.js +44 -13
  354. package/lib/module/services/languageSettings.js.map +1 -1
  355. package/lib/module/services/pushRegistration.js +21 -5
  356. package/lib/module/services/pushRegistration.js.map +1 -1
  357. package/lib/module/version.js +1 -1
  358. package/lib/module/version.js.map +1 -1
  359. package/lib/typescript/booking/index.d.ts +3 -0
  360. package/lib/typescript/booking/index.d.ts.map +1 -0
  361. package/lib/typescript/booking/pendingScheduledCall.d.ts +80 -0
  362. package/lib/typescript/booking/pendingScheduledCall.d.ts.map +1 -0
  363. package/lib/typescript/booking/scheduleForm.d.ts +28 -0
  364. package/lib/typescript/booking/scheduleForm.d.ts.map +1 -0
  365. package/lib/typescript/booking/scheduledCall.d.ts +52 -0
  366. package/lib/typescript/booking/scheduledCall.d.ts.map +1 -0
  367. package/lib/typescript/booking/scheduledCallActions.d.ts +22 -0
  368. package/lib/typescript/booking/scheduledCallActions.d.ts.map +1 -0
  369. package/lib/typescript/booking/scheduledCallLink.d.ts +37 -0
  370. package/lib/typescript/booking/scheduledCallLink.d.ts.map +1 -0
  371. package/lib/typescript/booking/scheduledCallStore.d.ts +47 -0
  372. package/lib/typescript/booking/scheduledCallStore.d.ts.map +1 -0
  373. package/lib/typescript/booking/startRoomCall.d.ts +12 -0
  374. package/lib/typescript/booking/startRoomCall.d.ts.map +1 -0
  375. package/lib/typescript/calls/callBusy.d.ts +9 -0
  376. package/lib/typescript/calls/callBusy.d.ts.map +1 -0
  377. package/lib/typescript/calls/callDisplay.d.ts +23 -0
  378. package/lib/typescript/calls/callDisplay.d.ts.map +1 -0
  379. package/lib/typescript/calls/callMode.d.ts +106 -0
  380. package/lib/typescript/calls/callMode.d.ts.map +1 -0
  381. package/lib/typescript/calls/declineReport.d.ts +11 -0
  382. package/lib/typescript/calls/declineReport.d.ts.map +1 -0
  383. package/lib/typescript/calls/p2p/P2PCallController.d.ts +150 -0
  384. package/lib/typescript/calls/p2p/P2PCallController.d.ts.map +1 -0
  385. package/lib/typescript/calls/p2p/icePolicy.d.ts +37 -0
  386. package/lib/typescript/calls/p2p/icePolicy.d.ts.map +1 -0
  387. package/lib/typescript/calls/p2p/negotiator.d.ts +57 -0
  388. package/lib/typescript/calls/p2p/negotiator.d.ts.map +1 -0
  389. package/lib/typescript/calls/p2p/p2pRuntime.d.ts +41 -0
  390. package/lib/typescript/calls/p2p/p2pRuntime.d.ts.map +1 -0
  391. package/lib/typescript/calls/p2p/signalInbox.d.ts +35 -0
  392. package/lib/typescript/calls/p2p/signalInbox.d.ts.map +1 -0
  393. package/lib/typescript/calls/p2p/signalStanza.d.ts +52 -0
  394. package/lib/typescript/calls/p2p/signalStanza.d.ts.map +1 -0
  395. package/lib/typescript/calls/p2p/webrtcRuntime.d.ts +32 -0
  396. package/lib/typescript/calls/p2p/webrtcRuntime.d.ts.map +1 -0
  397. package/lib/typescript/calls/senderTrust.d.ts +8 -0
  398. package/lib/typescript/calls/senderTrust.d.ts.map +1 -0
  399. package/lib/typescript/calls/startCall.d.ts +17 -0
  400. package/lib/typescript/calls/startCall.d.ts.map +1 -0
  401. package/lib/typescript/components/Booking/BookingIcons.d.ts +9 -0
  402. package/lib/typescript/components/Booking/BookingIcons.d.ts.map +1 -0
  403. package/lib/typescript/components/Booking/ScheduleCallButton.d.ts +11 -0
  404. package/lib/typescript/components/Booking/ScheduleCallButton.d.ts.map +1 -0
  405. package/lib/typescript/components/Booking/ScheduleCallSheet.d.ts +4 -0
  406. package/lib/typescript/components/Booking/ScheduleCallSheet.d.ts.map +1 -0
  407. package/lib/typescript/components/Booking/ScheduledCallCard.d.ts +14 -0
  408. package/lib/typescript/components/Booking/ScheduledCallCard.d.ts.map +1 -0
  409. package/lib/typescript/components/Booking/ScheduledCallHost.d.ts +10 -0
  410. package/lib/typescript/components/Booking/ScheduledCallHost.d.ts.map +1 -0
  411. package/lib/typescript/components/Booking/ScheduledCallMessage.d.ts +20 -0
  412. package/lib/typescript/components/Booking/ScheduledCallMessage.d.ts.map +1 -0
  413. package/lib/typescript/components/Booking/ScheduledCallPreJoin.d.ts +8 -0
  414. package/lib/typescript/components/Booking/ScheduledCallPreJoin.d.ts.map +1 -0
  415. package/lib/typescript/components/Booking/bookingShared.d.ts +199 -0
  416. package/lib/typescript/components/Booking/bookingShared.d.ts.map +1 -0
  417. package/lib/typescript/components/MainComponents/AlbumGrid.d.ts.map +1 -1
  418. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  419. package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts +3 -1
  420. package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts.map +1 -1
  421. package/lib/typescript/components/MainComponents/LanguageSelectorModal.d.ts.map +1 -1
  422. package/lib/typescript/components/MainComponents/MediaMessage.d.ts +3 -1
  423. package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
  424. package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
  425. package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
  426. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  427. package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
  428. package/lib/typescript/components/Modals/ChatProfileModal/ChatMediaGrid.d.ts +16 -0
  429. package/lib/typescript/components/Modals/ChatProfileModal/ChatMediaGrid.d.ts.map +1 -0
  430. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  431. package/lib/typescript/components/Modals/ChatProfileModal/LeaveChatModal.d.ts +18 -0
  432. package/lib/typescript/components/Modals/ChatProfileModal/LeaveChatModal.d.ts.map +1 -0
  433. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -1
  434. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts +16 -0
  435. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  436. package/lib/typescript/components/Modals/FilePreviewModal/MediaViewer.d.ts +27 -0
  437. package/lib/typescript/components/Modals/FilePreviewModal/MediaViewer.d.ts.map +1 -0
  438. package/lib/typescript/components/Modals/FilePreviewModal/useSaveFile.d.ts +9 -0
  439. package/lib/typescript/components/Modals/FilePreviewModal/useSaveFile.d.ts.map +1 -0
  440. package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts +8 -0
  441. package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts.map +1 -1
  442. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  443. package/lib/typescript/components/Modals/UserSettingsModal/LanguageCard.d.ts.map +1 -1
  444. package/lib/typescript/components/VideoCalls/ActiveCallBar.d.ts.map +1 -1
  445. package/lib/typescript/components/VideoCalls/CallButtons.d.ts +2 -1
  446. package/lib/typescript/components/VideoCalls/CallButtons.d.ts.map +1 -1
  447. package/lib/typescript/components/VideoCalls/CallControlBar.d.ts +17 -0
  448. package/lib/typescript/components/VideoCalls/CallControlBar.d.ts.map +1 -0
  449. package/lib/typescript/components/VideoCalls/CallVideo.d.ts +23 -0
  450. package/lib/typescript/components/VideoCalls/CallVideo.d.ts.map +1 -0
  451. package/lib/typescript/components/VideoCalls/GroupCallView.d.ts +22 -0
  452. package/lib/typescript/components/VideoCalls/GroupCallView.d.ts.map +1 -0
  453. package/lib/typescript/components/VideoCalls/P2PCallRunner.d.ts +2 -0
  454. package/lib/typescript/components/VideoCalls/P2PCallRunner.d.ts.map +1 -0
  455. package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts.map +1 -1
  456. package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts +10 -12
  457. package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
  458. package/lib/typescript/components/VideoCalls/callActions.d.ts.map +1 -1
  459. package/lib/typescript/components/VideoCalls/callElapsed.d.ts +8 -0
  460. package/lib/typescript/components/VideoCalls/callElapsed.d.ts.map +1 -0
  461. package/lib/typescript/components/VideoCalls/callLive.d.ts +9 -0
  462. package/lib/typescript/components/VideoCalls/callLive.d.ts.map +1 -0
  463. package/lib/typescript/components/VideoCalls/callSessionController.d.ts +10 -31
  464. package/lib/typescript/components/VideoCalls/callSessionController.d.ts.map +1 -1
  465. package/lib/typescript/components/VideoCalls/callSessionTypes.d.ts +60 -0
  466. package/lib/typescript/components/VideoCalls/callSessionTypes.d.ts.map +1 -0
  467. package/lib/typescript/components/VideoCalls/groupLayout.d.ts +23 -0
  468. package/lib/typescript/components/VideoCalls/groupLayout.d.ts.map +1 -0
  469. package/lib/typescript/components/VideoCalls/p2pCallSession.d.ts +31 -0
  470. package/lib/typescript/components/VideoCalls/p2pCallSession.d.ts.map +1 -0
  471. package/lib/typescript/components/VideoCalls/useCallKeep.d.ts.map +1 -1
  472. package/lib/typescript/components/VideoCalls/useOngoingCallNotification.d.ts.map +1 -1
  473. package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
  474. package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
  475. package/lib/typescript/context/MediaSourceContext.d.ts +4 -0
  476. package/lib/typescript/context/MediaSourceContext.d.ts.map +1 -0
  477. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  478. package/lib/typescript/helpers/callPush.d.ts +11 -1
  479. package/lib/typescript/helpers/callPush.d.ts.map +1 -1
  480. package/lib/typescript/helpers/constants/MODAL_COMPONENTS.d.ts.map +1 -1
  481. package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts +2 -0
  482. package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts.map +1 -1
  483. package/lib/typescript/helpers/incomingCallFromPush.d.ts.map +1 -1
  484. package/lib/typescript/helpers/publicChatsEntry.d.ts +7 -5
  485. package/lib/typescript/helpers/publicChatsEntry.d.ts.map +1 -1
  486. package/lib/typescript/helpers/pushPayload.d.ts +1 -1
  487. package/lib/typescript/helpers/pushPayload.d.ts.map +1 -1
  488. package/lib/typescript/helpers/reportRoom.d.ts +19 -0
  489. package/lib/typescript/helpers/reportRoom.d.ts.map +1 -0
  490. package/lib/typescript/helpers/roomMedia.d.ts +26 -0
  491. package/lib/typescript/helpers/roomMedia.d.ts.map +1 -0
  492. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  493. package/lib/typescript/main.d.ts +6 -1
  494. package/lib/typescript/main.d.ts.map +1 -1
  495. package/lib/typescript/networking/api-requests/callState.api.d.ts +25 -0
  496. package/lib/typescript/networking/api-requests/callState.api.d.ts.map +1 -0
  497. package/lib/typescript/networking/api-requests/push.api.d.ts +9 -2
  498. package/lib/typescript/networking/api-requests/push.api.d.ts.map +1 -1
  499. package/lib/typescript/networking/api-requests/rooms.api.d.ts +8 -6
  500. package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
  501. package/lib/typescript/networking/api-requests/scheduledCalls.api.d.ts +86 -0
  502. package/lib/typescript/networking/api-requests/scheduledCalls.api.d.ts.map +1 -0
  503. package/lib/typescript/networking/callTokenStanza.d.ts.map +1 -1
  504. package/lib/typescript/roomStore/callSlice.d.ts +23 -1
  505. package/lib/typescript/roomStore/callSlice.d.ts.map +1 -1
  506. package/lib/typescript/services/appBadge.d.ts +3 -0
  507. package/lib/typescript/services/appBadge.d.ts.map +1 -0
  508. package/lib/typescript/services/languageSettings.d.ts +7 -0
  509. package/lib/typescript/services/languageSettings.d.ts.map +1 -1
  510. package/lib/typescript/services/pushRegistration.d.ts.map +1 -1
  511. package/lib/typescript/types/models/modal.model.d.ts +18 -0
  512. package/lib/typescript/types/models/modal.model.d.ts.map +1 -1
  513. package/lib/typescript/types/types.d.ts +85 -4
  514. package/lib/typescript/types/types.d.ts.map +1 -1
  515. package/lib/typescript/version.d.ts +1 -1
  516. package/lib/typescript/version.d.ts.map +1 -1
  517. package/package.json +9 -2
  518. package/src/booking/index.ts +10 -0
  519. package/src/booking/pendingScheduledCall.ts +272 -0
  520. package/src/booking/scheduleForm.ts +84 -0
  521. package/src/booking/scheduledCall.ts +163 -0
  522. package/src/booking/scheduledCallActions.ts +141 -0
  523. package/src/booking/scheduledCallLink.ts +145 -0
  524. package/src/booking/scheduledCallStore.ts +69 -0
  525. package/src/booking/startRoomCall.ts +103 -0
  526. package/src/calls/callBusy.ts +10 -0
  527. package/src/calls/callDisplay.ts +74 -0
  528. package/src/calls/callMode.ts +286 -0
  529. package/src/calls/declineReport.ts +16 -0
  530. package/src/calls/p2p/P2PCallController.ts +813 -0
  531. package/src/calls/p2p/icePolicy.ts +99 -0
  532. package/src/calls/p2p/negotiator.ts +186 -0
  533. package/src/calls/p2p/p2pRuntime.ts +164 -0
  534. package/src/calls/p2p/signalInbox.ts +117 -0
  535. package/src/calls/p2p/signalStanza.ts +205 -0
  536. package/src/calls/p2p/webrtcRuntime.ts +60 -0
  537. package/src/calls/senderTrust.ts +40 -0
  538. package/src/calls/startCall.ts +56 -0
  539. package/src/components/Booking/BookingIcons.tsx +44 -0
  540. package/src/components/Booking/ScheduleCallButton.tsx +66 -0
  541. package/src/components/Booking/ScheduleCallSheet.tsx +380 -0
  542. package/src/components/Booking/ScheduledCallCard.tsx +216 -0
  543. package/src/components/Booking/ScheduledCallHost.tsx +18 -0
  544. package/src/components/Booking/ScheduledCallMessage.tsx +62 -0
  545. package/src/components/Booking/ScheduledCallPreJoin.tsx +230 -0
  546. package/src/components/Booking/bookingShared.tsx +295 -0
  547. package/src/components/MainComponents/AlbumGrid.tsx +5 -1
  548. package/src/components/MainComponents/ChatHeader.tsx +18 -11
  549. package/src/components/MainComponents/LanguageSelectorButton.tsx +9 -2
  550. package/src/components/MainComponents/LanguageSelectorModal.tsx +10 -6
  551. package/src/components/MainComponents/MediaMessage.tsx +13 -2
  552. package/src/components/MainComponents/MessageContainer.tsx +15 -0
  553. package/src/components/MainComponents/ReduxWrapper.tsx +10 -0
  554. package/src/components/MainComponents/RoomList.tsx +8 -19
  555. package/src/components/MessageBubble/Message.tsx +24 -1
  556. package/src/components/Modals/ChatProfileModal/ChatMediaGrid.tsx +174 -0
  557. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +119 -48
  558. package/src/components/Modals/ChatProfileModal/LeaveChatModal.tsx +191 -0
  559. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +22 -22
  560. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +115 -185
  561. package/src/components/Modals/FilePreviewModal/MediaViewer.tsx +880 -0
  562. package/src/components/Modals/FilePreviewModal/useSaveFile.ts +207 -0
  563. package/src/components/Modals/MessageSearchModal/MessageSearchModal.tsx +56 -30
  564. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +28 -9
  565. package/src/components/Modals/UserSettingsModal/LanguageCard.tsx +9 -7
  566. package/src/components/VideoCalls/ActiveCallBar.tsx +6 -5
  567. package/src/components/VideoCalls/CallButtons.tsx +23 -12
  568. package/src/components/VideoCalls/CallControlBar.tsx +131 -0
  569. package/src/components/VideoCalls/CallVideo.tsx +59 -0
  570. package/src/components/VideoCalls/GroupCallView.tsx +324 -0
  571. package/src/components/VideoCalls/P2PCallRunner.tsx +192 -0
  572. package/src/components/VideoCalls/VideoCallOverlay.tsx +62 -17
  573. package/src/components/VideoCalls/VideoCallSession.tsx +55 -133
  574. package/src/components/VideoCalls/callActions.ts +3 -0
  575. package/src/components/VideoCalls/callElapsed.ts +27 -0
  576. package/src/components/VideoCalls/callLive.ts +13 -0
  577. package/src/components/VideoCalls/callSessionController.ts +130 -55
  578. package/src/components/VideoCalls/callSessionTypes.ts +80 -0
  579. package/src/components/VideoCalls/groupLayout.ts +48 -0
  580. package/src/components/VideoCalls/p2pCallSession.ts +291 -0
  581. package/src/components/VideoCalls/useCallKeep.ts +9 -2
  582. package/src/components/VideoCalls/useOngoingCallNotification.ts +2 -2
  583. package/src/components/styled/MessageImage.tsx +3 -1
  584. package/src/components/styled/VideoMessage.tsx +5 -1
  585. package/src/context/MediaSourceContext.tsx +14 -0
  586. package/src/context/xmppProvider.tsx +3 -0
  587. package/src/helpers/callPush.ts +13 -1
  588. package/src/helpers/constants/MODAL_COMPONENTS.tsx +4 -1
  589. package/src/helpers/constants/MODAL_TYPES.ts +2 -0
  590. package/src/helpers/incomingCallFromPush.ts +65 -7
  591. package/src/helpers/publicChatsEntry.ts +8 -7
  592. package/src/helpers/pushPayload.ts +9 -1
  593. package/src/helpers/reportRoom.ts +93 -0
  594. package/src/helpers/roomMedia.ts +126 -0
  595. package/src/i18n/strings.ts +480 -0
  596. package/src/main.ts +33 -0
  597. package/src/networking/api-requests/callState.api.ts +83 -0
  598. package/src/networking/api-requests/push.api.ts +28 -3
  599. package/src/networking/api-requests/rooms.api.ts +25 -15
  600. package/src/networking/api-requests/scheduledCalls.api.ts +232 -0
  601. package/src/networking/callTokenStanza.ts +247 -50
  602. package/src/roomStore/callSlice.ts +86 -2
  603. package/src/services/appBadge.ts +85 -0
  604. package/src/services/languageSettings.ts +43 -8
  605. package/src/services/pushRegistration.ts +34 -3
  606. package/src/types/models/modal.model.ts +16 -0
  607. package/src/types/types.ts +86 -4
  608. package/src/version.ts +1 -1
@@ -0,0 +1,272 @@
1
+ import AsyncStorage from '@react-native-async-storage/async-storage';
2
+ import { store } from '../roomStore';
3
+ import { openRoomFromPush } from '../helpers/pushPayload';
4
+ import { normalizeRoomJid } from '../helpers/normalizeRoomJid';
5
+ import {
6
+ getScheduledCall,
7
+ isScheduledCallApiError,
8
+ } from '../networking/api-requests/scheduledCalls.api';
9
+ import { parseScheduledCallLink } from './scheduledCallLink';
10
+ import { chatNameOfRoom } from './scheduledCall';
11
+ import { scheduledCallUi } from './scheduledCallStore';
12
+
13
+ /**
14
+ * Opening a scheduled call from a link or a reminder push.
15
+ *
16
+ * A link can arrive while the app is still starting: before the user is
17
+ * signed in, or before `<Chat>` has configured the store and connected. The
18
+ * slug is then held (in memory, and in AsyncStorage so a cold start that
19
+ * is interrupted by the sign-in screen keeps it) and opened once both are
20
+ * true. Opening = resolve the slug through the API, open its room, show the
21
+ * pre-join sheet. No media starts before the user taps Join.
22
+ */
23
+
24
+ export const PENDING_SCHEDULED_CALL_KEY = 'ethora_pending_scheduled_call';
25
+ /** A link older than this is dropped instead of ambushing the user later. */
26
+ export const PENDING_SCHEDULED_CALL_TTL_MS = 30 * 60 * 1000;
27
+
28
+ export interface PendingStorage {
29
+ read(): Promise<{ slug: string; at: number } | null>;
30
+ write(value: { slug: string; at: number }): Promise<void>;
31
+ clear(): Promise<void>;
32
+ }
33
+
34
+ export const asyncPendingStorage: PendingStorage = {
35
+ async read() {
36
+ try {
37
+ const raw = await AsyncStorage.getItem(PENDING_SCHEDULED_CALL_KEY);
38
+ if (!raw) {return null;}
39
+ const parsed = JSON.parse(raw);
40
+ return typeof parsed?.slug === 'string' && Number.isFinite(parsed?.at)
41
+ ? { slug: parsed.slug, at: parsed.at }
42
+ : null;
43
+ } catch {
44
+ return null;
45
+ }
46
+ },
47
+ async write(value) {
48
+ try {
49
+ await AsyncStorage.setItem(PENDING_SCHEDULED_CALL_KEY, JSON.stringify(value));
50
+ } catch {
51
+ // Memory still holds it.
52
+ }
53
+ },
54
+ async clear() {
55
+ try {
56
+ await AsyncStorage.removeItem(PENDING_SCHEDULED_CALL_KEY);
57
+ } catch {
58
+ // Nothing to do.
59
+ }
60
+ },
61
+ };
62
+
63
+ export interface PendingQueueDeps {
64
+ /** Signed in AND the chat is configured and connected. */
65
+ isReady: () => boolean;
66
+ /** Opens the call; called once per held link, when ready. */
67
+ open: (slug: string) => void;
68
+ storage: PendingStorage;
69
+ now?: () => number;
70
+ ttlMs?: number;
71
+ }
72
+
73
+ /**
74
+ * The hold-until-ready logic, free of the store so it can be tested. One
75
+ * slot: a newer link replaces an older one (the user tapped it last).
76
+ */
77
+ export const createPendingScheduledCallQueue = (deps: PendingQueueDeps) => {
78
+ const now = deps.now || Date.now;
79
+ const ttl = deps.ttlMs ?? PENDING_SCHEDULED_CALL_TTL_MS;
80
+ let held: { slug: string; at: number } | null = null;
81
+ let restored = false;
82
+
83
+ const fresh = (entry: { slug: string; at: number } | null) =>
84
+ !!entry && now() - entry.at <= ttl;
85
+
86
+ const flush = (): boolean => {
87
+ if (!held) {return false;}
88
+ if (!fresh(held)) {
89
+ held = null;
90
+ void deps.storage.clear();
91
+ return false;
92
+ }
93
+ if (!deps.isReady()) {return false;}
94
+ const { slug } = held;
95
+ held = null;
96
+ void deps.storage.clear();
97
+ deps.open(slug);
98
+ return true;
99
+ };
100
+
101
+ return {
102
+ /** A link arrived: open it now, or hold it. Returns what happened. */
103
+ submit(slug: string): 'opened' | 'held' {
104
+ held = { slug, at: now() };
105
+ if (flush()) {return 'opened';}
106
+ void deps.storage.write(held);
107
+ return 'held';
108
+ },
109
+ /** Something that can make us ready changed. */
110
+ poke(): boolean {
111
+ return flush();
112
+ },
113
+ /** Pick up a link persisted by an earlier run of the app. */
114
+ async restore(): Promise<void> {
115
+ if (restored) {return;}
116
+ restored = true;
117
+ const saved = await deps.storage.read();
118
+ // A link that arrived while we were reading is newer: keep it.
119
+ if (!held && saved && fresh(saved)) {
120
+ held = saved;
121
+ } else if (!fresh(saved)) {
122
+ void deps.storage.clear();
123
+ }
124
+ flush();
125
+ },
126
+ peek: () => held,
127
+ reset() {
128
+ held = null;
129
+ restored = false;
130
+ },
131
+ };
132
+ };
133
+
134
+ export const isScheduledCallReady = (): boolean => {
135
+ const settings = store.getState().chatSettingStore;
136
+ return (
137
+ !!settings.user?.token &&
138
+ settings.config !== undefined &&
139
+ (settings.connection === 'online' || settings.connection === 'syncing')
140
+ );
141
+ };
142
+
143
+ const reportOpenError = (
144
+ slug: string,
145
+ reason: 'not-found' | 'not-a-member' | 'cancelled' | 'network'
146
+ ): void => {
147
+ try {
148
+ store
149
+ .getState()
150
+ .chatSettingStore.config?.scheduledCalls?.onOpenError?.({ slug, reason });
151
+ } catch {
152
+ // A host callback must not break the flow.
153
+ }
154
+ };
155
+
156
+ /** Resolve the slug, open its room, show the pre-join sheet. */
157
+ export const resolveAndOpenScheduledCall = async (
158
+ slug: string
159
+ ): Promise<void> => {
160
+ scheduledCallUi.showPreJoin({ phase: 'loading', slug });
161
+ let detail;
162
+ try {
163
+ detail = await getScheduledCall(slug);
164
+ } catch (error) {
165
+ const code = isScheduledCallApiError(error) ? error.code : 'unknown';
166
+ const reason =
167
+ code === 'not-a-member'
168
+ ? 'not-a-member'
169
+ : code === 'not-found'
170
+ ? 'not-found'
171
+ : 'network';
172
+ scheduledCallUi.showPreJoin({ phase: 'error', slug, reason });
173
+ reportOpenError(slug, reason);
174
+ return;
175
+ }
176
+ if (detail.scheduledCall.status === 'cancelled') {
177
+ scheduledCallUi.showPreJoin({
178
+ phase: 'error',
179
+ slug,
180
+ reason: 'cancelled',
181
+ title: detail.scheduledCall.title,
182
+ });
183
+ reportOpenError(slug, 'cancelled');
184
+ return;
185
+ }
186
+ const conference = store.getState().chatSettingStore.config?.xmppSettings?.conference;
187
+ const jid =
188
+ detail.chat?.jid ||
189
+ normalizeRoomJid(
190
+ detail.chat?.name || chatNameOfRoom(detail.scheduledCall.chatName),
191
+ conference
192
+ );
193
+ if (jid) {openRoomFromPush(jid);}
194
+ scheduledCallUi.showPreJoin({ phase: 'ready', slug, detail });
195
+ };
196
+
197
+ const queue = createPendingScheduledCallQueue({
198
+ isReady: isScheduledCallReady,
199
+ open: (slug) => {
200
+ void resolveAndOpenScheduledCall(slug);
201
+ },
202
+ storage: asyncPendingStorage,
203
+ });
204
+
205
+ let unsubscribe: (() => void) | null = null;
206
+
207
+ /**
208
+ * Watches the store so a held link opens the moment sign-in and the chat
209
+ * are both there. Idempotent; `<Chat>` arms it on import and
210
+ * `openScheduledCall` arms it too, so a link that beats `<Chat>` is not lost.
211
+ */
212
+ export const installScheduledCallHook = (): void => {
213
+ if (unsubscribe) {return;}
214
+ unsubscribe = store.subscribe(() => {
215
+ if (queue.peek()) {queue.poke();}
216
+ });
217
+ void queue.restore();
218
+ };
219
+
220
+ /**
221
+ * Open a scheduled call by slug: now when the user is signed in and the
222
+ * chat is up, otherwise as soon as both are true. Returns `'opening'` when
223
+ * it started right away and `'pending'` when it is held.
224
+ */
225
+ export const openScheduledCall = (slug: string): 'opening' | 'pending' => {
226
+ installScheduledCallHook();
227
+ return queue.submit(slug) === 'opened' ? 'opening' : 'pending';
228
+ };
229
+
230
+ /**
231
+ * Hand any URL to the SDK: a scheduled-call link is opened (or held) and
232
+ * `true` is returned; anything else returns `false` untouched.
233
+ */
234
+ export const handleScheduledCallUrl = (url: string | null | undefined): boolean => {
235
+ const slug = parseScheduledCallLink(url);
236
+ if (!slug) {return false;}
237
+ openScheduledCall(slug);
238
+ return true;
239
+ };
240
+
241
+ /** The reminder push the backend sends 10 minutes before a call. */
242
+ export const SCHEDULED_CALL_REMINDER_PUSH_TYPE = 'scheduledCallReminder';
243
+
244
+ export const isScheduledCallReminderPush = (
245
+ data: Record<string, unknown> | null | undefined
246
+ ): boolean => String(data?.type || '') === SCHEDULED_CALL_REMINDER_PUSH_TYPE;
247
+
248
+ /** Slug of a reminder push: `slug`, else parsed out of `joinUrl`. */
249
+ export const scheduledCallSlugFromPush = (
250
+ data: Record<string, unknown> | null | undefined
251
+ ): string | null => {
252
+ if (!isScheduledCallReminderPush(data)) {return null;}
253
+ const slug = String(data?.slug || '').trim();
254
+ if (/^[A-Za-z0-9_-]{16,128}$/.test(slug)) {return slug;}
255
+ return parseScheduledCallLink(String(data?.joinUrl || ''));
256
+ };
257
+
258
+ /** A tap on the reminder push opens the same flow as the join link. */
259
+ export const handleScheduledCallPush = (
260
+ data: Record<string, unknown> | null | undefined
261
+ ): boolean => {
262
+ const slug = scheduledCallSlugFromPush(data);
263
+ if (!slug) {return false;}
264
+ openScheduledCall(slug);
265
+ return true;
266
+ };
267
+
268
+ export const __resetPendingScheduledCallForTests = (): void => {
269
+ queue.reset();
270
+ unsubscribe?.();
271
+ unsubscribe = null;
272
+ };
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Pure helpers behind the schedule / edit sheet: the default start, the
3
+ * stepper arithmetic and the validation the server repeats.
4
+ */
5
+
6
+ export const MIN_DURATION_MINUTES = 5;
7
+ export const MAX_DURATION_MINUTES = 480;
8
+ export const DEFAULT_DURATION_MINUTES = 30;
9
+ export const DURATION_CHOICES = [15, 30, 45, 60, 90, 120];
10
+ export const TIME_STEP_MINUTES = 15;
11
+ export const TITLE_MAX = 200;
12
+ export const NOTES_MAX = 2000;
13
+ /** The server accepts a start this far in the past (clock skew). */
14
+ export const CLOCK_SKEW_MS = 2 * 60 * 1000;
15
+
16
+ const MINUTE = 60 * 1000;
17
+
18
+ /** The next quarter hour that is at least 15 minutes away. */
19
+ export const defaultStartMs = (now: number): number => {
20
+ const step = TIME_STEP_MINUTES * MINUTE;
21
+ const earliest = now + 15 * MINUTE;
22
+ return Math.ceil(earliest / step) * step;
23
+ };
24
+
25
+ /** Move by whole local days (DST safe: done on the calendar, not by 24 h). */
26
+ export const shiftDays = (ms: number, days: number): number => {
27
+ const d = new Date(ms);
28
+ d.setDate(d.getDate() + days);
29
+ return d.getTime();
30
+ };
31
+
32
+ export const shiftMinutes = (ms: number, minutes: number): number =>
33
+ ms + minutes * MINUTE;
34
+
35
+ export const clampDuration = (minutes: number): number => {
36
+ const n = Math.round(Number(minutes));
37
+ if (!Number.isFinite(n)) {return DEFAULT_DURATION_MINUTES;}
38
+ return Math.min(MAX_DURATION_MINUTES, Math.max(MIN_DURATION_MINUTES, n));
39
+ };
40
+
41
+ export type ScheduleFormError = 'pastTime' | null;
42
+
43
+ /** Only the rules the client can check; the server stays the authority. */
44
+ export const validateStart = (
45
+ startMs: number,
46
+ now: number,
47
+ options?: { allowPast?: boolean }
48
+ ): ScheduleFormError => {
49
+ if (!Number.isFinite(startMs)) {return 'pastTime';}
50
+ if (options?.allowPast) {return null;}
51
+ return startMs < now - CLOCK_SKEW_MS ? 'pastTime' : null;
52
+ };
53
+
54
+ export const deviceTimezone = (): string | undefined => {
55
+ try {
56
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || undefined;
57
+ } catch {
58
+ return undefined;
59
+ }
60
+ };
61
+
62
+ export const formatDay = (ms: number, locale?: string): string => {
63
+ try {
64
+ return new Date(ms).toLocaleDateString(locale, {
65
+ weekday: 'short',
66
+ day: 'numeric',
67
+ month: 'short',
68
+ year: 'numeric',
69
+ });
70
+ } catch {
71
+ return new Date(ms).toDateString();
72
+ }
73
+ };
74
+
75
+ export const formatClock = (ms: number, locale?: string): string => {
76
+ try {
77
+ return new Date(ms).toLocaleTimeString(locale, {
78
+ hour: '2-digit',
79
+ minute: '2-digit',
80
+ });
81
+ } catch {
82
+ return new Date(ms).toTimeString().slice(0, 5);
83
+ }
84
+ };
@@ -0,0 +1,163 @@
1
+ import { msgSortableMs } from '../helpers/msgSortableMs';
2
+ import type { IMessage } from '../types/types';
3
+
4
+ /**
5
+ * Scheduled-call invite cards: what a `<data type="scheduledCall">` message
6
+ * says, and the pure rules for which message owns a card and what state the
7
+ * card is in. No React, no store: everything here is unit-testable.
8
+ */
9
+
10
+ export const SCHEDULED_CALL_MESSAGE_TYPE = 'scheduledCall';
11
+
12
+ /** Join opens this long before the start (contract: 15 minutes). */
13
+ export const JOIN_WINDOW_BEFORE_MS = 15 * 60 * 1000;
14
+
15
+ export type ScheduledCallMessageStatus = 'scheduled' | 'updated' | 'cancelled';
16
+
17
+ /** upcoming -> joinable (15 min before start until the end) -> ended; or cancelled. */
18
+ export type ScheduledCallCardState =
19
+ | 'upcoming'
20
+ | 'joinable'
21
+ | 'ended'
22
+ | 'cancelled';
23
+
24
+ export interface ScheduledCallCardData {
25
+ slug: string;
26
+ title: string;
27
+ /** ISO UTC. */
28
+ startAt: string;
29
+ startMs: number;
30
+ durationMinutes: number;
31
+ kind: 'video' | 'audio';
32
+ status: ScheduledCallMessageStatus;
33
+ joinUrl: string;
34
+ icsUrl: string;
35
+ googleUrl: string;
36
+ outlookUrl: string;
37
+ /** Creator's user id (`scheduledCallCreatedBy`); '' on an invite that predates it. */
38
+ createdBy: string;
39
+ }
40
+
41
+ const text = (value: unknown): string =>
42
+ typeof value === 'string' ? value.trim() : '';
43
+
44
+ export const isScheduledCallMessage = (message: unknown): boolean =>
45
+ text((message as any)?.type) === SCHEDULED_CALL_MESSAGE_TYPE &&
46
+ !!text((message as any)?.scheduledCallSlug);
47
+
48
+ /**
49
+ * The card data a message carries, or null when it is not a usable invite
50
+ * (no slug, or a start time that is not a date). Defaults follow the
51
+ * contract: 30 minutes, video, status `scheduled`.
52
+ */
53
+ export const parseScheduledCallMessage = (
54
+ message: unknown
55
+ ): ScheduledCallCardData | null => {
56
+ if (!isScheduledCallMessage(message)) {return null;}
57
+ const raw = message as Record<string, any>;
58
+ const startAt = text(raw.scheduledCallStartAt);
59
+ const startMs = Date.parse(startAt);
60
+ if (!Number.isFinite(startMs)) {return null;}
61
+
62
+ const duration = Math.round(Number(raw.scheduledCallDurationMinutes));
63
+ const status = text(raw.scheduledCallStatus).toLowerCase();
64
+ return {
65
+ slug: text(raw.scheduledCallSlug),
66
+ title: text(raw.scheduledCallTitle),
67
+ startAt,
68
+ startMs,
69
+ durationMinutes: Number.isFinite(duration) && duration > 0 ? duration : 30,
70
+ kind: text(raw.scheduledCallKind).toLowerCase() === 'audio' ? 'audio' : 'video',
71
+ status:
72
+ status === 'cancelled' || status === 'canceled'
73
+ ? 'cancelled'
74
+ : status === 'updated'
75
+ ? 'updated'
76
+ : 'scheduled',
77
+ joinUrl: text(raw.scheduledCallJoinUrl),
78
+ icsUrl: text(raw.scheduledCallIcsUrl),
79
+ googleUrl: text(raw.scheduledCallGoogleUrl),
80
+ outlookUrl: text(raw.scheduledCallOutlookUrl),
81
+ createdBy: text(raw.scheduledCallCreatedBy),
82
+ };
83
+ };
84
+
85
+ /**
86
+ * One card per slug, latest message wins. "Latest" is the server order
87
+ * (message id, then date); on a tie the one further down the list.
88
+ * Returns slug -> the winning message.
89
+ */
90
+ const latestCache = new WeakMap<object, Map<string, IMessage>>();
91
+
92
+ export const latestScheduledCallMessages = (
93
+ messages: ReadonlyArray<IMessage> | undefined | null
94
+ ): Map<string, IMessage> => {
95
+ const source = messages || [];
96
+ const cached = latestCache.get(source);
97
+ if (cached) {return cached;}
98
+ const winners = new Map<string, { message: IMessage; at: number }>();
99
+ source.forEach((message) => {
100
+ if (!isScheduledCallMessage(message)) {return;}
101
+ const slug = text((message as any).scheduledCallSlug);
102
+ const at = msgSortableMs(message);
103
+ const current = winners.get(slug);
104
+ if (!current || at >= current.at) {
105
+ winners.set(slug, { message, at });
106
+ }
107
+ });
108
+ const out = new Map<string, IMessage>();
109
+ winners.forEach((value, slug) => out.set(slug, value.message));
110
+ // The store hands out a new array whenever messages change, so the array
111
+ // itself is the cache key (every card in a room shares one pass).
112
+ if (messages) {latestCache.set(messages, out);}
113
+ return out;
114
+ };
115
+
116
+ /** The message that owns this slug's card, or undefined for no invite at all. */
117
+ export const latestScheduledCallMessage = (
118
+ messages: ReadonlyArray<IMessage> | undefined | null,
119
+ slug: string
120
+ ): IMessage | undefined => latestScheduledCallMessages(messages).get(slug);
121
+
122
+ export const scheduledCallEndMs = (
123
+ card: Pick<ScheduledCallCardData, 'startMs' | 'durationMinutes'>
124
+ ): number => card.startMs + card.durationMinutes * 60 * 1000;
125
+
126
+ /** Where a card stands at `now` (epoch ms). */
127
+ export const getScheduledCallCardState = (
128
+ card: Pick<
129
+ ScheduledCallCardData,
130
+ 'startMs' | 'durationMinutes' | 'status'
131
+ >,
132
+ now: number
133
+ ): ScheduledCallCardState => {
134
+ if (card.status === 'cancelled') {return 'cancelled';}
135
+ if (now >= scheduledCallEndMs(card)) {return 'ended';}
136
+ if (now >= card.startMs - JOIN_WINDOW_BEFORE_MS) {return 'joinable';}
137
+ return 'upcoming';
138
+ };
139
+
140
+ /**
141
+ * The next instant the card's state changes (join window opens, call ends),
142
+ * or null when it will not change on its own (cancelled / ended). Lets the
143
+ * card sleep until then instead of polling.
144
+ */
145
+ export const nextScheduledCallTransition = (
146
+ card: Pick<
147
+ ScheduledCallCardData,
148
+ 'startMs' | 'durationMinutes' | 'status'
149
+ >,
150
+ now: number
151
+ ): number | null => {
152
+ const state = getScheduledCallCardState(card, now);
153
+ if (state === 'upcoming') {return card.startMs - JOIN_WINDOW_BEFORE_MS;}
154
+ if (state === 'joinable') {return scheduledCallEndMs(card);}
155
+ return null;
156
+ };
157
+
158
+ /** Longest a single setTimeout may sleep (the platform clamps at 2^31-1 ms). */
159
+ export const MAX_TIMER_MS = 2_000_000_000;
160
+
161
+ /** The room's bare name, as the call and booking endpoints take it. */
162
+ export const chatNameOfRoom = (roomJidOrName: string): string =>
163
+ String(roomJidOrName || '').split('@')[0];
@@ -0,0 +1,141 @@
1
+ import { Alert, Linking } from 'react-native';
2
+ import { store } from '../roomStore';
3
+ import { toastEmitter } from '../utils/toastEmitter';
4
+ import {
5
+ cancelScheduledCall,
6
+ getScheduledCall,
7
+ type ScheduledCallDetail,
8
+ } from '../networking/api-requests/scheduledCalls.api';
9
+ import { translateCallString } from '../components/VideoCalls/callActions';
10
+ import { startRoomCall, type StartRoomCallOutcome } from './startRoomCall';
11
+
12
+ /**
13
+ * What the buttons of the invite card and the pre-join sheet do. Kept out of
14
+ * the components so both share one behaviour (and so it reads in one place).
15
+ */
16
+
17
+ const t = translateCallString;
18
+
19
+ const toast = (type: 'success' | 'error', message: string) =>
20
+ toastEmitter.emit({
21
+ id: `scheduled-call-${Date.now()}`,
22
+ title: t(type === 'success' ? 'toast.successTitle' : 'toast.error'),
23
+ message,
24
+ type,
25
+ });
26
+
27
+ export const notifyScheduledCall = toast;
28
+
29
+ /** A link the backend gave us, opened as is. Only web links are opened. */
30
+ export const openBackendLink = async (url: string | undefined): Promise<void> => {
31
+ if (!url || !/^https?:\/\//i.test(url)) {
32
+ toast('error', t('booking.error.openLink'));
33
+ return;
34
+ }
35
+ try {
36
+ await Linking.openURL(url);
37
+ } catch {
38
+ toast('error', t('booking.error.openLink'));
39
+ }
40
+ };
41
+
42
+ const JOIN_ERRORS: Partial<Record<StartRoomCallOutcome, string>> = {
43
+ busy: 'booking.error.busy',
44
+ disabled: 'booking.error.callsOff',
45
+ 'no-room': 'booking.error.joinFailed',
46
+ failed: 'booking.error.joinFailed',
47
+ };
48
+
49
+ /** The user tapped Join: the room's ordinary call start / join. */
50
+ export const joinScheduledCall = async (
51
+ roomJidOrName: string,
52
+ kind: 'audio' | 'video'
53
+ ): Promise<boolean> => {
54
+ const outcome = await startRoomCall(roomJidOrName, kind);
55
+ const errorKey = JOIN_ERRORS[outcome];
56
+ if (errorKey) {
57
+ toast('error', t(errorKey));
58
+ return false;
59
+ }
60
+ return true;
61
+ };
62
+
63
+ const confirmCancel = (): Promise<boolean> =>
64
+ new Promise((resolve) => {
65
+ Alert.alert(
66
+ t('booking.confirm.cancelTitle'),
67
+ t('booking.confirm.cancelMessage'),
68
+ [
69
+ {
70
+ text: t('booking.action.keepCall'),
71
+ style: 'cancel',
72
+ onPress: () => resolve(false),
73
+ },
74
+ {
75
+ text: t('booking.action.cancelCall'),
76
+ style: 'destructive',
77
+ onPress: () => resolve(true),
78
+ },
79
+ ],
80
+ { cancelable: true, onDismiss: () => resolve(false) }
81
+ );
82
+ });
83
+
84
+ /** Ask, then cancel. Resolves true when the call was cancelled. */
85
+ export const confirmAndCancelScheduledCall = async (
86
+ slug: string
87
+ ): Promise<boolean> => {
88
+ if (!(await confirmCancel())) {return false;}
89
+ try {
90
+ await cancelScheduledCall(slug);
91
+ invalidateScheduledCallDetail(slug);
92
+ toast('success', t('booking.toast.cancelled'));
93
+ return true;
94
+ } catch {
95
+ toast('error', t('booking.error.cancel'));
96
+ return false;
97
+ }
98
+ };
99
+
100
+ // ---- detail cache: the cards ask for a call's detail (creator, notes) once.
101
+
102
+ const details = new Map<string, Promise<ScheduledCallDetail>>();
103
+
104
+ export const getScheduledCallDetailCached = (
105
+ slug: string,
106
+ version: string
107
+ ): Promise<ScheduledCallDetail> => {
108
+ const key = `${slug}|${version}`;
109
+ let hit = details.get(key);
110
+ if (!hit) {
111
+ hit = getScheduledCall(slug);
112
+ details.set(key, hit);
113
+ hit.catch(() => details.delete(key));
114
+ }
115
+ return hit;
116
+ };
117
+
118
+ export const invalidateScheduledCallDetail = (slug: string): void => {
119
+ [...details.keys()]
120
+ .filter((key) => key.startsWith(`${slug}|`))
121
+ .forEach((key) => details.delete(key));
122
+ };
123
+
124
+ export const __resetScheduledCallDetailCacheForTests = (): void => details.clear();
125
+
126
+ /**
127
+ * May this user edit or cancel the call? The server decides for real
128
+ * (creator or room owner); this only decides whether to show the buttons.
129
+ */
130
+ export const canManageScheduledCall = (params: {
131
+ createdBy?: string;
132
+ userId?: string;
133
+ roomRole?: string;
134
+ }): boolean => {
135
+ const { createdBy, userId, roomRole } = params;
136
+ if (createdBy && userId && createdBy === userId) {return true;}
137
+ return roomRole === 'owner' || roomRole === 'moderator';
138
+ };
139
+
140
+ export const currentUserId = (): string =>
141
+ store.getState().chatSettingStore.user?._id || '';