@syra.fm/sdk 0.3.0 → 0.5.0

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 (314) hide show
  1. package/lib/commonjs/client.js +268 -0
  2. package/lib/commonjs/client.js.map +1 -0
  3. package/lib/commonjs/errors.js +22 -0
  4. package/lib/commonjs/errors.js.map +1 -0
  5. package/lib/commonjs/index.js +63 -0
  6. package/lib/commonjs/index.js.map +1 -0
  7. package/lib/commonjs/index.native.js +28 -0
  8. package/lib/commonjs/index.native.js.map +1 -0
  9. package/lib/commonjs/live/assets/icons/spaces-icon.js +42 -0
  10. package/lib/commonjs/live/assets/icons/spaces-icon.js.map +1 -0
  11. package/lib/commonjs/live/assets/icons/syra-icon.js +43 -0
  12. package/lib/commonjs/live/assets/icons/syra-icon.js.map +1 -0
  13. package/lib/commonjs/live/components/AnimatedPulse.js +38 -0
  14. package/lib/commonjs/live/components/AnimatedPulse.js.map +1 -0
  15. package/lib/commonjs/live/components/AnimatedSpeakerRing.js +90 -0
  16. package/lib/commonjs/live/components/AnimatedSpeakerRing.js.map +1 -0
  17. package/lib/commonjs/live/components/CreateRoomSheet.js +688 -0
  18. package/lib/commonjs/live/components/CreateRoomSheet.js.map +1 -0
  19. package/lib/commonjs/live/components/InsightsPanel.js +333 -0
  20. package/lib/commonjs/live/components/InsightsPanel.js.map +1 -0
  21. package/lib/commonjs/live/components/LiveRoomSheet.js +1195 -0
  22. package/lib/commonjs/live/components/LiveRoomSheet.js.map +1 -0
  23. package/lib/commonjs/live/components/MiniRoomBar.js +161 -0
  24. package/lib/commonjs/live/components/MiniRoomBar.js.map +1 -0
  25. package/lib/commonjs/live/components/PanelHeader.js +57 -0
  26. package/lib/commonjs/live/components/PanelHeader.js.map +1 -0
  27. package/lib/commonjs/live/components/PodcastStreamPicker.js +1190 -0
  28. package/lib/commonjs/live/components/PodcastStreamPicker.js.map +1 -0
  29. package/lib/commonjs/live/components/RecordingCard.js +192 -0
  30. package/lib/commonjs/live/components/RecordingCard.js.map +1 -0
  31. package/lib/commonjs/live/components/RecordingsPanel.js +304 -0
  32. package/lib/commonjs/live/components/RecordingsPanel.js.map +1 -0
  33. package/lib/commonjs/live/components/RoomCard.js +553 -0
  34. package/lib/commonjs/live/components/RoomCard.js.map +1 -0
  35. package/lib/commonjs/live/components/StreamConfigModal.js +656 -0
  36. package/lib/commonjs/live/components/StreamConfigModal.js.map +1 -0
  37. package/lib/commonjs/live/components/StreamConfigPanel.js +822 -0
  38. package/lib/commonjs/live/components/StreamConfigPanel.js.map +1 -0
  39. package/lib/commonjs/live/context/LiveConfigContext.js +46 -0
  40. package/lib/commonjs/live/context/LiveConfigContext.js.map +1 -0
  41. package/lib/commonjs/live/context/LiveRoomContext.js +195 -0
  42. package/lib/commonjs/live/context/LiveRoomContext.js.map +1 -0
  43. package/lib/commonjs/live/hooks/useActiveSpeakers.js +35 -0
  44. package/lib/commonjs/live/hooks/useActiveSpeakers.js.map +1 -0
  45. package/lib/commonjs/live/hooks/useRoomAudio.js +129 -0
  46. package/lib/commonjs/live/hooks/useRoomAudio.js.map +1 -0
  47. package/lib/commonjs/live/hooks/useRoomConnection.js +177 -0
  48. package/lib/commonjs/live/hooks/useRoomConnection.js.map +1 -0
  49. package/lib/commonjs/live/hooks/useRoomManager.js +37 -0
  50. package/lib/commonjs/live/hooks/useRoomManager.js.map +1 -0
  51. package/lib/commonjs/live/hooks/useRoomUsers.js +52 -0
  52. package/lib/commonjs/live/hooks/useRoomUsers.js.map +1 -0
  53. package/lib/commonjs/live/index.js +310 -0
  54. package/lib/commonjs/live/index.js.map +1 -0
  55. package/lib/commonjs/live/services/livekitService.js +20 -0
  56. package/lib/commonjs/live/services/livekitService.js.map +1 -0
  57. package/lib/commonjs/live/services/spaceSocketService.js +181 -0
  58. package/lib/commonjs/live/services/spaceSocketService.js.map +1 -0
  59. package/lib/commonjs/live/services/spacesService.js +642 -0
  60. package/lib/commonjs/live/services/spacesService.js.map +1 -0
  61. package/lib/commonjs/live/types.js +6 -0
  62. package/lib/commonjs/live/types.js.map +1 -0
  63. package/lib/commonjs/live/validation.js +238 -0
  64. package/lib/commonjs/live/validation.js.map +1 -0
  65. package/lib/commonjs/package.json +1 -0
  66. package/lib/commonjs/schema.js +102 -0
  67. package/lib/commonjs/schema.js.map +1 -0
  68. package/lib/module/client.js +264 -0
  69. package/lib/module/client.js.map +1 -0
  70. package/lib/module/errors.js +17 -0
  71. package/lib/module/errors.js.map +1 -0
  72. package/lib/module/index.js +6 -0
  73. package/lib/module/index.js.map +1 -0
  74. package/lib/module/index.native.js +5 -0
  75. package/lib/module/index.native.js.map +1 -0
  76. package/lib/module/live/assets/icons/spaces-icon.js +34 -0
  77. package/lib/module/live/assets/icons/spaces-icon.js.map +1 -0
  78. package/lib/module/live/assets/icons/syra-icon.js +36 -0
  79. package/lib/module/live/assets/icons/syra-icon.js.map +1 -0
  80. package/lib/module/live/components/AnimatedPulse.js +33 -0
  81. package/lib/module/live/components/AnimatedPulse.js.map +1 -0
  82. package/lib/module/live/components/AnimatedSpeakerRing.js +85 -0
  83. package/lib/module/live/components/AnimatedSpeakerRing.js.map +1 -0
  84. package/lib/module/live/components/CreateRoomSheet.js +682 -0
  85. package/lib/module/live/components/CreateRoomSheet.js.map +1 -0
  86. package/lib/module/live/components/InsightsPanel.js +327 -0
  87. package/lib/module/live/components/InsightsPanel.js.map +1 -0
  88. package/lib/module/live/components/LiveRoomSheet.js +1189 -0
  89. package/lib/module/live/components/LiveRoomSheet.js.map +1 -0
  90. package/lib/module/live/components/MiniRoomBar.js +154 -0
  91. package/lib/module/live/components/MiniRoomBar.js.map +1 -0
  92. package/lib/module/live/components/PanelHeader.js +52 -0
  93. package/lib/module/live/components/PanelHeader.js.map +1 -0
  94. package/lib/module/live/components/PodcastStreamPicker.js +1183 -0
  95. package/lib/module/live/components/PodcastStreamPicker.js.map +1 -0
  96. package/lib/module/live/components/RecordingCard.js +187 -0
  97. package/lib/module/live/components/RecordingCard.js.map +1 -0
  98. package/lib/module/live/components/RecordingsPanel.js +298 -0
  99. package/lib/module/live/components/RecordingsPanel.js.map +1 -0
  100. package/lib/module/live/components/RoomCard.js +548 -0
  101. package/lib/module/live/components/RoomCard.js.map +1 -0
  102. package/lib/module/live/components/StreamConfigModal.js +650 -0
  103. package/lib/module/live/components/StreamConfigModal.js.map +1 -0
  104. package/lib/module/live/components/StreamConfigPanel.js +816 -0
  105. package/lib/module/live/components/StreamConfigPanel.js.map +1 -0
  106. package/lib/module/live/context/LiveConfigContext.js +40 -0
  107. package/lib/module/live/context/LiveConfigContext.js.map +1 -0
  108. package/lib/module/live/context/LiveRoomContext.js +189 -0
  109. package/lib/module/live/context/LiveRoomContext.js.map +1 -0
  110. package/lib/module/live/hooks/useActiveSpeakers.js +31 -0
  111. package/lib/module/live/hooks/useActiveSpeakers.js.map +1 -0
  112. package/lib/module/live/hooks/useRoomAudio.js +125 -0
  113. package/lib/module/live/hooks/useRoomAudio.js.map +1 -0
  114. package/lib/module/live/hooks/useRoomConnection.js +173 -0
  115. package/lib/module/live/hooks/useRoomConnection.js.map +1 -0
  116. package/lib/module/live/hooks/useRoomManager.js +32 -0
  117. package/lib/module/live/hooks/useRoomManager.js.map +1 -0
  118. package/lib/module/live/hooks/useRoomUsers.js +46 -0
  119. package/lib/module/live/hooks/useRoomUsers.js.map +1 -0
  120. package/lib/module/live/index.js +38 -0
  121. package/lib/module/live/index.js.map +1 -0
  122. package/lib/module/live/services/livekitService.js +16 -0
  123. package/lib/module/live/services/livekitService.js.map +1 -0
  124. package/lib/module/live/services/spaceSocketService.js +176 -0
  125. package/lib/module/live/services/spaceSocketService.js.map +1 -0
  126. package/lib/module/live/services/spacesService.js +639 -0
  127. package/lib/module/live/services/spacesService.js.map +1 -0
  128. package/lib/module/live/types.js +4 -0
  129. package/lib/module/live/types.js.map +1 -0
  130. package/lib/module/live/validation.js +229 -0
  131. package/lib/module/live/validation.js.map +1 -0
  132. package/lib/module/package.json +1 -0
  133. package/lib/module/schema.js +99 -0
  134. package/lib/module/schema.js.map +1 -0
  135. package/{dist/types → lib/typescript/commonjs}/client.d.ts +36 -1
  136. package/lib/typescript/commonjs/client.d.ts.map +1 -0
  137. package/{dist/types → lib/typescript/commonjs}/errors.d.ts +1 -0
  138. package/lib/typescript/commonjs/errors.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/index.d.ts +6 -0
  140. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/index.native.d.ts +3 -0
  142. package/lib/typescript/commonjs/index.native.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts +13 -0
  144. package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts +13 -0
  146. package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts +8 -0
  148. package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts +10 -0
  150. package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts +26 -0
  152. package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts.map +1 -0
  153. package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts +11 -0
  154. package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts.map +1 -0
  155. package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts +11 -0
  156. package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts.map +1 -0
  157. package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts +15 -0
  158. package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts.map +1 -0
  159. package/lib/typescript/commonjs/live/components/PanelHeader.d.ts +10 -0
  160. package/lib/typescript/commonjs/live/components/PanelHeader.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts +54 -0
  162. package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/live/components/RecordingCard.d.ts +11 -0
  164. package/lib/typescript/commonjs/live/components/RecordingCard.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts +12 -0
  166. package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/live/components/RoomCard.d.ts +38 -0
  168. package/lib/typescript/commonjs/live/components/RoomCard.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts +11 -0
  170. package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts +13 -0
  172. package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts +78 -0
  174. package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts +12 -0
  176. package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts +3 -0
  178. package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts +16 -0
  180. package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts +29 -0
  182. package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts +11 -0
  184. package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts +5 -0
  186. package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/live/index.d.ts +24 -0
  188. package/lib/typescript/commonjs/live/index.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/live/services/livekitService.d.ts +7 -0
  190. package/lib/typescript/commonjs/live/services/livekitService.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts +69 -0
  192. package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/live/services/spacesService.d.ts +181 -0
  194. package/lib/typescript/commonjs/live/services/spacesService.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/live/types.d.ts +100 -0
  196. package/lib/typescript/commonjs/live/types.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/live/validation.d.ts +658 -0
  198. package/lib/typescript/commonjs/live/validation.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/package.json +1 -0
  200. package/{dist/types → lib/typescript/commonjs}/schema.d.ts +305 -0
  201. package/lib/typescript/commonjs/schema.d.ts.map +1 -0
  202. package/lib/typescript/module/client.d.ts +141 -0
  203. package/lib/typescript/module/client.d.ts.map +1 -0
  204. package/lib/typescript/module/errors.d.ts +9 -0
  205. package/lib/typescript/module/errors.d.ts.map +1 -0
  206. package/lib/typescript/module/index.d.ts +6 -0
  207. package/lib/typescript/module/index.d.ts.map +1 -0
  208. package/lib/typescript/module/index.native.d.ts +3 -0
  209. package/lib/typescript/module/index.native.d.ts.map +1 -0
  210. package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts +13 -0
  211. package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts.map +1 -0
  212. package/lib/typescript/module/live/assets/icons/syra-icon.d.ts +13 -0
  213. package/lib/typescript/module/live/assets/icons/syra-icon.d.ts.map +1 -0
  214. package/lib/typescript/module/live/components/AnimatedPulse.d.ts +8 -0
  215. package/lib/typescript/module/live/components/AnimatedPulse.d.ts.map +1 -0
  216. package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts +10 -0
  217. package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
  218. package/lib/typescript/module/live/components/CreateRoomSheet.d.ts +26 -0
  219. package/lib/typescript/module/live/components/CreateRoomSheet.d.ts.map +1 -0
  220. package/lib/typescript/module/live/components/InsightsPanel.d.ts +11 -0
  221. package/lib/typescript/module/live/components/InsightsPanel.d.ts.map +1 -0
  222. package/lib/typescript/module/live/components/LiveRoomSheet.d.ts +11 -0
  223. package/lib/typescript/module/live/components/LiveRoomSheet.d.ts.map +1 -0
  224. package/lib/typescript/module/live/components/MiniRoomBar.d.ts +15 -0
  225. package/lib/typescript/module/live/components/MiniRoomBar.d.ts.map +1 -0
  226. package/lib/typescript/module/live/components/PanelHeader.d.ts +10 -0
  227. package/lib/typescript/module/live/components/PanelHeader.d.ts.map +1 -0
  228. package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts +54 -0
  229. package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts.map +1 -0
  230. package/lib/typescript/module/live/components/RecordingCard.d.ts +11 -0
  231. package/lib/typescript/module/live/components/RecordingCard.d.ts.map +1 -0
  232. package/lib/typescript/module/live/components/RecordingsPanel.d.ts +12 -0
  233. package/lib/typescript/module/live/components/RecordingsPanel.d.ts.map +1 -0
  234. package/lib/typescript/module/live/components/RoomCard.d.ts +38 -0
  235. package/lib/typescript/module/live/components/RoomCard.d.ts.map +1 -0
  236. package/lib/typescript/module/live/components/StreamConfigModal.d.ts +11 -0
  237. package/lib/typescript/module/live/components/StreamConfigModal.d.ts.map +1 -0
  238. package/lib/typescript/module/live/components/StreamConfigPanel.d.ts +13 -0
  239. package/lib/typescript/module/live/components/StreamConfigPanel.d.ts.map +1 -0
  240. package/lib/typescript/module/live/context/LiveConfigContext.d.ts +78 -0
  241. package/lib/typescript/module/live/context/LiveConfigContext.d.ts.map +1 -0
  242. package/lib/typescript/module/live/context/LiveRoomContext.d.ts +12 -0
  243. package/lib/typescript/module/live/context/LiveRoomContext.d.ts.map +1 -0
  244. package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts +3 -0
  245. package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts.map +1 -0
  246. package/lib/typescript/module/live/hooks/useRoomAudio.d.ts +16 -0
  247. package/lib/typescript/module/live/hooks/useRoomAudio.d.ts.map +1 -0
  248. package/lib/typescript/module/live/hooks/useRoomConnection.d.ts +29 -0
  249. package/lib/typescript/module/live/hooks/useRoomConnection.d.ts.map +1 -0
  250. package/lib/typescript/module/live/hooks/useRoomManager.d.ts +11 -0
  251. package/lib/typescript/module/live/hooks/useRoomManager.d.ts.map +1 -0
  252. package/lib/typescript/module/live/hooks/useRoomUsers.d.ts +5 -0
  253. package/lib/typescript/module/live/hooks/useRoomUsers.d.ts.map +1 -0
  254. package/lib/typescript/module/live/index.d.ts +24 -0
  255. package/lib/typescript/module/live/index.d.ts.map +1 -0
  256. package/lib/typescript/module/live/services/livekitService.d.ts +7 -0
  257. package/lib/typescript/module/live/services/livekitService.d.ts.map +1 -0
  258. package/lib/typescript/module/live/services/spaceSocketService.d.ts +69 -0
  259. package/lib/typescript/module/live/services/spaceSocketService.d.ts.map +1 -0
  260. package/lib/typescript/module/live/services/spacesService.d.ts +181 -0
  261. package/lib/typescript/module/live/services/spacesService.d.ts.map +1 -0
  262. package/lib/typescript/module/live/types.d.ts +100 -0
  263. package/lib/typescript/module/live/types.d.ts.map +1 -0
  264. package/lib/typescript/module/live/validation.d.ts +658 -0
  265. package/lib/typescript/module/live/validation.d.ts.map +1 -0
  266. package/lib/typescript/module/package.json +1 -0
  267. package/lib/typescript/module/schema.d.ts +1072 -0
  268. package/lib/typescript/module/schema.d.ts.map +1 -0
  269. package/package.json +133 -21
  270. package/src/client.test.ts +185 -0
  271. package/src/client.ts +125 -0
  272. package/src/index.native.ts +2 -0
  273. package/src/index.ts +4 -0
  274. package/src/live/assets/icons/spaces-icon.tsx +15 -0
  275. package/src/live/assets/icons/syra-icon.tsx +13 -0
  276. package/src/live/assets/sounds/intro.mp3 +0 -0
  277. package/src/live/components/AnimatedPulse.tsx +52 -0
  278. package/src/live/components/AnimatedSpeakerRing.tsx +101 -0
  279. package/src/live/components/CreateRoomSheet.tsx +654 -0
  280. package/src/live/components/InsightsPanel.tsx +202 -0
  281. package/src/live/components/LiveRoomSheet.tsx +969 -0
  282. package/src/live/components/MiniRoomBar.tsx +166 -0
  283. package/src/live/components/PanelHeader.tsx +36 -0
  284. package/src/live/components/PodcastStreamPicker.tsx +1155 -0
  285. package/src/live/components/RecordingCard.tsx +154 -0
  286. package/src/live/components/RecordingsPanel.tsx +251 -0
  287. package/src/live/components/RoomCard.tsx +494 -0
  288. package/src/live/components/StreamConfigModal.tsx +600 -0
  289. package/src/live/components/StreamConfigPanel.tsx +729 -0
  290. package/src/live/context/LiveConfigContext.tsx +96 -0
  291. package/src/live/context/LiveRoomContext.tsx +235 -0
  292. package/src/live/hooks/useActiveSpeakers.ts +39 -0
  293. package/src/live/hooks/useRoomAudio.ts +103 -0
  294. package/src/live/hooks/useRoomConnection.ts +162 -0
  295. package/src/live/hooks/useRoomManager.ts +17 -0
  296. package/src/live/hooks/useRoomUsers.ts +52 -0
  297. package/src/live/index.ts +92 -0
  298. package/src/live/services/livekitService.ts +11 -0
  299. package/src/live/services/spaceSocketService.ts +136 -0
  300. package/src/live/services/spacesService.ts +692 -0
  301. package/src/live/types.ts +119 -0
  302. package/src/live/validation.ts +279 -0
  303. package/src/schema.ts +34 -0
  304. package/dist/cjs/client.js +0 -185
  305. package/dist/cjs/errors.js +0 -16
  306. package/dist/cjs/index.js +0 -14
  307. package/dist/cjs/package.json +0 -3
  308. package/dist/cjs/schema.js +0 -62
  309. package/dist/esm/client.js +0 -181
  310. package/dist/esm/errors.js +0 -12
  311. package/dist/esm/index.js +0 -3
  312. package/dist/esm/package.json +0 -3
  313. package/dist/esm/schema.js +0 -59
  314. package/dist/types/index.d.ts +0 -5
@@ -0,0 +1,154 @@
1
+ import React from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity, StyleProp, ViewStyle } from 'react-native';
3
+ import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
4
+ import { useAuth } from '@oxyhq/services';
5
+
6
+ import { useLiveConfig } from '../context/LiveConfigContext';
7
+ import { getAvatarUrl, getDisplayName } from '../hooks/useRoomUsers';
8
+ import type { Recording } from '../validation';
9
+
10
+ // --- Helpers ---
11
+
12
+ const MONTH_SHORT = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
13
+
14
+ function formatDate(dateStr: string): string {
15
+ const d = new Date(dateStr);
16
+ return `${d.getDate()} ${MONTH_SHORT[d.getMonth()]} ${d.getFullYear()}`;
17
+ }
18
+
19
+ function formatDurationMs(ms: number): string {
20
+ const totalMin = Math.round(ms / 60_000);
21
+ if (totalMin < 60) return `${totalMin}m`;
22
+ const h = Math.floor(totalMin / 60);
23
+ const m = totalMin % 60;
24
+ return m > 0 ? `${h}h ${m}m` : `${h}h`;
25
+ }
26
+
27
+ // --- Types ---
28
+
29
+ interface RecordingCardProps {
30
+ recording: Recording;
31
+ onPress?: () => void;
32
+ style?: StyleProp<ViewStyle>;
33
+ }
34
+
35
+ // --- Component ---
36
+
37
+ export const RecordingCard: React.FC<RecordingCardProps> = ({ recording, onPress, style }) => {
38
+ const { useTheme, useUserById, AvatarComponent, getCachedFileDownloadUrlSync } = useLiveConfig();
39
+ const theme = useTheme();
40
+ const { oxyServices } = useAuth();
41
+ const hostProfile = useUserById(recording.host);
42
+ const hostAvatarUri = getAvatarUrl(hostProfile, oxyServices, getCachedFileDownloadUrlSync);
43
+ const hostName = getDisplayName(hostProfile, recording.host);
44
+
45
+ const duration = recording.durationMs ? formatDurationMs(recording.durationMs) : null;
46
+ const date = formatDate(recording.createdAt);
47
+ const listeners = recording.participantIds?.length || 0;
48
+
49
+ return (
50
+ <TouchableOpacity
51
+ style={[styles.card, { backgroundColor: theme.colors.card, borderColor: theme.colors.border }, style]}
52
+ onPress={onPress}
53
+ activeOpacity={onPress ? 0.7 : 1}
54
+ disabled={!onPress}
55
+ >
56
+ <View style={styles.row}>
57
+ {/* Play icon */}
58
+ <View style={[styles.playIcon, { backgroundColor: theme.colors.primary + '15' }]}>
59
+ <MaterialCommunityIcons name="play-circle" size={28} color={theme.colors.primary} />
60
+ </View>
61
+
62
+ {/* Content */}
63
+ <View style={styles.content}>
64
+ <Text style={[styles.title, { color: theme.colors.text }]} numberOfLines={1}>
65
+ {recording.roomTitle}
66
+ </Text>
67
+ <View style={styles.meta}>
68
+ {hostAvatarUri && (
69
+ <AvatarComponent size={16} source={hostAvatarUri} shape="squircle" style={{ marginRight: 4 }} />
70
+ )}
71
+ <Text style={[styles.metaText, { color: theme.colors.textSecondary }]} numberOfLines={1}>
72
+ {hostName}
73
+ </Text>
74
+ <Text style={[styles.dot, { color: theme.colors.textSecondary }]}>·</Text>
75
+ <Text style={[styles.metaText, { color: theme.colors.textSecondary }]}>{date}</Text>
76
+ </View>
77
+ </View>
78
+
79
+ {/* Duration / Stats */}
80
+ <View style={styles.rightCol}>
81
+ {duration && (
82
+ <Text style={[styles.duration, { color: theme.colors.text }]}>{duration}</Text>
83
+ )}
84
+ {listeners > 0 && (
85
+ <View style={styles.listenersRow}>
86
+ <MaterialCommunityIcons name="account-group" size={12} color={theme.colors.textSecondary} />
87
+ <Text style={[styles.listenersText, { color: theme.colors.textSecondary }]}>{listeners}</Text>
88
+ </View>
89
+ )}
90
+ </View>
91
+ </View>
92
+ </TouchableOpacity>
93
+ );
94
+ };
95
+
96
+ // --- Styles ---
97
+
98
+ const styles = StyleSheet.create({
99
+ card: {
100
+ borderRadius: 12,
101
+ borderWidth: 1,
102
+ padding: 12,
103
+ width: 280,
104
+ },
105
+ row: {
106
+ flexDirection: 'row',
107
+ alignItems: 'center',
108
+ gap: 10,
109
+ },
110
+ playIcon: {
111
+ width: 44,
112
+ height: 44,
113
+ borderRadius: 12,
114
+ alignItems: 'center',
115
+ justifyContent: 'center',
116
+ },
117
+ content: {
118
+ flex: 1,
119
+ gap: 4,
120
+ },
121
+ title: {
122
+ fontSize: 14,
123
+ fontWeight: '600',
124
+ },
125
+ meta: {
126
+ flexDirection: 'row',
127
+ alignItems: 'center',
128
+ },
129
+ metaText: {
130
+ fontSize: 12,
131
+ },
132
+ dot: {
133
+ fontSize: 10,
134
+ marginHorizontal: 4,
135
+ },
136
+ rightCol: {
137
+ alignItems: 'flex-end',
138
+ gap: 4,
139
+ },
140
+ duration: {
141
+ fontSize: 13,
142
+ fontWeight: '600',
143
+ },
144
+ listenersRow: {
145
+ flexDirection: 'row',
146
+ alignItems: 'center',
147
+ gap: 3,
148
+ },
149
+ listenersText: {
150
+ fontSize: 11,
151
+ },
152
+ });
153
+
154
+ export default RecordingCard;
@@ -0,0 +1,251 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { View, Text, StyleSheet, ScrollView, TouchableOpacity, ActivityIndicator } from 'react-native';
3
+ import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
4
+
5
+ import { PanelHeader } from './PanelHeader';
6
+ import { useLiveConfig } from '../context/LiveConfigContext';
7
+ import type { Recording, LiveTheme } from '../types';
8
+
9
+ interface RecordingsPanelProps {
10
+ roomId: string;
11
+ isHost: boolean;
12
+ theme: LiveTheme;
13
+ onClose: () => void;
14
+ onPlay?: (playbackUrl: string, recording: Recording) => void;
15
+ }
16
+
17
+ function formatDurationMs(ms: number | null | undefined): string {
18
+ if (!ms) return '—';
19
+ const totalSecs = Math.floor(ms / 1000);
20
+ const hours = Math.floor(totalSecs / 3600);
21
+ const mins = Math.floor((totalSecs % 3600) / 60);
22
+ const secs = totalSecs % 60;
23
+ if (hours > 0) return `${hours}h ${mins}m ${secs}s`;
24
+ if (mins > 0) return `${mins}m ${secs}s`;
25
+ return `${secs}s`;
26
+ }
27
+
28
+ function formatDate(dateStr: string): string {
29
+ const date = new Date(dateStr);
30
+ return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' });
31
+ }
32
+
33
+ export function RecordingsPanel({ roomId, isHost, theme, onClose, onPlay }: RecordingsPanelProps) {
34
+ const { roomsService, toast } = useLiveConfig();
35
+ const [recordings, setRecordings] = useState<Recording[]>([]);
36
+ const [loading, setLoading] = useState(true);
37
+ const [playingId, setPlayingId] = useState<string | null>(null);
38
+
39
+ useEffect(() => {
40
+ loadRecordings();
41
+ }, [roomId]);
42
+
43
+ const loadRecordings = async () => {
44
+ setLoading(true);
45
+ const data = await roomsService.getRoomRecordings(roomId);
46
+ setRecordings(data);
47
+ setLoading(false);
48
+ };
49
+
50
+ const handlePlay = async (recording: Recording) => {
51
+ setPlayingId(recording._id);
52
+ try {
53
+ const result = await roomsService.getRecording(recording._id);
54
+ if (result?.playbackUrl) {
55
+ onPlay?.(result.playbackUrl, recording);
56
+ } else {
57
+ toast.error('Failed to load playback URL');
58
+ }
59
+ } catch {
60
+ toast.error('Failed to load recording');
61
+ } finally {
62
+ setPlayingId(null);
63
+ }
64
+ };
65
+
66
+ const handleToggleAccess = async (recording: Recording) => {
67
+ const newAccess = recording.access === 'public' ? 'participants' as const : 'public' as const;
68
+ const success = await roomsService.updateRecordingAccess(recording._id, newAccess);
69
+ if (success) {
70
+ setRecordings((prev) =>
71
+ prev.map((r) => r._id === recording._id ? { ...r, access: newAccess } : r)
72
+ );
73
+ toast.success(`Recording is now ${newAccess}`);
74
+ } else {
75
+ toast.error('Failed to update access');
76
+ }
77
+ };
78
+
79
+ const handleDelete = async (recording: Recording) => {
80
+ const success = await roomsService.deleteRecording(recording._id);
81
+ if (success) {
82
+ setRecordings((prev) => prev.filter((r) => r._id !== recording._id));
83
+ toast.success('Recording deleted');
84
+ } else {
85
+ toast.error('Failed to delete recording');
86
+ }
87
+ };
88
+
89
+ return (
90
+ <View style={styles.container}>
91
+ <PanelHeader title="Recordings" theme={theme} onBack={onClose} />
92
+
93
+ <ScrollView
94
+ style={{ flex: 1 }}
95
+ contentContainerStyle={styles.scrollContent}
96
+ showsVerticalScrollIndicator={false}
97
+ >
98
+ {loading ? (
99
+ <View style={styles.centered}>
100
+ <ActivityIndicator color={theme.colors.primary} />
101
+ </View>
102
+ ) : recordings.length === 0 ? (
103
+ <View style={styles.centered}>
104
+ <MaterialCommunityIcons name="record-circle-outline" size={40} color={theme.colors.textSecondary} />
105
+ <Text style={[styles.emptyText, { color: theme.colors.textSecondary }]}>
106
+ No recordings yet
107
+ </Text>
108
+ </View>
109
+ ) : (
110
+ recordings.map((recording) => (
111
+ <View
112
+ key={recording._id}
113
+ style={[styles.recordingCard, { backgroundColor: `${theme.colors.card}80`, borderColor: theme.colors.border }]}
114
+ >
115
+ <View style={styles.recordingHeader}>
116
+ <View style={styles.recordingInfo}>
117
+ <Text style={[styles.recordingTitle, { color: theme.colors.text }]} numberOfLines={1}>
118
+ {recording.roomTitle}
119
+ </Text>
120
+ <View style={styles.recordingMeta}>
121
+ <Text style={[styles.recordingDate, { color: theme.colors.textSecondary }]}>
122
+ {formatDate(recording.startedAt)}
123
+ </Text>
124
+ <Text style={[styles.recordingDuration, { color: theme.colors.textSecondary }]}>
125
+ {formatDurationMs(recording.durationMs)}
126
+ </Text>
127
+ <View style={[styles.accessBadge, {
128
+ backgroundColor: recording.access === 'public' ? `${theme.colors.primary}1A` : '#FF98001A',
129
+ }]}>
130
+ <MaterialCommunityIcons
131
+ name={recording.access === 'public' ? 'earth' : 'lock'}
132
+ size={10}
133
+ color={recording.access === 'public' ? theme.colors.primary : '#FF9800'}
134
+ />
135
+ <Text style={[styles.accessBadgeText, {
136
+ color: recording.access === 'public' ? theme.colors.primary : '#FF9800',
137
+ }]}>
138
+ {recording.access === 'public' ? 'Public' : 'Participants'}
139
+ </Text>
140
+ </View>
141
+ </View>
142
+ </View>
143
+
144
+ <TouchableOpacity
145
+ onPress={() => handlePlay(recording)}
146
+ disabled={playingId === recording._id}
147
+ style={[styles.playButton, { backgroundColor: theme.colors.primary }]}
148
+ >
149
+ {playingId === recording._id ? (
150
+ <ActivityIndicator size="small" color="#FFFFFF" />
151
+ ) : (
152
+ <MaterialCommunityIcons name="play" size={22} color="#FFFFFF" />
153
+ )}
154
+ </TouchableOpacity>
155
+ </View>
156
+
157
+ {isHost && (
158
+ <View style={[styles.recordingActions, { borderTopColor: theme.colors.border }]}>
159
+ <TouchableOpacity
160
+ style={styles.actionButton}
161
+ onPress={() => handleToggleAccess(recording)}
162
+ >
163
+ <MaterialCommunityIcons
164
+ name={recording.access === 'public' ? 'lock' : 'earth'}
165
+ size={16}
166
+ color={theme.colors.textSecondary}
167
+ />
168
+ <Text style={[styles.actionText, { color: theme.colors.textSecondary }]}>
169
+ {recording.access === 'public' ? 'Make private' : 'Make public'}
170
+ </Text>
171
+ </TouchableOpacity>
172
+
173
+ <TouchableOpacity
174
+ style={styles.actionButton}
175
+ onPress={() => handleDelete(recording)}
176
+ >
177
+ <MaterialCommunityIcons name="delete-outline" size={16} color="#FF4458" />
178
+ <Text style={[styles.actionText, { color: '#FF4458' }]}>Delete</Text>
179
+ </TouchableOpacity>
180
+ </View>
181
+ )}
182
+ </View>
183
+ ))
184
+ )}
185
+ </ScrollView>
186
+ </View>
187
+ );
188
+ }
189
+
190
+ const styles = StyleSheet.create({
191
+ container: { flex: 1 },
192
+ scrollContent: { padding: 16, paddingBottom: 32 },
193
+ centered: {
194
+ alignItems: 'center',
195
+ justifyContent: 'center',
196
+ paddingTop: 60,
197
+ gap: 12,
198
+ },
199
+ emptyText: { fontSize: 15, fontWeight: '500' },
200
+ recordingCard: {
201
+ borderRadius: 12,
202
+ borderWidth: 1,
203
+ marginBottom: 10,
204
+ overflow: 'hidden',
205
+ },
206
+ recordingHeader: {
207
+ flexDirection: 'row',
208
+ alignItems: 'center',
209
+ padding: 14,
210
+ gap: 12,
211
+ },
212
+ recordingInfo: { flex: 1, gap: 4 },
213
+ recordingTitle: { fontSize: 15, fontWeight: '600' },
214
+ recordingMeta: {
215
+ flexDirection: 'row',
216
+ alignItems: 'center',
217
+ gap: 8,
218
+ flexWrap: 'wrap',
219
+ },
220
+ recordingDate: { fontSize: 12, fontWeight: '500' },
221
+ recordingDuration: { fontSize: 12, fontWeight: '500' },
222
+ accessBadge: {
223
+ flexDirection: 'row',
224
+ alignItems: 'center',
225
+ gap: 3,
226
+ paddingHorizontal: 6,
227
+ paddingVertical: 2,
228
+ borderRadius: 8,
229
+ },
230
+ accessBadgeText: { fontSize: 10, fontWeight: '600' },
231
+ playButton: {
232
+ width: 42,
233
+ height: 42,
234
+ borderRadius: 21,
235
+ alignItems: 'center',
236
+ justifyContent: 'center',
237
+ },
238
+ recordingActions: {
239
+ flexDirection: 'row',
240
+ borderTopWidth: 1,
241
+ paddingVertical: 8,
242
+ paddingHorizontal: 14,
243
+ gap: 16,
244
+ },
245
+ actionButton: {
246
+ flexDirection: 'row',
247
+ alignItems: 'center',
248
+ gap: 4,
249
+ },
250
+ actionText: { fontSize: 12, fontWeight: '500' },
251
+ });