@openpeepshq/react 0.2.3

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 (558) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +1 -0
  3. package/dist/auth/credentials/index.d.ts +11 -0
  4. package/dist/auth/credentials/index.js +57 -0
  5. package/dist/auth/credentials/types.d.ts +6 -0
  6. package/dist/auth/credentials/types.js +1 -0
  7. package/dist/components/accounts/SignUpLoginModal.d.ts +9 -0
  8. package/dist/components/accounts/SignUpLoginModal.js +19 -0
  9. package/dist/components/accounts/SignUpLoginModalContext.d.ts +10 -0
  10. package/dist/components/accounts/SignUpLoginModalContext.js +16 -0
  11. package/dist/components/accounts/index.d.ts +3 -0
  12. package/dist/components/accounts/index.js +2 -0
  13. package/dist/components/configuration/ConfigurationCategory.d.ts +12 -0
  14. package/dist/components/configuration/ConfigurationCategory.js +61 -0
  15. package/dist/components/configuration/ConfigurationList.d.ts +10 -0
  16. package/dist/components/configuration/ConfigurationList.js +30 -0
  17. package/dist/components/configuration/ConfigurationTree.d.ts +8 -0
  18. package/dist/components/configuration/ConfigurationTree.js +20 -0
  19. package/dist/components/configuration/ConfigurationValueEditor.d.ts +11 -0
  20. package/dist/components/configuration/ConfigurationValueEditor.js +45 -0
  21. package/dist/components/configuration/index.d.ts +4 -0
  22. package/dist/components/configuration/index.js +4 -0
  23. package/dist/components/conversations/ConversationMessageBubble.d.ts +4 -0
  24. package/dist/components/conversations/ConversationMessageBubble.js +10 -0
  25. package/dist/components/conversations/CreateNewConversation.d.ts +8 -0
  26. package/dist/components/conversations/CreateNewConversation.js +62 -0
  27. package/dist/components/conversations/CreateNewConversationContext.d.ts +15 -0
  28. package/dist/components/conversations/CreateNewConversationContext.js +18 -0
  29. package/dist/components/conversations/DirectMessagesHeaderActions.d.ts +1 -0
  30. package/dist/components/conversations/DirectMessagesHeaderActions.js +10 -0
  31. package/dist/components/conversations/MessageInThread.d.ts +13 -0
  32. package/dist/components/conversations/MessageInThread.js +41 -0
  33. package/dist/components/conversations/index.d.ts +8 -0
  34. package/dist/components/conversations/index.js +5 -0
  35. package/dist/components/form/HeaderAvatarInput.d.ts +13 -0
  36. package/dist/components/form/HeaderAvatarInput.js +16 -0
  37. package/dist/components/form/ImageEditModal.d.ts +23 -0
  38. package/dist/components/form/ImageEditModal.js +75 -0
  39. package/dist/components/form/ImageInput.d.ts +32 -0
  40. package/dist/components/form/ImageInput.js +65 -0
  41. package/dist/components/form/LocationInput.d.ts +20 -0
  42. package/dist/components/form/LocationInput.js +59 -0
  43. package/dist/components/form/index.d.ts +8 -0
  44. package/dist/components/form/index.js +4 -0
  45. package/dist/components/groups/AddGroupMemberModal.d.ts +6 -0
  46. package/dist/components/groups/AddGroupMemberModal.js +40 -0
  47. package/dist/components/groups/AddGroupMembersButton.d.ts +5 -0
  48. package/dist/components/groups/AddGroupMembersButton.js +17 -0
  49. package/dist/components/groups/ChangeGroupRolesModal.d.ts +7 -0
  50. package/dist/components/groups/ChangeGroupRolesModal.js +45 -0
  51. package/dist/components/groups/ConfirmGroupExitModal.d.ts +6 -0
  52. package/dist/components/groups/ConfirmGroupExitModal.js +35 -0
  53. package/dist/components/groups/ConfirmMemberRemovalModal.d.ts +7 -0
  54. package/dist/components/groups/ConfirmMemberRemovalModal.js +33 -0
  55. package/dist/components/groups/DeleteGroupModal.d.ts +6 -0
  56. package/dist/components/groups/DeleteGroupModal.js +34 -0
  57. package/dist/components/groups/GroupAvatar.d.ts +14 -0
  58. package/dist/components/groups/GroupAvatar.js +32 -0
  59. package/dist/components/groups/GroupCard.d.ts +19 -0
  60. package/dist/components/groups/GroupCard.js +12 -0
  61. package/dist/components/groups/GroupFeed.d.ts +9 -0
  62. package/dist/components/groups/GroupFeed.js +14 -0
  63. package/dist/components/groups/GroupForm.d.ts +7 -0
  64. package/dist/components/groups/GroupForm.js +73 -0
  65. package/dist/components/groups/GroupHeader.d.ts +5 -0
  66. package/dist/components/groups/GroupHeader.js +14 -0
  67. package/dist/components/groups/GroupMembersList.d.ts +5 -0
  68. package/dist/components/groups/GroupMembersList.js +38 -0
  69. package/dist/components/groups/GroupOptionsMenu.d.ts +5 -0
  70. package/dist/components/groups/GroupOptionsMenu.js +61 -0
  71. package/dist/components/groups/GroupShareMenu.d.ts +5 -0
  72. package/dist/components/groups/GroupShareMenu.js +29 -0
  73. package/dist/components/groups/JoinGroupButton.d.ts +6 -0
  74. package/dist/components/groups/JoinGroupButton.js +28 -0
  75. package/dist/components/groups/index.d.ts +30 -0
  76. package/dist/components/groups/index.js +15 -0
  77. package/dist/components/index.d.ts +15 -0
  78. package/dist/components/index.js +15 -0
  79. package/dist/components/jams/CreateNewJam.d.ts +4 -0
  80. package/dist/components/jams/CreateNewJam.js +138 -0
  81. package/dist/components/jams/CreateNewJamContext.d.ts +9 -0
  82. package/dist/components/jams/CreateNewJamContext.js +16 -0
  83. package/dist/components/jams/JamAnimatedEmoji.d.ts +4 -0
  84. package/dist/components/jams/JamAnimatedEmoji.js +12 -0
  85. package/dist/components/jams/JamCallParticipant.d.ts +15 -0
  86. package/dist/components/jams/JamCallParticipant.js +101 -0
  87. package/dist/components/jams/JamCapacityGate.d.ts +7 -0
  88. package/dist/components/jams/JamCapacityGate.js +30 -0
  89. package/dist/components/jams/JamChatDrawer.d.ts +6 -0
  90. package/dist/components/jams/JamChatDrawer.js +88 -0
  91. package/dist/components/jams/JamChatMessage.d.ts +5 -0
  92. package/dist/components/jams/JamChatMessage.js +35 -0
  93. package/dist/components/jams/JamConference.d.ts +8 -0
  94. package/dist/components/jams/JamConference.js +38 -0
  95. package/dist/components/jams/JamContext.d.ts +20 -0
  96. package/dist/components/jams/JamContext.js +24 -0
  97. package/dist/components/jams/JamDetailsDrawer.d.ts +9 -0
  98. package/dist/components/jams/JamDetailsDrawer.js +39 -0
  99. package/dist/components/jams/JamDeviceSelectors.d.ts +12 -0
  100. package/dist/components/jams/JamDeviceSelectors.js +71 -0
  101. package/dist/components/jams/JamEventsContext.d.ts +14 -0
  102. package/dist/components/jams/JamEventsContext.js +143 -0
  103. package/dist/components/jams/JamFooter.d.ts +18 -0
  104. package/dist/components/jams/JamFooter.js +171 -0
  105. package/dist/components/jams/JamGuestForm.d.ts +1 -0
  106. package/dist/components/jams/JamGuestForm.js +55 -0
  107. package/dist/components/jams/JamLobby.d.ts +17 -0
  108. package/dist/components/jams/JamLobby.js +159 -0
  109. package/dist/components/jams/JamObserverShell.d.ts +6 -0
  110. package/dist/components/jams/JamObserverShell.js +11 -0
  111. package/dist/components/jams/JamParticipantConference.d.ts +7 -0
  112. package/dist/components/jams/JamParticipantConference.js +80 -0
  113. package/dist/components/jams/JamPeopleDrawer.d.ts +10 -0
  114. package/dist/components/jams/JamPeopleDrawer.js +76 -0
  115. package/dist/components/jams/JamReactionMenu.d.ts +12 -0
  116. package/dist/components/jams/JamReactionMenu.js +79 -0
  117. package/dist/components/jams/JamRequestJoin.d.ts +9 -0
  118. package/dist/components/jams/JamRequestJoin.js +34 -0
  119. package/dist/components/jams/JamRoom.d.ts +21 -0
  120. package/dist/components/jams/JamRoom.js +166 -0
  121. package/dist/components/jams/JamRoomIndicators.d.ts +10 -0
  122. package/dist/components/jams/JamRoomIndicators.js +39 -0
  123. package/dist/components/jams/JamVideoCall.d.ts +15 -0
  124. package/dist/components/jams/JamVideoCall.js +18 -0
  125. package/dist/components/jams/JamVideoLayout.d.ts +13 -0
  126. package/dist/components/jams/JamVideoLayout.js +68 -0
  127. package/dist/components/jams/LeaveCloseButton.d.ts +6 -0
  128. package/dist/components/jams/LeaveCloseButton.js +58 -0
  129. package/dist/components/jams/LiveJamsSection.d.ts +1 -0
  130. package/dist/components/jams/LiveJamsSection.js +16 -0
  131. package/dist/components/jams/animateEmoji.d.ts +1 -0
  132. package/dist/components/jams/animateEmoji.js +48 -0
  133. package/dist/components/jams/blurProcessor.d.ts +8 -0
  134. package/dist/components/jams/blurProcessor.js +28 -0
  135. package/dist/components/jams/constants.d.ts +10 -0
  136. package/dist/components/jams/constants.js +44 -0
  137. package/dist/components/jams/index.d.ts +24 -0
  138. package/dist/components/jams/index.js +19 -0
  139. package/dist/components/jams/jamEventActions.d.ts +26 -0
  140. package/dist/components/jams/jamEventActions.js +76 -0
  141. package/dist/components/jams/jamLocalSettings.d.ts +17 -0
  142. package/dist/components/jams/jamLocalSettings.js +53 -0
  143. package/dist/components/jams/jamReactionPreferences.d.ts +15 -0
  144. package/dist/components/jams/jamReactionPreferences.js +53 -0
  145. package/dist/components/jams/jamRecordingState.d.ts +10 -0
  146. package/dist/components/jams/jamRecordingState.js +25 -0
  147. package/dist/components/jams/reactionEmojis.d.ts +30 -0
  148. package/dist/components/jams/reactionEmojis.js +73 -0
  149. package/dist/components/jams/useJamHands.d.ts +7 -0
  150. package/dist/components/jams/useJamHands.js +39 -0
  151. package/dist/components/jams/useJamLiveKitTheme.d.ts +3 -0
  152. package/dist/components/jams/useJamLiveKitTheme.js +10 -0
  153. package/dist/components/layout/AccessDenied.d.ts +14 -0
  154. package/dist/components/layout/AccessDenied.js +28 -0
  155. package/dist/components/layout/AccessDeniedLoader.d.ts +16 -0
  156. package/dist/components/layout/AccessDeniedLoader.js +12 -0
  157. package/dist/components/layout/Auth.d.ts +22 -0
  158. package/dist/components/layout/Auth.js +82 -0
  159. package/dist/components/layout/IdentityContext.d.ts +17 -0
  160. package/dist/components/layout/IdentityContext.js +38 -0
  161. package/dist/components/layout/Infos.d.ts +5 -0
  162. package/dist/components/layout/Infos.js +42 -0
  163. package/dist/components/layout/OpenpeepsContextProvider.d.ts +10 -0
  164. package/dist/components/layout/OpenpeepsContextProvider.js +63 -0
  165. package/dist/components/layout/OpenpeepsThemeProvider.d.ts +11 -0
  166. package/dist/components/layout/OpenpeepsThemeProvider.js +47 -0
  167. package/dist/components/layout/ProfileGuard.d.ts +14 -0
  168. package/dist/components/layout/ProfileGuard.js +38 -0
  169. package/dist/components/layout/ProfileProvider.d.ts +10 -0
  170. package/dist/components/layout/ProfileProvider.js +60 -0
  171. package/dist/components/layout/Root.d.ts +16 -0
  172. package/dist/components/layout/Root.js +36 -0
  173. package/dist/components/layout/ToastProvider.d.ts +22 -0
  174. package/dist/components/layout/ToastProvider.js +37 -0
  175. package/dist/components/layout/index.d.ts +21 -0
  176. package/dist/components/layout/index.js +11 -0
  177. package/dist/components/markdown/CompiledMarkdown.d.ts +5 -0
  178. package/dist/components/markdown/CompiledMarkdown.js +3 -0
  179. package/dist/components/markdown/OpenpeepsMarkdown.d.ts +16 -0
  180. package/dist/components/markdown/OpenpeepsMarkdown.js +66 -0
  181. package/dist/components/markdown/classes.d.ts +2 -0
  182. package/dist/components/markdown/classes.js +2 -0
  183. package/dist/components/markdown/compileMarkdown.d.ts +5 -0
  184. package/dist/components/markdown/compileMarkdown.js +36 -0
  185. package/dist/components/markdown/index.d.ts +11 -0
  186. package/dist/components/markdown/index.js +7 -0
  187. package/dist/components/markdown/linkTargets.d.ts +3 -0
  188. package/dist/components/markdown/linkTargets.js +27 -0
  189. package/dist/components/markdown/staticRender.d.ts +16 -0
  190. package/dist/components/markdown/staticRender.js +17 -0
  191. package/dist/components/navigation/ContentHeader.d.ts +1 -0
  192. package/dist/components/navigation/ContentHeader.js +18 -0
  193. package/dist/components/navigation/FooterMobile.d.ts +5 -0
  194. package/dist/components/navigation/FooterMobile.js +8 -0
  195. package/dist/components/navigation/HeaderMobile.d.ts +11 -0
  196. package/dist/components/navigation/HeaderMobile.js +26 -0
  197. package/dist/components/navigation/MobileMenuItem.d.ts +7 -0
  198. package/dist/components/navigation/MobileMenuItem.js +13 -0
  199. package/dist/components/navigation/PageHeaderAction.d.ts +5 -0
  200. package/dist/components/navigation/PageHeaderAction.js +7 -0
  201. package/dist/components/navigation/PlusButton.d.ts +1 -0
  202. package/dist/components/navigation/PlusButton.js +11 -0
  203. package/dist/components/navigation/SideBar.d.ts +16 -0
  204. package/dist/components/navigation/SideBar.js +24 -0
  205. package/dist/components/navigation/SidebarNavContext.d.ts +3 -0
  206. package/dist/components/navigation/SidebarNavContext.js +4 -0
  207. package/dist/components/navigation/breadcrumbs/Breadcrumbs.d.ts +1 -0
  208. package/dist/components/navigation/breadcrumbs/Breadcrumbs.js +10 -0
  209. package/dist/components/navigation/breadcrumbs/Crumb.d.ts +5 -0
  210. package/dist/components/navigation/breadcrumbs/Crumb.js +4 -0
  211. package/dist/components/navigation/index.d.ts +17 -0
  212. package/dist/components/navigation/index.js +11 -0
  213. package/dist/components/navigation/sideBarNavLinkClass.d.ts +4 -0
  214. package/dist/components/navigation/sideBarNavLinkClass.js +3 -0
  215. package/dist/components/notifications/NotificationErrorBoundary.d.ts +16 -0
  216. package/dist/components/notifications/NotificationErrorBoundary.js +21 -0
  217. package/dist/components/notifications/NotificationHeaderActions.d.ts +6 -0
  218. package/dist/components/notifications/NotificationHeaderActions.js +35 -0
  219. package/dist/components/notifications/NotificationItem.d.ts +5 -0
  220. package/dist/components/notifications/NotificationItem.js +6 -0
  221. package/dist/components/notifications/NotificationWrapper.d.ts +10 -0
  222. package/dist/components/notifications/NotificationWrapper.js +6 -0
  223. package/dist/components/notifications/NotificationsList.d.ts +12 -0
  224. package/dist/components/notifications/NotificationsList.js +88 -0
  225. package/dist/components/notifications/TypedNotification.d.ts +4 -0
  226. package/dist/components/notifications/TypedNotification.js +201 -0
  227. package/dist/components/notifications/index.d.ts +7 -0
  228. package/dist/components/notifications/index.js +5 -0
  229. package/dist/components/post/Feed.d.ts +20 -0
  230. package/dist/components/post/Feed.js +63 -0
  231. package/dist/components/post/FeedPost.d.ts +17 -0
  232. package/dist/components/post/FeedPost.js +31 -0
  233. package/dist/components/post/FeedPostContent.d.ts +5 -0
  234. package/dist/components/post/FeedPostContent.js +22 -0
  235. package/dist/components/post/FullPostLayout.d.ts +7 -0
  236. package/dist/components/post/FullPostLayout.js +23 -0
  237. package/dist/components/post/Markdown.d.ts +2 -0
  238. package/dist/components/post/Markdown.js +1 -0
  239. package/dist/components/post/NewEventButton.d.ts +14 -0
  240. package/dist/components/post/NewEventButton.js +39 -0
  241. package/dist/components/post/NewNoteButton.d.ts +14 -0
  242. package/dist/components/post/NewNoteButton.js +38 -0
  243. package/dist/components/post/PinnedPost.d.ts +5 -0
  244. package/dist/components/post/PinnedPost.js +15 -0
  245. package/dist/components/post/PostDetail.d.ts +4 -0
  246. package/dist/components/post/PostDetail.js +31 -0
  247. package/dist/components/post/ReplyBox.d.ts +5 -0
  248. package/dist/components/post/ReplyBox.js +30 -0
  249. package/dist/components/post/VideoPlayOverlay.d.ts +5 -0
  250. package/dist/components/post/VideoPlayOverlay.js +8 -0
  251. package/dist/components/post/attachmentPreview.d.ts +5 -0
  252. package/dist/components/post/attachmentPreview.js +14 -0
  253. package/dist/components/post/feed/events/EventsFeed.d.ts +7 -0
  254. package/dist/components/post/feed/events/EventsFeed.js +44 -0
  255. package/dist/components/post/feed/threaded/ThreadPost.d.ts +9 -0
  256. package/dist/components/post/feed/threaded/ThreadPost.js +19 -0
  257. package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +10 -0
  258. package/dist/components/post/feed/threaded/ThreadedFeed.js +8 -0
  259. package/dist/components/post/helpers.d.ts +6 -0
  260. package/dist/components/post/helpers.js +24 -0
  261. package/dist/components/post/index.d.ts +78 -0
  262. package/dist/components/post/index.js +57 -0
  263. package/dist/components/post/pieces/Attachments.d.ts +5 -0
  264. package/dist/components/post/pieces/Attachments.js +44 -0
  265. package/dist/components/post/pieces/EventLocation.d.ts +7 -0
  266. package/dist/components/post/pieces/EventLocation.js +28 -0
  267. package/dist/components/post/pieces/EventMenu.d.ts +6 -0
  268. package/dist/components/post/pieces/EventMenu.js +35 -0
  269. package/dist/components/post/pieces/EventRsvpButton.d.ts +5 -0
  270. package/dist/components/post/pieces/EventRsvpButton.js +60 -0
  271. package/dist/components/post/pieces/FeedPostStats.d.ts +5 -0
  272. package/dist/components/post/pieces/FeedPostStats.js +27 -0
  273. package/dist/components/post/pieces/GalleryModal.d.ts +7 -0
  274. package/dist/components/post/pieces/GalleryModal.js +16 -0
  275. package/dist/components/post/pieces/ParticipantsCard.d.ts +8 -0
  276. package/dist/components/post/pieces/ParticipantsCard.js +13 -0
  277. package/dist/components/post/pieces/PollContent.d.ts +5 -0
  278. package/dist/components/post/pieces/PollContent.js +109 -0
  279. package/dist/components/post/pieces/PostActions.d.ts +6 -0
  280. package/dist/components/post/pieces/PostActions.js +63 -0
  281. package/dist/components/post/pieces/PostInfoHeader.d.ts +7 -0
  282. package/dist/components/post/pieces/PostInfoHeader.js +8 -0
  283. package/dist/components/post/pieces/PostMenu.d.ts +6 -0
  284. package/dist/components/post/pieces/PostMenu.js +77 -0
  285. package/dist/components/post/pieces/PostReactionHeader.d.ts +12 -0
  286. package/dist/components/post/pieces/PostReactionHeader.js +31 -0
  287. package/dist/components/post/pieces/ShareMenu.d.ts +6 -0
  288. package/dist/components/post/pieces/ShareMenu.js +46 -0
  289. package/dist/components/post/pieces/UnreadPostIndicator.d.ts +9 -0
  290. package/dist/components/post/pieces/UnreadPostIndicator.js +6 -0
  291. package/dist/components/post/pieces/VideoPlayer.d.ts +16 -0
  292. package/dist/components/post/pieces/VideoPlayer.js +127 -0
  293. package/dist/components/post/pieces/modals/DeletePostModal.d.ts +8 -0
  294. package/dist/components/post/pieces/modals/DeletePostModal.js +20 -0
  295. package/dist/components/post/pieces/modals/ReactionsModal.d.ts +7 -0
  296. package/dist/components/post/pieces/modals/ReactionsModal.js +11 -0
  297. package/dist/components/post/pieces/modals/RepostModal.d.ts +7 -0
  298. package/dist/components/post/pieces/modals/RepostModal.js +13 -0
  299. package/dist/components/post/post-form/ArticleForm.d.ts +7 -0
  300. package/dist/components/post/post-form/ArticleForm.js +45 -0
  301. package/dist/components/post/post-form/AttachmentCard.d.ts +29 -0
  302. package/dist/components/post/post-form/AttachmentCard.js +120 -0
  303. package/dist/components/post/post-form/ComposeAttachments.d.ts +25 -0
  304. package/dist/components/post/post-form/ComposeAttachments.js +137 -0
  305. package/dist/components/post/post-form/ComposePreviewLinks.d.ts +4 -0
  306. package/dist/components/post/post-form/ComposePreviewLinks.js +9 -0
  307. package/dist/components/post/post-form/DescriptionEditModal.d.ts +13 -0
  308. package/dist/components/post/post-form/DescriptionEditModal.js +22 -0
  309. package/dist/components/post/post-form/EditPostModal.d.ts +6 -0
  310. package/dist/components/post/post-form/EditPostModal.js +81 -0
  311. package/dist/components/post/post-form/EditPostModalContext.d.ts +10 -0
  312. package/dist/components/post/post-form/EditPostModalContext.js +18 -0
  313. package/dist/components/post/post-form/EventForm.d.ts +7 -0
  314. package/dist/components/post/post-form/EventForm.js +104 -0
  315. package/dist/components/post/post-form/EventTypeSwitcher.d.ts +8 -0
  316. package/dist/components/post/post-form/EventTypeSwitcher.js +165 -0
  317. package/dist/components/post/post-form/NewPostModal.d.ts +13 -0
  318. package/dist/components/post/post-form/NewPostModal.js +272 -0
  319. package/dist/components/post/post-form/NewPostModalContext.d.ts +15 -0
  320. package/dist/components/post/post-form/NewPostModalContext.js +20 -0
  321. package/dist/components/post/post-form/OpenpeepsMarkdownInput.d.ts +19 -0
  322. package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +65 -0
  323. package/dist/components/post/post-form/PollComposerFields.d.ts +12 -0
  324. package/dist/components/post/post-form/PollComposerFields.js +19 -0
  325. package/dist/components/post/post-form/PostAudienceSelector.d.ts +12 -0
  326. package/dist/components/post/post-form/PostAudienceSelector.js +83 -0
  327. package/dist/components/post/post-form/PostTypeSwitcher.d.ts +16 -0
  328. package/dist/components/post/post-form/PostTypeSwitcher.js +22 -0
  329. package/dist/components/post/post-form/ReplyModal.d.ts +6 -0
  330. package/dist/components/post/post-form/ReplyModal.js +202 -0
  331. package/dist/components/post/post-form/ReplyModalContext.d.ts +10 -0
  332. package/dist/components/post/post-form/ReplyModalContext.js +18 -0
  333. package/dist/components/post/post-form/VisibilitySelector.d.ts +8 -0
  334. package/dist/components/post/post-form/VisibilitySelector.js +35 -0
  335. package/dist/components/post/post-form/audienceChoices.d.ts +14 -0
  336. package/dist/components/post/post-form/audienceChoices.js +66 -0
  337. package/dist/components/post/types/Article.d.ts +5 -0
  338. package/dist/components/post/types/Article.js +14 -0
  339. package/dist/components/post/types/Event.d.ts +5 -0
  340. package/dist/components/post/types/Event.js +19 -0
  341. package/dist/components/post/types/Note.d.ts +5 -0
  342. package/dist/components/post/types/Note.js +10 -0
  343. package/dist/components/post/types/Poll.d.ts +7 -0
  344. package/dist/components/post/types/Poll.js +11 -0
  345. package/dist/components/post/types/article/FullArticle.d.ts +5 -0
  346. package/dist/components/post/types/article/FullArticle.js +8 -0
  347. package/dist/components/post/types/event/CardEvent.d.ts +5 -0
  348. package/dist/components/post/types/event/CardEvent.js +45 -0
  349. package/dist/components/post/types/event/FullEvent.d.ts +5 -0
  350. package/dist/components/post/types/event/FullEvent.js +161 -0
  351. package/dist/components/post/types/event/ProfileEventRelationship.d.ts +5 -0
  352. package/dist/components/post/types/event/ProfileEventRelationship.js +31 -0
  353. package/dist/components/post/types/note/FullNote.d.ts +5 -0
  354. package/dist/components/post/types/note/FullNote.js +5 -0
  355. package/dist/components/post/types/poll/FullPoll.d.ts +5 -0
  356. package/dist/components/post/types/poll/FullPoll.js +7 -0
  357. package/dist/components/post/visibility.d.ts +7 -0
  358. package/dist/components/post/visibility.js +10 -0
  359. package/dist/components/preview-link/LocalPreviewLink.d.ts +4 -0
  360. package/dist/components/preview-link/LocalPreviewLink.js +12 -0
  361. package/dist/components/preview-link/PreviewLink.d.ts +4 -0
  362. package/dist/components/preview-link/PreviewLink.js +11 -0
  363. package/dist/components/preview-link/RemotePreviewLink.d.ts +4 -0
  364. package/dist/components/preview-link/RemotePreviewLink.js +21 -0
  365. package/dist/components/preview-link/helpers.d.ts +7 -0
  366. package/dist/components/preview-link/helpers.js +31 -0
  367. package/dist/components/preview-link/index.d.ts +3 -0
  368. package/dist/components/preview-link/index.js +2 -0
  369. package/dist/components/preview-link/local/GroupPreview.d.ts +4 -0
  370. package/dist/components/preview-link/local/GroupPreview.js +15 -0
  371. package/dist/components/preview-link/local/JamPreview.d.ts +9 -0
  372. package/dist/components/preview-link/local/JamPreview.js +20 -0
  373. package/dist/components/preview-link/local/PostPreview.d.ts +4 -0
  374. package/dist/components/preview-link/local/PostPreview.js +15 -0
  375. package/dist/components/profile/Avatar.d.ts +17 -0
  376. package/dist/components/profile/Avatar.js +36 -0
  377. package/dist/components/profile/AvatarWithName.d.ts +5 -0
  378. package/dist/components/profile/AvatarWithName.js +5 -0
  379. package/dist/components/profile/FollowUnfollowButton.d.ts +8 -0
  380. package/dist/components/profile/FollowUnfollowButton.js +27 -0
  381. package/dist/components/profile/ProfileBadge.d.ts +7 -0
  382. package/dist/components/profile/ProfileBadge.js +12 -0
  383. package/dist/components/profile/ProfileCard.d.ts +24 -0
  384. package/dist/components/profile/ProfileCard.js +12 -0
  385. package/dist/components/profile/ProfileFromId.d.ts +6 -0
  386. package/dist/components/profile/ProfileFromId.js +15 -0
  387. package/dist/components/profile/ProfileHeader.d.ts +10 -0
  388. package/dist/components/profile/ProfileHeader.js +16 -0
  389. package/dist/components/profile/ProfileLink.d.ts +9 -0
  390. package/dist/components/profile/ProfileLink.js +9 -0
  391. package/dist/components/profile/ProfilePageAction.d.ts +6 -0
  392. package/dist/components/profile/ProfilePageAction.js +35 -0
  393. package/dist/components/profile/ProfilePostsAndReplies.d.ts +9 -0
  394. package/dist/components/profile/ProfilePostsAndReplies.js +24 -0
  395. package/dist/components/profile/ProfileSelector.d.ts +14 -0
  396. package/dist/components/profile/ProfileSelector.js +72 -0
  397. package/dist/components/profile/ProfileStats.d.ts +5 -0
  398. package/dist/components/profile/ProfileStats.js +6 -0
  399. package/dist/components/profile/ProfileWithActionCard.d.ts +5 -0
  400. package/dist/components/profile/ProfileWithActionCard.js +6 -0
  401. package/dist/components/profile/ProfilesInput.d.ts +15 -0
  402. package/dist/components/profile/ProfilesInput.js +31 -0
  403. package/dist/components/profile/ReportProfileOrPostModal.d.ts +9 -0
  404. package/dist/components/profile/ReportProfileOrPostModal.js +75 -0
  405. package/dist/components/profile/index.d.ts +30 -0
  406. package/dist/components/profile/index.js +15 -0
  407. package/dist/components/registry/ErrorComponent.d.ts +6 -0
  408. package/dist/components/registry/ErrorComponent.js +7 -0
  409. package/dist/components/registry/PluginLoader.d.ts +3 -0
  410. package/dist/components/registry/PluginLoader.js +51 -0
  411. package/dist/components/registry/PluginRegistryProvider.d.ts +23 -0
  412. package/dist/components/registry/PluginRegistryProvider.js +57 -0
  413. package/dist/components/registry/PluginSlot.d.ts +7 -0
  414. package/dist/components/registry/PluginSlot.js +31 -0
  415. package/dist/components/registry/index.d.ts +10 -0
  416. package/dist/components/registry/index.js +16 -0
  417. package/dist/components/server-data/ServerDataProvider.d.ts +8 -0
  418. package/dist/components/server-data/ServerDataProvider.js +30 -0
  419. package/dist/components/server-data/context.d.ts +121 -0
  420. package/dist/components/server-data/context.js +10 -0
  421. package/dist/components/server-data/index.d.ts +4 -0
  422. package/dist/components/server-data/index.js +2 -0
  423. package/dist/components/server-data/types.d.ts +5 -0
  424. package/dist/components/server-data/types.js +1 -0
  425. package/dist/contexts/credentialsStore/index.d.ts +8 -0
  426. package/dist/contexts/credentialsStore/index.js +13 -0
  427. package/dist/contexts/credentialsStore/types.d.ts +4 -0
  428. package/dist/contexts/credentialsStore/types.js +1 -0
  429. package/dist/contexts/index.d.ts +3 -0
  430. package/dist/contexts/index.js +3 -0
  431. package/dist/contexts/openpeeps/helpers.d.ts +93 -0
  432. package/dist/contexts/openpeeps/helpers.js +311 -0
  433. package/dist/contexts/openpeeps/hooks/accounts.d.ts +302 -0
  434. package/dist/contexts/openpeeps/hooks/accounts.js +17 -0
  435. package/dist/contexts/openpeeps/hooks/admin.d.ts +17177 -0
  436. package/dist/contexts/openpeeps/hooks/admin.js +115 -0
  437. package/dist/contexts/openpeeps/hooks/auth.d.ts +55 -0
  438. package/dist/contexts/openpeeps/hooks/auth.js +22 -0
  439. package/dist/contexts/openpeeps/hooks/conversations.d.ts +9815 -0
  440. package/dist/contexts/openpeeps/hooks/conversations.js +6 -0
  441. package/dist/contexts/openpeeps/hooks/groups.d.ts +319 -0
  442. package/dist/contexts/openpeeps/hooks/groups.js +31 -0
  443. package/dist/contexts/openpeeps/hooks/index.d.ts +18 -0
  444. package/dist/contexts/openpeeps/hooks/index.js +26 -0
  445. package/dist/contexts/openpeeps/hooks/jams.d.ts +3318 -0
  446. package/dist/contexts/openpeeps/hooks/jams.js +32 -0
  447. package/dist/contexts/openpeeps/hooks/other.d.ts +239 -0
  448. package/dist/contexts/openpeeps/hooks/other.js +89 -0
  449. package/dist/contexts/openpeeps/hooks/payments.d.ts +36 -0
  450. package/dist/contexts/openpeeps/hooks/payments.js +10 -0
  451. package/dist/contexts/openpeeps/hooks/posts.d.ts +26001 -0
  452. package/dist/contexts/openpeeps/hooks/posts.js +139 -0
  453. package/dist/contexts/openpeeps/hooks/profiles.d.ts +6896 -0
  454. package/dist/contexts/openpeeps/hooks/profiles.js +43 -0
  455. package/dist/contexts/openpeeps/hooks/search.d.ts +9620 -0
  456. package/dist/contexts/openpeeps/hooks/search.js +24 -0
  457. package/dist/contexts/openpeeps/hooks/streaming.d.ts +26 -0
  458. package/dist/contexts/openpeeps/hooks/streaming.js +10 -0
  459. package/dist/contexts/openpeeps/hooks/useHasAuthToken.d.ts +2 -0
  460. package/dist/contexts/openpeeps/hooks/useHasAuthToken.js +35 -0
  461. package/dist/contexts/openpeeps/index.d.ts +21 -0
  462. package/dist/contexts/openpeeps/index.js +180 -0
  463. package/dist/contexts/openpeeps/types.d.ts +11 -0
  464. package/dist/contexts/openpeeps/types.js +1 -0
  465. package/dist/contexts/router/index.d.ts +28 -0
  466. package/dist/contexts/router/index.js +69 -0
  467. package/dist/email/index.d.ts +13 -0
  468. package/dist/email/index.js +10 -0
  469. package/dist/i18n/I18nProvider.d.ts +19 -0
  470. package/dist/i18n/I18nProvider.js +33 -0
  471. package/dist/i18n/context.d.ts +8 -0
  472. package/dist/i18n/context.js +10 -0
  473. package/dist/i18n/index.d.ts +5 -0
  474. package/dist/i18n/index.js +23 -0
  475. package/dist/index.d.ts +14 -0
  476. package/dist/index.js +14 -0
  477. package/dist/lib/apiErrorMessage.d.ts +3 -0
  478. package/dist/lib/apiErrorMessage.js +14 -0
  479. package/dist/lib/canvasUtils.d.ts +12 -0
  480. package/dist/lib/canvasUtils.js +104 -0
  481. package/dist/lib/configuration/helpers.d.ts +7 -0
  482. package/dist/lib/configuration/helpers.js +83 -0
  483. package/dist/lib/configuration/resolveSchema.d.ts +3 -0
  484. package/dist/lib/configuration/resolveSchema.js +8 -0
  485. package/dist/lib/groupCapabilityHelpers.d.ts +24 -0
  486. package/dist/lib/groupCapabilityHelpers.js +119 -0
  487. package/dist/lib/notificationBadge.d.ts +5 -0
  488. package/dist/lib/notificationBadge.js +25 -0
  489. package/dist/lib/postUnread.d.ts +2 -0
  490. package/dist/lib/postUnread.js +1 -0
  491. package/dist/lib/postViewCounter.d.ts +17 -0
  492. package/dist/lib/postViewCounter.js +162 -0
  493. package/dist/lib/threadHelpers.d.ts +5 -0
  494. package/dist/lib/threadHelpers.js +23 -0
  495. package/dist/lib/unseenCountsOptimistic.d.ts +15 -0
  496. package/dist/lib/unseenCountsOptimistic.js +43 -0
  497. package/dist/log/index.d.ts +11 -0
  498. package/dist/log/index.js +14 -0
  499. package/dist/push/index.d.ts +16 -0
  500. package/dist/push/index.js +145 -0
  501. package/dist/push/usePushSubscription.d.ts +18 -0
  502. package/dist/push/usePushSubscription.js +102 -0
  503. package/dist/push/vapid.d.ts +6 -0
  504. package/dist/push/vapid.js +12 -0
  505. package/dist/pwa/InstallPrompt.d.ts +13 -0
  506. package/dist/pwa/InstallPrompt.js +17 -0
  507. package/dist/pwa/NotificationPermissionPrompt.d.ts +22 -0
  508. package/dist/pwa/NotificationPermissionPrompt.js +56 -0
  509. package/dist/pwa/PwaProvider.d.ts +16 -0
  510. package/dist/pwa/PwaProvider.js +56 -0
  511. package/dist/pwa/UpdatePrompt.d.ts +14 -0
  512. package/dist/pwa/UpdatePrompt.js +14 -0
  513. package/dist/pwa/index.d.ts +18 -0
  514. package/dist/pwa/index.js +16 -0
  515. package/dist/pwa/navigationUrl.d.ts +16 -0
  516. package/dist/pwa/navigationUrl.js +51 -0
  517. package/dist/pwa/pushInvalidate.d.ts +7 -0
  518. package/dist/pwa/pushInvalidate.js +29 -0
  519. package/dist/pwa/registration.d.ts +28 -0
  520. package/dist/pwa/registration.js +71 -0
  521. package/dist/pwa/sw-types.d.ts +14 -0
  522. package/dist/pwa/sw-types.js +1 -0
  523. package/dist/pwa/sw.d.ts +2 -0
  524. package/dist/pwa/sw.js +171 -0
  525. package/dist/pwa/useInstallPrompt.d.ts +10 -0
  526. package/dist/pwa/useInstallPrompt.js +45 -0
  527. package/dist/pwa/useNotificationBadgeSync.d.ts +2 -0
  528. package/dist/pwa/useNotificationBadgeSync.js +23 -0
  529. package/dist/pwa/useServiceWorker.d.ts +19 -0
  530. package/dist/pwa/useServiceWorker.js +49 -0
  531. package/dist/pwa/vite.d.ts +50 -0
  532. package/dist/pwa/vite.js +53 -0
  533. package/dist/react-native.d.ts +11 -0
  534. package/dist/react-native.js +11 -0
  535. package/dist/setupTests.d.ts +1 -0
  536. package/dist/setupTests.js +5 -0
  537. package/dist/stores/breadcrumbs.d.ts +5 -0
  538. package/dist/stores/breadcrumbs.js +5 -0
  539. package/dist/stores/createStore.d.ts +19 -0
  540. package/dist/stores/createStore.js +63 -0
  541. package/dist/stores/index.d.ts +7 -0
  542. package/dist/stores/index.js +9 -0
  543. package/dist/stores/newPosts.d.ts +591 -0
  544. package/dist/stores/newPosts.js +191 -0
  545. package/dist/stores/pageHeader.d.ts +15 -0
  546. package/dist/stores/pageHeader.js +22 -0
  547. package/dist/stores/plusButton.d.ts +5 -0
  548. package/dist/stores/plusButton.js +13 -0
  549. package/dist/stores/types.d.ts +35 -0
  550. package/dist/stores/types.js +1 -0
  551. package/dist/streaming.d.ts +6 -0
  552. package/dist/streaming.js +6 -0
  553. package/dist/types/index.d.ts +0 -0
  554. package/dist/types/index.js +1 -0
  555. package/package.json +72 -0
  556. package/src/pwa/navigationUrl.ts +61 -0
  557. package/src/pwa/sw-types.ts +9 -0
  558. package/src/pwa/sw.ts +228 -0
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowRight } from 'lucide-react';
3
+ import { useT } from '../../../i18n/index.js';
4
+ import { resolveStaticUrl, useStaticRender } from '../../markdown/staticRender.js';
5
+ import { PostMarkdown } from '../Markdown.js';
6
+ import { firstNWords } from '../helpers.js';
7
+ export function FeedArticle({ post }) {
8
+ const t = useT();
9
+ const { enabled: staticRender, baseUrl } = useStaticRender();
10
+ const article = post.data;
11
+ const previewContent = firstNWords(article.content, 50);
12
+ const showReadMore = !!article.content && previewContent.length < article.content.length;
13
+ return (_jsxs("div", { className: "flex w-full min-w-0 flex-col gap-2", children: [article.image && (_jsx("img", { src: article.image, className: "w-full object-cover", alt: `image for ${article.title ?? 'article'}` })), _jsx("div", { className: "prose", children: _jsx("h3", { children: article.title }) }), _jsx(PostMarkdown, { source: `${previewContent}${showReadMore ? '...' : ''}` }), showReadMore && (_jsx("div", { className: "flex justify-end", children: _jsxs("a", { href: resolveStaticUrl(`/posts/${post.id}`, staticRender ? baseUrl : undefined), className: "text-primary inline-flex items-center gap-1 text-sm hover:underline", children: [t('posts.article.readMore', { defaultValue: 'Read more' }), _jsx(ArrowRight, { className: "inline-block size-4" })] }) }))] }));
14
+ }
@@ -0,0 +1,5 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ export interface FeedEventProps {
3
+ post: PublicPost;
4
+ }
5
+ export declare function FeedEvent({ post }: FeedEventProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT } from '../../../i18n/index.js';
3
+ import { resolveStaticUrl, useStaticRender } from '../../markdown/staticRender.js';
4
+ import { EventLocation } from '../pieces/EventLocation.js';
5
+ const fmtRange = (start, end) => {
6
+ const s = new Date(start).toLocaleString();
7
+ if (!end)
8
+ return s;
9
+ return `${s} → ${new Date(end).toLocaleString()}`;
10
+ };
11
+ export function FeedEvent({ post }) {
12
+ const t = useT();
13
+ const { enabled: staticRender, baseUrl } = useStaticRender();
14
+ if (post?.data?.type !== 'event') {
15
+ return (_jsx("h1", { children: "FeedEvent was used but post type is not \"event\". Please report this to the developers." }));
16
+ }
17
+ const event = post.data;
18
+ return (_jsxs("div", { className: "flex w-full flex-col gap-2", children: [event.image && (_jsx("span", { className: "aspect-video w-full overflow-hidden", children: _jsx("img", { src: event.image, className: "h-full w-full object-cover", alt: `image for ${event.name ?? 'event'}` }) })), _jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("span", { className: "text-error-600 text-sm", children: [fmtRange(event.start, event.end), ' ', _jsx("span", { className: "text-muted-foreground", children: "(your local time)" })] }), _jsx("a", { href: resolveStaticUrl(`/posts/${post.id}`, staticRender ? baseUrl : undefined), className: "border-primary text-primary hover:bg-primary/10 rounded-md border px-3 py-1 text-sm", children: t('posts.event.viewEvent', { defaultValue: 'View Event' }) })] }), _jsx("div", { className: "text-lg font-medium", children: event.name }), _jsx(EventLocation, { post: post })] }));
19
+ }
@@ -0,0 +1,5 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ export interface FeedNoteProps {
3
+ post: PublicPost;
4
+ }
5
+ export declare function FeedNote({ post }: FeedNoteProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { OpenpeepsMarkdown } from '../../markdown/OpenpeepsMarkdown.js';
3
+ import { Attachments } from '../pieces/Attachments.js';
4
+ export function FeedNote({ post }) {
5
+ if (post?.data?.type !== 'note') {
6
+ return (_jsx("h1", { children: "FeedNote was used but post type is not \"note\". Please report this to the developers." }));
7
+ }
8
+ const data = post.data;
9
+ return (_jsxs("div", { children: [_jsx(OpenpeepsMarkdown, { source: data.content, mentions: post.mentions, linkPreviewMode: post.data.attachments?.length ? 'none' : 'append' }), _jsx(Attachments, { post: post })] }));
10
+ }
@@ -0,0 +1,7 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ export interface FeedPollProps {
3
+ post: PublicPost;
4
+ /** When false, show static options only (e.g. email previews). */
5
+ interactive?: boolean;
6
+ }
7
+ export declare function FeedPoll({ post, interactive }: FeedPollProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { PostMarkdown } from '../Markdown.js';
3
+ import { Attachments } from '../pieces/Attachments.js';
4
+ import { PollContent } from '../pieces/PollContent.js';
5
+ export function FeedPoll({ post, interactive = true }) {
6
+ if (post?.data?.type !== 'question') {
7
+ return (_jsx("p", { className: "text-error text-sm", children: "FeedPoll was used for a non-question post." }));
8
+ }
9
+ const data = post.data;
10
+ return (_jsxs("div", { className: "space-y-3", children: [data.content ? (_jsx(PostMarkdown, { source: data.content, mentions: post.mentions, linkPreviewMode: data.attachments?.length ? 'none' : 'append' })) : null, _jsx(Attachments, { post: post }), interactive ? (_jsx(PollContent, { post: post })) : (_jsxs(_Fragment, { children: [_jsx("ul", { className: "space-y-1.5", children: data.options.map((opt, idx) => (_jsx("li", { className: "rounded-md border border-border px-3 py-2 text-sm", children: opt.content }, idx))) }), data.expiresAt ? (_jsxs("p", { className: "text-muted-foreground text-xs", children: ["Closes ", new Date(data.expiresAt).toLocaleString()] })) : null] }))] }));
11
+ }
@@ -0,0 +1,5 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ export interface FullArticleProps {
3
+ post: PublicPost;
4
+ }
5
+ export declare function FullArticle({ post }: FullArticleProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FullPostLayout } from '../../FullPostLayout.js';
3
+ import { FeedPost } from '../../FeedPost.js';
4
+ import { PostMarkdown } from '../../Markdown.js';
5
+ export function FullArticle({ post }) {
6
+ const article = post.data;
7
+ return (_jsx(FullPostLayout, { post: post, deleteCallback: () => window.history.back(), children: _jsx(FeedPost, { post: post, noReactionHeader: true, deleteCallback: () => window.history.back(), content: _jsxs("div", { className: "flex w-full min-w-0 flex-col gap-2", children: [article.image ? (_jsx("img", { src: article.image, className: "w-full object-cover", alt: article.title ? `image for ${article.title}` : 'Article' })) : null, _jsx("div", { className: "prose mb-6", children: _jsx("h1", { children: article.title }) }), _jsx(PostMarkdown, { source: article.content ?? '' })] }) }) }));
8
+ }
@@ -0,0 +1,5 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ export interface CardEventProps {
3
+ post: PublicPost;
4
+ }
5
+ export declare function CardEvent({ post }: CardEventProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getJamUrl, truncateText } from '@openpeepshq/common/lib';
3
+ import { Button } from '@openpeepshq/react-ui';
4
+ import { useOpenpeeps } from '../../../../contexts/openpeeps/index.js';
5
+ import { useT } from '../../../../i18n/index.js';
6
+ import { useCurrentProfile } from '../../../layout/IdentityContext.js';
7
+ import { usePostViewRef } from '../../../../lib/postViewCounter.js';
8
+ import { EventLocation } from '../../pieces/EventLocation.js';
9
+ import { ParticipantsCard } from '../../pieces/ParticipantsCard.js';
10
+ import { ProfileEventRelationship } from './ProfileEventRelationship.js';
11
+ function formatEventTimespan(event) {
12
+ if (!event.start)
13
+ return '';
14
+ const start = new Date(event.start);
15
+ const end = event.end ? new Date(event.end) : undefined;
16
+ const datePart = start.toLocaleDateString(undefined, {
17
+ weekday: 'short',
18
+ month: 'short',
19
+ day: 'numeric',
20
+ });
21
+ const timePart = start.toLocaleTimeString(undefined, {
22
+ hour: '2-digit',
23
+ minute: '2-digit',
24
+ });
25
+ if (end) {
26
+ return `${datePart} · ${timePart} – ${end.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' })}`;
27
+ }
28
+ return `${datePart} · ${timePart}`;
29
+ }
30
+ export function CardEvent({ post }) {
31
+ const t = useT();
32
+ const me = useCurrentProfile();
33
+ const postViewRef = usePostViewRef(post.id);
34
+ const { openpeepsApi } = useOpenpeeps();
35
+ const event = post.data;
36
+ const jam = event.jam;
37
+ const jamStateQuery = openpeepsApi.useJamState(post.id);
38
+ const jamState = jam ? jamStateQuery.data : undefined;
39
+ const attendeesLength = jamState?.participants.length ?? 0;
40
+ const jamLink = getJamUrl(post.id, typeof window !== 'undefined' ? window.location.origin : undefined);
41
+ const postLink = `/posts/${post.id}`;
42
+ return (_jsxs("div", { ref: postViewRef, className: "hover:bg-surface-100 mb-6 w-full overflow-hidden rounded-lg border", children: [_jsx("a", { href: postLink, className: "block", children: _jsx("div", { className: "aspect-video w-full overflow-hidden", children: _jsx("img", { src: event.image || '/img/event-default.png', alt: event.name ? `image for ${event.name}` : 'Event', className: "h-full w-full object-cover" }) }) }), _jsxs("div", { className: "grid gap-y-4 p-4", children: [_jsxs("a", { href: postLink, className: "block text-inherit no-underline", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: formatEventTimespan(event) }), _jsx("h3", { className: "text-xl font-semibold", children: truncateText(event.name, 100) || '-' })] }), _jsxs("div", { className: "flex flex-wrap gap-x-2 gap-y-1", children: [_jsx(EventLocation, { post: post, truncate: true }), _jsx(ProfileEventRelationship, { post: post })] }), jam && me ? (jamState?.active ? (_jsxs("div", { className: "text-surface-600 flex items-center justify-start gap-2 text-xs", children: [_jsx("span", { className: "w-12", children: _jsx(ParticipantsCard, { jamState: jamState }) }), _jsxs("span", { children: [attendeesLength, ' ', attendeesLength === 1
43
+ ? t('events.jam.attendee', { defaultValue: 'attendee' })
44
+ : t('events.jam.attendees', { defaultValue: 'attendees' })] }), _jsx(Button, { action: jamLink, variant: "variant-filled-primary", compact: true, children: t('jam.join.submit', { defaultValue: 'Join Jam' }) })] })) : jam.moderators.includes(me.id) ? (_jsx("div", { children: _jsx(Button, { action: jamLink, variant: "variant-filled-primary", children: t('jam.start.submit', { defaultValue: 'Start Jam' }) }) })) : null) : null] })] }));
45
+ }
@@ -0,0 +1,5 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ export interface FullEventProps {
3
+ post: PublicPost;
4
+ }
5
+ export declare function FullEvent({ post }: FullEventProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,161 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Download, MoreHorizontal, Share, Trash2 } from 'lucide-react';
3
+ import { useMemo, useState } from 'react';
4
+ import { buildThreads, calculateEffectiveRsvps, canAccessJamRecordings, canManageEventRsvps, canModerateJam, countYesRsvps, groupName, isCapacityEvent, profileName, } from '@openpeepshq/common/lib';
5
+ import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, LoadingSpinner, PopupMenu, PopupMenuButton, UpdatingDate } from '@openpeepshq/react-ui';
6
+ import { useOpenpeeps } from '../../../../contexts/openpeeps/index.js';
7
+ import { useT } from '../../../../i18n/index.js';
8
+ import { useCurrentProfile } from '../../../layout/IdentityContext.js';
9
+ import { useToast } from '../../../layout/ToastProvider.js';
10
+ import { usePostViewRef } from '../../../../lib/postViewCounter.js';
11
+ import { useCreateNewConversation } from '../../../conversations/index.js';
12
+ import { Avatar, FollowUnfollowButton, ProfileCard, ProfileFromId, } from '../../../profile/index.js';
13
+ import { OpenpeepsMarkdown } from '../../../markdown/OpenpeepsMarkdown.js';
14
+ import { ThreadedFeed } from '../../feed/threaded/ThreadedFeed.js';
15
+ import { ReplyBox } from '../../ReplyBox.js';
16
+ import { EventLocation } from '../../pieces/EventLocation.js';
17
+ import { EventMenu } from '../../pieces/EventMenu.js';
18
+ import { EventRsvpButton } from '../../pieces/EventRsvpButton.js';
19
+ import { ShareMenu } from '../../pieces/ShareMenu.js';
20
+ import { VideoPlayer } from '../../pieces/VideoPlayer.js';
21
+ export function FullEvent({ post }) {
22
+ const t = useT();
23
+ const profile = useCurrentProfile();
24
+ const { openCreateConversation } = useCreateNewConversation();
25
+ const postViewRef = usePostViewRef(post.id);
26
+ const { openpeepsApi } = useOpenpeeps();
27
+ const event = post.data;
28
+ const contextQuery = openpeepsApi.usePostContext(post.id);
29
+ const jamAttendeesQuery = openpeepsApi.useJamAttendance(post.id);
30
+ const canViewRecordings = canAccessJamRecordings(profile, post);
31
+ const recordingsQuery = openpeepsApi.usePostRecordings(post.id, !!event.jam && canViewRecordings);
32
+ const [tab, setTab] = useState(event.content ? 'description' : 'replies');
33
+ const group = post.group;
34
+ const myEvent = post.profile?.id === profile?.id;
35
+ const iAmModerator = canModerateJam(profile, post);
36
+ const canManageRsvps = canManageEventRsvps(profile, post);
37
+ const rsvps = useMemo(() => calculateEffectiveRsvps(post), [post]);
38
+ const slotsLeft = isCapacityEvent(event) && event.maxAttendees !== undefined
39
+ ? event.maxAttendees - countYesRsvps(post)
40
+ : null;
41
+ const rsvpManage = openpeepsApi.rsvpManageAction();
42
+ const descendentThreads = useMemo(() => (contextQuery.data && buildThreads(contextQuery.data.descendants)) || [], [contextQuery.data]);
43
+ const eventScope = useMemo(() => {
44
+ if (post.visibility === 'public')
45
+ return t('events.public', { defaultValue: 'Public' });
46
+ if (post.groupId && post.visibility === 'group')
47
+ return t('events.group', { defaultValue: 'Group' });
48
+ if (post.visibility === 'direct')
49
+ return t('events.private', { defaultValue: 'Private' });
50
+ return t('events.community', { defaultValue: 'Community' });
51
+ }, [post, t]);
52
+ const showJamAttendeesTab = !!event.jam && (myEvent || iAmModerator) && jamAttendeesQuery.isSuccess;
53
+ return (_jsxs("div", { ref: postViewRef, className: "flex w-full flex-col gap-2 p-3", children: [_jsx("span", { className: "mb-3 block aspect-video w-full overflow-hidden rounded", children: _jsx("img", { src: event.image || '/img/event-default.png', className: "h-full w-full object-cover", alt: event.name ? `image for ${event.name}` : 'Event' }) }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex gap-x-4", children: [_jsx("span", { className: "bg-surface-200 mb-3 inline-block rounded-lg px-3 py-1 text-sm", children: eventScope }), slotsLeft !== null ? (_jsx("span", { className: "bg-surface-200 mb-3 inline-block rounded-lg px-3 py-1 text-sm", children: slotsLeft <= 0
54
+ ? t('events.noSpotsAvailable', {
55
+ defaultValue: 'No spots available',
56
+ })
57
+ : t('events.slotsLeft', {
58
+ defaultValue: '{{count}} slots left',
59
+ count: slotsLeft,
60
+ }) })) : null] }), post.groupId && group ? (_jsx("a", { href: `/groups/@${group.handle}`, className: "text-muted-foreground block text-sm hover:underline", children: groupName(group) })) : null] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ShareMenu, { post: post, menuButton: _jsx("span", { className: "flex size-10 items-center justify-center rounded-md", children: _jsx(Share, { className: "size-4" }) }) }), myEvent ? (_jsx(EventMenu, { post: post, menuButton: _jsx("span", { className: "border-input flex size-10 items-center justify-center rounded-md border", children: _jsx(MoreHorizontal, { className: "size-4" }) }) })) : null] })] }), _jsx("h1", { className: "text-2xl font-bold", children: event.name }), _jsxs("div", { className: "mt-2 flex items-center gap-x-2", children: [_jsx(Avatar, { profile: post.profile, size: 2 }), _jsx("span", { className: "text-sm", children: t('events.hostedBy', {
61
+ defaultValue: 'Hosted by {{profileName}}',
62
+ profileName: `${profileName(post.profile)}${myEvent ? ' · You' : ''}`,
63
+ }) })] }), event.start ? (_jsxs("div", { className: "mt-4 flex gap-x-4", children: [_jsxs("div", { className: "border-foreground/20 rounded-md border px-4 py-1", children: [_jsx("p", { className: "text-center text-sm", children: new Date(event.start).toLocaleString(undefined, {
64
+ month: 'short',
65
+ }) }), _jsx("p", { className: "text-center text-lg font-semibold", children: new Date(event.start).getDate() })] }), _jsxs("div", { children: [_jsx("span", { className: "text-muted-foreground text-sm", children: t('events.startDate', { defaultValue: 'Starts' }) }), _jsx("p", { children: new Date(event.start).toLocaleDateString(undefined, {
66
+ weekday: 'long',
67
+ month: 'long',
68
+ day: 'numeric',
69
+ year: 'numeric',
70
+ }) }), _jsx("p", { className: "text-muted-foreground mt-2 text-sm", children: new Date(event.start).toLocaleTimeString(undefined, {
71
+ hour: '2-digit',
72
+ minute: '2-digit',
73
+ }) })] })] })) : null, event.end ? (_jsxs("div", { className: "mt-4 flex gap-x-4", children: [_jsxs("div", { className: "border-foreground/20 rounded-md border px-4 py-1", children: [_jsx("p", { className: "text-center text-sm", children: new Date(event.end).toLocaleString(undefined, {
74
+ month: 'short',
75
+ }) }), _jsx("p", { className: "text-center text-lg font-semibold", children: new Date(event.end).getDate() })] }), _jsxs("div", { children: [_jsx("span", { className: "text-muted-foreground text-sm", children: t('events.endDate', { defaultValue: 'Ends' }) }), _jsx("p", { children: new Date(event.end).toLocaleDateString(undefined, {
76
+ weekday: 'long',
77
+ month: 'long',
78
+ day: 'numeric',
79
+ year: 'numeric',
80
+ }) }), _jsx("p", { className: "text-muted-foreground mt-2 text-sm", children: new Date(event.end).toLocaleTimeString(undefined, {
81
+ hour: '2-digit',
82
+ minute: '2-digit',
83
+ }) })] })] })) : null, _jsx(EventLocation, { post: post, preview: false }), _jsx(EventRsvpButton, { post: post }), event.jam && (myEvent || iAmModerator) ? (_jsx(Button, { variant: "variant-filled-primary", className: "mt-2 w-full", action: `/events/${post.id}/jam`, children: t('events.jam.start', { defaultValue: 'Start jam' }) })) : null, _jsxs("nav", { className: "mt-4 flex flex-wrap gap-2 border-b", children: [event.content ? (_jsx(TabButton, { active: tab === 'description', onClick: () => setTab('description'), children: t('events.tabs.description', { defaultValue: 'Description' }) })) : null, _jsx(TabButton, { active: tab === 'replies', onClick: () => setTab('replies'), children: t('events.tabs.discussion', { defaultValue: 'Discussion' }) }), _jsx(TabButton, { active: tab === 'rsvps', onClick: () => setTab('rsvps'), children: t('events.tabs.rsvps', { defaultValue: 'RSVPs' }) }), showJamAttendeesTab ? (_jsx(TabButton, { active: tab === 'attendees', onClick: () => setTab('attendees'), children: t('events.tabs.jamAttendees', { defaultValue: 'Jam attendees' }) })) : null, event.jam && canViewRecordings ? (_jsx(TabButton, { active: tab === 'recordings', onClick: () => setTab('recordings'), children: t('events.tabs.recordings', { defaultValue: 'Recordings' }) })) : null] }), tab === 'description' && event.content ? (_jsx(OpenpeepsMarkdown, { source: event.content, mentions: post.mentions })) : null, tab === 'replies' ? (_jsxs(_Fragment, { children: [_jsx(ReplyBox, { post: post }), contextQuery.isLoading ? (_jsx("div", { className: "text-muted-foreground py-4 text-sm", children: _jsx(LoadingSpinner, {}) })) : (descendentThreads.map((thread) => (_jsx(ThreadedFeed, { thread: thread, isDescendants: true }, thread.id))))] })) : null, tab === 'rsvps' ? (rsvps.length ? (rsvps.map((rsvp) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(ProfileCard, { profile: rsvp.profile, action: profile && profile.id !== rsvp.profile.id ? (_jsxs(PopupMenu, { children: [profile.following?.some((f) => f.id === rsvp.profile.id) ? (_jsx(PopupMenuButton, { title: t('profile.actions.message', {
84
+ defaultValue: 'Message',
85
+ }), text: t('profile.actions.message', {
86
+ defaultValue: 'Message',
87
+ }), action: () => openCreateConversation({
88
+ profiles: [rsvp.profile],
89
+ skipProfileSelection: true,
90
+ }) })) : null, _jsx(FollowUnfollowButton, { profile: rsvp.profile, popup: true })] })) : undefined }) }), canManageRsvps && rsvp.profile.id !== post.profile.id ? (rsvp.response === 'removed' ? (_jsx(Button, { variant: "variant-ringed-primary", action: () => rsvpManage({ response: 'yes' }, { id: post.id, profileId: rsvp.profile.id }), children: t('events.rsvp.restoreAttendee', {
91
+ defaultValue: 'Restore',
92
+ }) })) : (_jsx(Button, { variant: "variant-ringed-error", action: () => rsvpManage({ response: 'removed' }, { id: post.id, profileId: rsvp.profile.id }), children: t('events.rsvp.removeAttendee', {
93
+ defaultValue: 'Remove',
94
+ }) }))) : null] }, rsvp.profile.id)))) : (_jsx("p", { className: "text-muted-foreground py-4 text-sm", children: t('events.noRsvps', { defaultValue: 'No RSVPs yet.' }) }))) : null, tab === 'attendees' && showJamAttendeesTab ? (jamAttendeesQuery.data?.length ? (jamAttendeesQuery.data.map((attendee) => (_jsx(ProfileFromId, { profileId: attendee.profileId, action: _jsx(UpdatingDate, { date: attendee.createdAt }) }, attendee.id)))) : (_jsx("p", { className: "text-muted-foreground py-4 text-sm", children: t('events.noAttendees', { defaultValue: 'No attendees yet.' }) }))) : null, tab === 'recordings' && event.jam && canViewRecordings ? (recordingsQuery.isLoading ? (_jsx("div", { className: "text-muted-foreground py-4 text-sm", children: _jsx(LoadingSpinner, {}) })) : recordingsQuery.data?.length ? (recordingsQuery.data.map((recording) => (_jsx(JamRecordingItem, { post: post, recording: recording, canManage: canViewRecordings }, recording.id)))) : (_jsx("p", { className: "text-muted-foreground py-4 text-sm", children: t('events.noRecordings', { defaultValue: 'No recordings yet.' }) }))) : null, _jsx("div", { className: "h-[40vh]" })] }));
95
+ }
96
+ function JamRecordingItem({ post, recording, canManage, }) {
97
+ const t = useT();
98
+ const { success, error: toastError } = useToast();
99
+ const { openpeepsApi } = useOpenpeeps();
100
+ const [confirmOpen, setConfirmOpen] = useState(false);
101
+ const publishReply = openpeepsApi.publishRecordingReplyAction({
102
+ id: post.id,
103
+ recordingId: recording.id,
104
+ });
105
+ const deleteRecording = openpeepsApi.deleteRecordingAction({
106
+ id: post.id,
107
+ recordingId: recording.id,
108
+ });
109
+ const handleDelete = async () => {
110
+ try {
111
+ await deleteRecording();
112
+ setConfirmOpen(false);
113
+ success(t('events.deleteRecordingSuccess', {
114
+ defaultValue: 'Recording deleted',
115
+ }));
116
+ }
117
+ catch {
118
+ toastError(t('events.deleteRecordingError', {
119
+ defaultValue: 'Failed to delete recording',
120
+ }));
121
+ }
122
+ };
123
+ return (_jsxs("div", { className: "flex flex-col gap-2 py-4", children: [_jsx(UpdatingDate, { date: recording.createdAt }), recording.status === 'completed' && recording.attachment ? (_jsxs(_Fragment, { children: [_jsx(VideoPlayer, { attachment: recording.attachment, autoPlay: false, muted: false, className: "aspect-video w-full rounded-md" }), _jsxs("a", { href: recording.attachment.url, download: recording.attachment.filename, className: "text-primary inline-flex items-center gap-1 self-start text-sm hover:underline", children: [_jsx(Download, { className: "h-4 w-4" }), t('events.downloadRecording', {
124
+ defaultValue: 'Download recording',
125
+ })] })] })) : (_jsx("p", { className: "text-muted-foreground text-sm", children: recording.status === 'active'
126
+ ? t('events.recordingInProgress', {
127
+ defaultValue: 'Recording in progress…',
128
+ })
129
+ : t('events.recordingProcessing', {
130
+ defaultValue: 'Processing recording…',
131
+ }) })), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [canManage &&
132
+ recording.status === 'completed' &&
133
+ recording.attachment ? (recording.replyPostId ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('events.recordingReplyPosted', {
134
+ defaultValue: 'Posted to discussion',
135
+ }) })) : (_jsx(Button, { variant: "variant-ringed-primary", className: "self-start", action: async () => {
136
+ try {
137
+ await publishReply();
138
+ success(t('events.postRecordingReplySuccess', {
139
+ defaultValue: 'Recording posted to discussion',
140
+ }));
141
+ }
142
+ catch {
143
+ toastError(t('events.postRecordingReplyError', {
144
+ defaultValue: 'Failed to post recording to discussion',
145
+ }));
146
+ }
147
+ }, children: t('events.postRecordingReply', {
148
+ defaultValue: 'Post to discussion',
149
+ }) }))) : null, canManage &&
150
+ recording.status !== 'active' &&
151
+ recording.status !== 'requested' ? (_jsxs(_Fragment, { children: [_jsxs(Button, { variant: "variant-ringed-error", className: "self-start", action: () => setConfirmOpen(true), children: [_jsx(Trash2, { className: "mr-1 h-4 w-4" }), t('events.deleteRecording', {
152
+ defaultValue: 'Delete recording',
153
+ })] }), _jsx(Dialog, { open: confirmOpen, onOpenChange: (next) => !next && setConfirmOpen(false), children: _jsxs(DialogContent, { className: "max-w-sm", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('events.deleteRecording', {
154
+ defaultValue: 'Delete recording',
155
+ }) }) }), _jsx("p", { className: "text-sm", children: t('events.deleteRecordingConfirm', {
156
+ defaultValue: 'Delete this recording permanently?',
157
+ }) }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ringed-surface", action: () => setConfirmOpen(false), children: t('posts.deleteModal.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "variant-filled-error", action: handleDelete, children: t('posts.deleteModal.delete', { defaultValue: 'Delete' }) })] })] }) })] })) : null] })] }));
158
+ }
159
+ function TabButton({ active, onClick, children, }) {
160
+ return (_jsx("button", { type: "button", onClick: onClick, className: `px-4 py-2 text-sm ${active ? 'border-primary border-b-2 font-semibold' : 'text-muted-foreground hover:text-foreground'}`, children: children }));
161
+ }
@@ -0,0 +1,5 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ export interface ProfileEventRelationshipProps {
3
+ post: PublicPost;
4
+ }
5
+ export declare function ProfileEventRelationship({ post, }: ProfileEventRelationshipProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { calculateEffectiveRsvps } from '@openpeepshq/common/lib';
3
+ import { useT } from '../../../../i18n/index.js';
4
+ import { useCurrentProfile } from '../../../layout/IdentityContext.js';
5
+ export function ProfileEventRelationship({ post, }) {
6
+ const t = useT();
7
+ const me = useCurrentProfile();
8
+ const event = post.data;
9
+ const myEvent = post.profile?.id === me?.id;
10
+ const iAmModerator = !!event.moderators?.includes(me?.id ?? '');
11
+ const myRsvp = calculateEffectiveRsvps(post).find((rsvp) => me?.id === rsvp.profile.id);
12
+ if (myEvent) {
13
+ return (_jsx("div", { className: "text-muted-foreground rounded-2xl px-2", children: _jsx("span", { className: "text-background text-center text-sm", children: t('events.profileRelationship.owner', { defaultValue: 'Owner' }) }) }));
14
+ }
15
+ if (iAmModerator) {
16
+ return (_jsx("div", { className: "text-muted-foreground rounded-2xl px-2", children: _jsx("span", { className: "text-center text-sm", children: t('events.profileRelationship.moderator', {
17
+ defaultValue: 'Moderator',
18
+ }) }) }));
19
+ }
20
+ if (myRsvp?.response === 'yes') {
21
+ return (_jsx("div", { className: "text-muted-foreground rounded-2xl px-2", children: _jsx("span", { className: "text-foreground text-center text-sm", children: t('events.profileRelationship.attending', {
22
+ defaultValue: 'Attending',
23
+ }) }) }));
24
+ }
25
+ if (myRsvp?.response === 'tentative') {
26
+ return (_jsx("div", { className: "text-muted-foreground rounded-2xl px-2", children: _jsx("span", { className: "text-foreground text-center text-sm", children: t('events.profileRelationship.tentative', {
27
+ defaultValue: 'Tentative',
28
+ }) }) }));
29
+ }
30
+ return null;
31
+ }
@@ -0,0 +1,5 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ export interface FullNoteProps {
3
+ post: PublicPost;
4
+ }
5
+ export declare function FullNote({ post }: FullNoteProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FullPostLayout } from '../../FullPostLayout.js';
3
+ export function FullNote({ post }) {
4
+ return (_jsx(FullPostLayout, { post: post, deleteCallback: () => window.history.back() }));
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { PublicPost } from '@openpeepshq/common/types';
2
+ export interface FullPollProps {
3
+ post: PublicPost;
4
+ }
5
+ export declare function FullPoll({ post }: FullPollProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FullPostLayout } from '../../FullPostLayout.js';
3
+ import { FeedPost } from '../../FeedPost.js';
4
+ import { FeedPoll } from '../Poll.js';
5
+ export function FullPoll({ post }) {
6
+ return (_jsx(FullPostLayout, { post: post, deleteCallback: () => window.history.back(), children: _jsx(FeedPost, { post: post, noReactionHeader: true, deleteCallback: () => window.history.back(), content: _jsx(FeedPoll, { post: post, interactive: true }) }) }));
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { VisibilityType } from '@openpeepshq/common';
2
+ /**
3
+ * Hook port of `@openpeepshq/svelte/utils/postHelpers.ts::getDefaultVisibility()`:
4
+ * returns `'public'` when the community allows public content, `'local'`
5
+ * otherwise.
6
+ */
7
+ export declare const useDefaultVisibility: () => VisibilityType;
@@ -0,0 +1,10 @@
1
+ import { useServerInfo } from '../server-data/index.js';
2
+ /**
3
+ * Hook port of `@openpeepshq/svelte/utils/postHelpers.ts::getDefaultVisibility()`:
4
+ * returns `'public'` when the community allows public content, `'local'`
5
+ * otherwise.
6
+ */
7
+ export const useDefaultVisibility = () => {
8
+ const serverInfo = useServerInfo();
9
+ return serverInfo.publicContent ? 'public' : 'local';
10
+ };
@@ -0,0 +1,4 @@
1
+ export interface LocalPreviewLinkProps {
2
+ url: string;
3
+ }
4
+ export declare function LocalPreviewLink({ url }: LocalPreviewLinkProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isGroupPath, isJamPath, isPostPath } from './helpers.js';
3
+ import { GroupPreview } from './local/GroupPreview.js';
4
+ import { PostPreview } from './local/PostPreview.js';
5
+ import { JamPreview } from './local/JamPreview.js';
6
+ export function LocalPreviewLink({ url }) {
7
+ const path = new URL(url).pathname;
8
+ const isPost = isPostPath(path);
9
+ const isJam = isJamPath(path);
10
+ const isGroup = isGroupPath(path);
11
+ return (_jsxs("a", { href: url, className: "hover:bg-surface-100 mb-2 block w-full min-w-0 max-w-full overflow-hidden rounded-md border p-3 no-underline", onClick: (e) => e.stopPropagation(), children: [isPost ? _jsx(PostPreview, { path: path }) : null, isGroup ? _jsx(GroupPreview, { path: path }) : null, isJam ? _jsx(JamPreview, { path: path }) : null] }));
12
+ }
@@ -0,0 +1,4 @@
1
+ export interface PreviewLinkProps {
2
+ url?: string;
3
+ }
4
+ export declare function PreviewLink({ url }: PreviewLinkProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { isLocalLink, isValidUrl } from './helpers.js';
3
+ import { LocalPreviewLink } from './LocalPreviewLink.js';
4
+ import { RemotePreviewLink } from './RemotePreviewLink.js';
5
+ export function PreviewLink({ url = '' }) {
6
+ if (!isValidUrl(url))
7
+ return null;
8
+ const origin = typeof window !== 'undefined' ? window.location.origin : '';
9
+ const local = isLocalLink(url, origin);
10
+ return (_jsx("div", { className: "min-w-0 max-w-full overflow-hidden", children: local ? (_jsx(LocalPreviewLink, { url: url })) : (_jsx(RemotePreviewLink, { url: url })) }));
11
+ }
@@ -0,0 +1,4 @@
1
+ export interface RemotePreviewLinkProps {
2
+ url: string;
3
+ }
4
+ export declare function RemotePreviewLink({ url }: RemotePreviewLinkProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LoadingSpinner } from '@openpeepshq/react-ui';
3
+ import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
4
+ export function RemotePreviewLink({ url }) {
5
+ const { openpeepsApi } = useOpenpeeps();
6
+ const previewQuery = openpeepsApi.usePreviewLink(url);
7
+ if (previewQuery.isLoading) {
8
+ return (_jsx("div", { className: "text-muted-foreground py-2 text-sm", children: _jsx(LoadingSpinner, {}) }));
9
+ }
10
+ const data = previewQuery.data?.data;
11
+ if (!data)
12
+ return null;
13
+ let hostname = url;
14
+ try {
15
+ hostname = new URL(url).hostname;
16
+ }
17
+ catch {
18
+ /* keep url */
19
+ }
20
+ return (_jsx("a", { href: url, target: "_blank", rel: "noreferrer", className: "hover:bg-surface-100 mb-2 block w-full min-w-0 max-w-full overflow-hidden rounded-md border no-underline", onClick: (e) => e.stopPropagation(), children: _jsxs("div", { className: "flex w-full min-w-0 flex-row items-center gap-4 p-2", children: [data.image ? (_jsx("div", { className: "flex h-24 w-24 shrink-0 items-center justify-center", children: _jsx("img", { src: data.image, alt: data.title ?? '', className: "h-full w-full rounded-md object-cover" }) })) : null, _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [_jsx("p", { className: "text-muted-foreground truncate text-xs", children: hostname }), data.title ? (_jsx("p", { className: "truncate font-semibold", children: data.title })) : null, data.description ? (_jsx("p", { className: "text-muted-foreground truncate text-sm", children: data.description })) : null] })] }) }));
21
+ }
@@ -0,0 +1,7 @@
1
+ export declare const isPostPath: (path: string) => boolean;
2
+ export declare const isJamPath: (path: string) => boolean;
3
+ export declare const isGroupPath: (path: string) => boolean;
4
+ export declare const isLocalLink: (url: string, origin: string) => boolean;
5
+ export declare const isValidUrl: (url?: string) => boolean;
6
+ export declare const isEmail: (url: string) => boolean;
7
+ export declare const extractUrlsFromText: (text?: string) => [] | RegExpMatchArray;
@@ -0,0 +1,31 @@
1
+ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2
+ export const isPostPath = (path) => path.startsWith('/posts/') && UUID_RE.test(path.substring(7));
3
+ export const isJamPath = (path) => path.startsWith('/events/') &&
4
+ UUID_RE.test(path.substring(8, 44)) &&
5
+ path.endsWith('/jam');
6
+ export const isGroupPath = (path) => path.startsWith('/groups/@');
7
+ export const isLocalLink = (url, origin) => {
8
+ try {
9
+ const urlObj = new URL(url);
10
+ return (urlObj.origin === origin &&
11
+ (isPostPath(urlObj.pathname) ||
12
+ isJamPath(urlObj.pathname) ||
13
+ isGroupPath(urlObj.pathname)));
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ };
19
+ export const isValidUrl = (url) => {
20
+ if (!url)
21
+ return false;
22
+ try {
23
+ new URL(url);
24
+ return true;
25
+ }
26
+ catch {
27
+ return false;
28
+ }
29
+ };
30
+ export const isEmail = (url) => /^mailto:|^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(url);
31
+ export const extractUrlsFromText = (text) => text?.match(/\bhttps?:\/\/\S+/gi) ?? [];
@@ -0,0 +1,3 @@
1
+ export { PreviewLink } from './PreviewLink';
2
+ export type { PreviewLinkProps } from './PreviewLink';
3
+ export { extractUrlsFromText, isValidUrl } from './helpers';
@@ -0,0 +1,2 @@
1
+ export { PreviewLink } from './PreviewLink.js';
2
+ export { extractUrlsFromText, isValidUrl } from './helpers.js';
@@ -0,0 +1,4 @@
1
+ export interface GroupPreviewProps {
2
+ path: string;
3
+ }
4
+ export declare function GroupPreview({ path }: GroupPreviewProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { GroupCard } from '../../groups/GroupCard.js';
3
+ import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
4
+ import { LoadingSpinner } from '@openpeepshq/react-ui';
5
+ export function GroupPreview({ path }) {
6
+ const handle = path.substring(9);
7
+ const { openpeepsApi } = useOpenpeeps();
8
+ const groupQuery = openpeepsApi.useGroupByHandle(handle);
9
+ if (groupQuery.isLoading) {
10
+ return (_jsx("div", { className: "text-muted-foreground text-sm", children: _jsx(LoadingSpinner, {}) }));
11
+ }
12
+ if (!groupQuery.data)
13
+ return null;
14
+ return _jsx(GroupCard, { group: groupQuery.data, noPadding: true });
15
+ }
@@ -0,0 +1,9 @@
1
+ export interface JamPreviewProps {
2
+ path: string;
3
+ }
4
+ /**
5
+ * Translation of @openpeepshq/svelte/components/core/preview-link/local/
6
+ * JamPreview.svelte. A jam path is `/events/<uuid>/jam`; the underlying event
7
+ * is a post, so render its feed content as the preview.
8
+ */
9
+ export declare function JamPreview({ path }: JamPreviewProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FeedPostContent } from '../../post/FeedPostContent.js';
3
+ import { useOpenpeeps } from '../../../contexts/openpeeps/index.js';
4
+ import { LoadingSpinner } from '@openpeepshq/react-ui';
5
+ /**
6
+ * Translation of @openpeepshq/svelte/components/core/preview-link/local/
7
+ * JamPreview.svelte. A jam path is `/events/<uuid>/jam`; the underlying event
8
+ * is a post, so render its feed content as the preview.
9
+ */
10
+ export function JamPreview({ path }) {
11
+ const eventId = path.substring(8, 44);
12
+ const { openpeepsApi } = useOpenpeeps();
13
+ const postQuery = openpeepsApi.usePost(eventId);
14
+ if (postQuery.isLoading) {
15
+ return (_jsx("div", { className: "text-muted-foreground text-sm", children: _jsx(LoadingSpinner, {}) }));
16
+ }
17
+ if (!postQuery.data)
18
+ return null;
19
+ return _jsx(FeedPostContent, { post: postQuery.data });
20
+ }
@@ -0,0 +1,4 @@
1
+ export interface PostPreviewProps {
2
+ path: string;
3
+ }
4
+ export declare function PostPreview({ path }: PostPreviewProps): import("react/jsx-runtime").JSX.Element | null;