@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,11 @@
1
+ /**
2
+ * Translation of @openpeepshq/svelte/log — namespaced logger.
3
+ */
4
+ export declare const logger: (ns: string, meta?: Record<string, unknown>) => {
5
+ info: (...args: unknown[]) => void;
6
+ warn: (...args: unknown[]) => void;
7
+ error: (...args: unknown[]) => void;
8
+ fatal: (...args: unknown[]) => void;
9
+ debug: (...args: unknown[]) => void;
10
+ trace: (...args: unknown[]) => void;
11
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Translation of @openpeepshq/svelte/log — namespaced logger.
3
+ */
4
+ export const logger = (ns, meta) => {
5
+ const log = (level, ...args) => console.log(`${ns} - ${level}`, ...args, meta);
6
+ return {
7
+ info: (...args) => log('info', ...args),
8
+ warn: (...args) => log('warn', ...args),
9
+ error: (...args) => log('error', ...args),
10
+ fatal: (...args) => log('fatal', ...args),
11
+ debug: (...args) => log('debug', ...args),
12
+ trace: (...args) => log('trace', ...args),
13
+ };
14
+ };
@@ -0,0 +1,16 @@
1
+ import type { OpenpeepsClient } from '@openpeepshq/client';
2
+ /** Brave exposes `navigator.brave`; other Chromium browsers do not. */
3
+ export declare const isBraveBrowser: () => boolean;
4
+ export interface PushSubscriptionOptions {
5
+ client: OpenpeepsClient;
6
+ applicationServerKey?: string;
7
+ }
8
+ /**
9
+ * Subscribe the current device to push notifications and register the
10
+ * subscription with the OpenPeeps server.
11
+ */
12
+ export declare const subscribePushNotifications: ({ client, applicationServerKey, }: PushSubscriptionOptions) => Promise<PushSubscription | undefined>;
13
+ export declare const unsubscribePushNotifications: () => Promise<boolean>;
14
+ export declare const getPushSubscription: () => Promise<PushSubscription | null>;
15
+ export declare const checkPushSubscription: ({ client, applicationServerKey, }: PushSubscriptionOptions) => Promise<boolean>;
16
+ export { usePushSubscription, type PushSubscriptionError, } from './usePushSubscription';
@@ -0,0 +1,145 @@
1
+ import { subscriptionKeyMatches, vapidKeyBytes } from './vapid.js';
2
+ const isPushSupported = () => typeof window !== 'undefined' &&
3
+ 'Notification' in window &&
4
+ 'serviceWorker' in navigator &&
5
+ 'PushManager' in window;
6
+ /** Brave exposes `navigator.brave`; other Chromium browsers do not. */
7
+ export const isBraveBrowser = () => typeof navigator !== 'undefined' && 'brave' in navigator;
8
+ const handleResult = (r) => {
9
+ if ('data' in r)
10
+ return r.data;
11
+ throw r.error;
12
+ };
13
+ /** `serviceWorker.ready` never settles when nothing is registered. */
14
+ const getRegistration = async () => {
15
+ if (!('serviceWorker' in navigator))
16
+ return undefined;
17
+ const registration = await navigator.serviceWorker.getRegistration();
18
+ if (!registration)
19
+ return undefined;
20
+ return registration.active ? registration : navigator.serviceWorker.ready;
21
+ };
22
+ const keyMatches = (subscription, applicationServerKey) => subscriptionKeyMatches(subscription.options.applicationServerKey, applicationServerKey);
23
+ const isApplicationServerKeyConflict = (err) => {
24
+ const message = err instanceof Error ? err.message : String(err);
25
+ return /applicationServerKey|gcm_sender_id/i.test(message);
26
+ };
27
+ /**
28
+ * Drop push subscriptions that don't match the current VAPID key across every
29
+ * service-worker registration. Browsers keep at most one push subscription per
30
+ * registration, but a page can have several registrations — clearing only the
31
+ * current scope leaves subscribe() failing with applicationServerKey errors.
32
+ */
33
+ const clearMismatchedPushSubscriptions = async (applicationServerKey) => {
34
+ const registrations = await navigator.serviceWorker.getRegistrations();
35
+ await Promise.all(registrations.map(async (registration) => {
36
+ const sub = await registration.pushManager.getSubscription();
37
+ if (sub && !keyMatches(sub, applicationServerKey)) {
38
+ await sub.unsubscribe();
39
+ }
40
+ }));
41
+ };
42
+ const clearAllPushSubscriptions = async () => {
43
+ const registrations = await navigator.serviceWorker.getRegistrations();
44
+ await Promise.all(registrations.map(async (registration) => {
45
+ const sub = await registration.pushManager.getSubscription();
46
+ if (sub)
47
+ await sub.unsubscribe();
48
+ }));
49
+ };
50
+ const registerWithServer = async (client, subscription) => {
51
+ await client.accounts.current
52
+ .createPushSubscription({
53
+ ...subscription.toJSON(),
54
+ type: 'web',
55
+ })
56
+ .then(handleResult);
57
+ };
58
+ const subscribeOnRegistration = async (registration, applicationServerKey) => {
59
+ const existing = await registration.pushManager.getSubscription();
60
+ if (existing && keyMatches(existing, applicationServerKey)) {
61
+ return existing;
62
+ }
63
+ if (existing) {
64
+ await existing.unsubscribe();
65
+ }
66
+ return registration.pushManager.subscribe({
67
+ applicationServerKey: vapidKeyBytes(applicationServerKey),
68
+ userVisibleOnly: true,
69
+ });
70
+ };
71
+ /**
72
+ * Subscribe the current device to push notifications and register the
73
+ * subscription with the OpenPeeps server.
74
+ */
75
+ export const subscribePushNotifications = async ({ client, applicationServerKey, }) => {
76
+ if (!isPushSupported() || !applicationServerKey)
77
+ return undefined;
78
+ if (await checkPushSubscription({ client, applicationServerKey })) {
79
+ return (await getPushSubscription()) ?? undefined;
80
+ }
81
+ if ((await Notification.requestPermission()) !== 'granted')
82
+ return undefined;
83
+ const registration = await getRegistration();
84
+ if (!registration)
85
+ return undefined;
86
+ await clearMismatchedPushSubscriptions(applicationServerKey);
87
+ let subscription;
88
+ try {
89
+ subscription = await subscribeOnRegistration(registration, applicationServerKey);
90
+ }
91
+ catch (err) {
92
+ if (!isApplicationServerKeyConflict(err))
93
+ throw err;
94
+ // Last resort: wipe every SW push subscription and retry once.
95
+ await clearAllPushSubscriptions();
96
+ subscription = await registration.pushManager.subscribe({
97
+ applicationServerKey: vapidKeyBytes(applicationServerKey),
98
+ userVisibleOnly: true,
99
+ });
100
+ }
101
+ await registerWithServer(client, subscription);
102
+ return subscription;
103
+ };
104
+ export const unsubscribePushNotifications = async () => {
105
+ if (!isPushSupported())
106
+ return false;
107
+ const registrations = await navigator.serviceWorker.getRegistrations();
108
+ if (registrations.length === 0)
109
+ return false;
110
+ const results = await Promise.all(registrations.map(async (registration) => {
111
+ const sub = await registration.pushManager.getSubscription();
112
+ if (!sub)
113
+ return false;
114
+ return sub.unsubscribe();
115
+ }));
116
+ return results.some(Boolean);
117
+ };
118
+ export const getPushSubscription = async () => {
119
+ if (!isPushSupported())
120
+ return null;
121
+ const registration = await getRegistration();
122
+ if (!registration)
123
+ return null;
124
+ return registration.pushManager.getSubscription();
125
+ };
126
+ export const checkPushSubscription = async ({ client, applicationServerKey, }) => {
127
+ if (!isPushSupported() || !applicationServerKey)
128
+ return false;
129
+ if (Notification.permission !== 'granted')
130
+ return false;
131
+ const registration = await getRegistration();
132
+ if (!registration)
133
+ return false;
134
+ const sub = await registration.pushManager.getSubscription();
135
+ if (!sub || !keyMatches(sub, applicationServerKey))
136
+ return false;
137
+ const currentSubscriptions = await client.accounts.current
138
+ .listPushSubscriptions()
139
+ .then(handleResult);
140
+ return currentSubscriptions
141
+ .filter((s) => s.type === 'web')
142
+ .map((s) => s.endpoint)
143
+ .includes(sub.endpoint);
144
+ };
145
+ export { usePushSubscription, } from './usePushSubscription.js';
@@ -0,0 +1,18 @@
1
+ import type { OpenpeepsClient } from '@openpeepshq/client';
2
+ export type PushSubscriptionError = 'unsupported' | 'no-service-worker' | 'permission-denied' | 'subscribe-failed';
3
+ export interface UsePushSubscriptionOptions {
4
+ client: OpenpeepsClient;
5
+ applicationServerKey?: string;
6
+ /** When true (default) checks subscription state on mount. */
7
+ autoCheck?: boolean;
8
+ }
9
+ export declare const usePushSubscription: ({ client, applicationServerKey, autoCheck, }: UsePushSubscriptionOptions) => {
10
+ isSubscribed: boolean;
11
+ permission: "unsupported" | NotificationPermission;
12
+ isSupported: boolean;
13
+ hasServiceWorker: boolean;
14
+ isLoading: boolean;
15
+ error: PushSubscriptionError | null;
16
+ subscribe: () => Promise<PushSubscriptionError | null>;
17
+ unsubscribe: () => Promise<void>;
18
+ };
@@ -0,0 +1,102 @@
1
+ import { useCallback, useEffect, useState } from 'react';
2
+ import { checkPushSubscription, getPushSubscription, subscribePushNotifications, unsubscribePushNotifications, } from './index.js';
3
+ const pushSupported = typeof window !== 'undefined' &&
4
+ 'Notification' in window &&
5
+ 'serviceWorker' in navigator &&
6
+ 'PushManager' in window;
7
+ export const usePushSubscription = ({ client, applicationServerKey, autoCheck = true, }) => {
8
+ const [isSubscribed, setIsSubscribed] = useState(false);
9
+ const [permission, setPermission] = useState(pushSupported ? Notification.permission : 'unsupported');
10
+ const [hasServiceWorker, setHasServiceWorker] = useState(false);
11
+ const [isLoading, setIsLoading] = useState(autoCheck);
12
+ const [error, setError] = useState(pushSupported ? null : 'unsupported');
13
+ useEffect(() => {
14
+ if (!autoCheck || !pushSupported) {
15
+ setIsLoading(false);
16
+ return;
17
+ }
18
+ let cancelled = false;
19
+ void (async () => {
20
+ try {
21
+ const registration = await navigator.serviceWorker.getRegistration();
22
+ if (cancelled)
23
+ return;
24
+ setHasServiceWorker(!!registration);
25
+ if (!registration) {
26
+ setError('no-service-worker');
27
+ return;
28
+ }
29
+ if (!applicationServerKey)
30
+ return;
31
+ const ok = await checkPushSubscription({
32
+ client,
33
+ applicationServerKey,
34
+ });
35
+ if (!cancelled)
36
+ setIsSubscribed(ok);
37
+ }
38
+ finally {
39
+ if (!cancelled)
40
+ setIsLoading(false);
41
+ }
42
+ })();
43
+ return () => {
44
+ cancelled = true;
45
+ };
46
+ }, [client, applicationServerKey, autoCheck]);
47
+ const subscribe = useCallback(async () => {
48
+ if (!pushSupported) {
49
+ setError('unsupported');
50
+ return 'unsupported';
51
+ }
52
+ setIsLoading(true);
53
+ setError(null);
54
+ try {
55
+ const registration = await navigator.serviceWorker.getRegistration();
56
+ setHasServiceWorker(!!registration);
57
+ if (!registration) {
58
+ setError('no-service-worker');
59
+ return 'no-service-worker';
60
+ }
61
+ await subscribePushNotifications({ client, applicationServerKey });
62
+ const sub = await getPushSubscription();
63
+ setIsSubscribed(!!sub);
64
+ setPermission(Notification.permission);
65
+ if (sub)
66
+ return null;
67
+ const reason = Notification.permission !== 'granted'
68
+ ? 'permission-denied'
69
+ : 'subscribe-failed';
70
+ setError(reason);
71
+ return reason;
72
+ }
73
+ catch {
74
+ setError('subscribe-failed');
75
+ return 'subscribe-failed';
76
+ }
77
+ finally {
78
+ setIsLoading(false);
79
+ }
80
+ }, [client, applicationServerKey]);
81
+ const unsubscribe = useCallback(async () => {
82
+ setIsLoading(true);
83
+ setError(null);
84
+ try {
85
+ await unsubscribePushNotifications();
86
+ setIsSubscribed(false);
87
+ }
88
+ finally {
89
+ setIsLoading(false);
90
+ }
91
+ }, []);
92
+ return {
93
+ isSubscribed,
94
+ permission,
95
+ isSupported: pushSupported,
96
+ hasServiceWorker,
97
+ isLoading,
98
+ error,
99
+ subscribe,
100
+ unsubscribe,
101
+ };
102
+ };
@@ -0,0 +1,6 @@
1
+ /** Normalize VAPID public keys for comparison (url-safe, no padding). */
2
+ export declare const normalizeVapidKey: (key: string) => string;
3
+ export declare const vapidKeyFromBuffer: (key: BufferSource) => string;
4
+ /** Copy into a tight buffer — some browsers reject views into larger ArrayBuffers. */
5
+ export declare const vapidKeyBytes: (applicationServerKey: string) => Uint8Array;
6
+ export declare const subscriptionKeyMatches: (subscriptionKey: BufferSource | null | undefined, applicationServerKey: string) => boolean;
@@ -0,0 +1,12 @@
1
+ import { Base64 } from 'js-base64';
2
+ /** Normalize VAPID public keys for comparison (url-safe, no padding). */
3
+ export const normalizeVapidKey = (key) => key.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, '');
4
+ export const vapidKeyFromBuffer = (key) => normalizeVapidKey(Base64.fromUint8Array(new Uint8Array(key), true));
5
+ /** Copy into a tight buffer — some browsers reject views into larger ArrayBuffers. */
6
+ export const vapidKeyBytes = (applicationServerKey) => new Uint8Array(Base64.toUint8Array(applicationServerKey));
7
+ export const subscriptionKeyMatches = (subscriptionKey, applicationServerKey) => {
8
+ if (!subscriptionKey)
9
+ return false;
10
+ return (vapidKeyFromBuffer(subscriptionKey) ===
11
+ normalizeVapidKey(applicationServerKey));
12
+ };
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface InstallPromptProps {
3
+ className?: string;
4
+ /** Override the default copy. */
5
+ message?: ReactNode;
6
+ installLabel?: string;
7
+ }
8
+ /**
9
+ * Renders an inline "Install app" CTA when the browser supports it. Hidden
10
+ * automatically once the app is installed or the user dismisses the native
11
+ * prompt.
12
+ */
13
+ export declare function InstallPrompt({ className, message, installLabel, }?: InstallPromptProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from '@openpeepshq/react-ui';
3
+ import { useInstallPrompt } from './useInstallPrompt.js';
4
+ /**
5
+ * Renders an inline "Install app" CTA when the browser supports it. Hidden
6
+ * automatically once the app is installed or the user dismisses the native
7
+ * prompt.
8
+ */
9
+ export function InstallPrompt({ className, message = 'Install this app for a faster, offline-friendly experience.', installLabel = 'Install', } = {}) {
10
+ const { canInstall, promptInstall, isStandalone } = useInstallPrompt();
11
+ if (!canInstall || isStandalone)
12
+ return null;
13
+ return (_jsxs("div", { className: className ??
14
+ 'border-border bg-card flex w-full items-center justify-between gap-3 rounded border p-3 text-sm shadow-sm', children: [_jsx("div", { children: message }), _jsx(Button, { variant: "variant-filled-primary", action: async () => {
15
+ await promptInstall();
16
+ }, children: installLabel })] }));
17
+ }
@@ -0,0 +1,22 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface NotificationPermissionPromptProps {
3
+ /** VAPID application server key (base64). Usually from server info. */
4
+ applicationServerKey?: string;
5
+ className?: string;
6
+ message?: ReactNode;
7
+ enableLabel?: string;
8
+ dismissLabel?: string;
9
+ /** Persist dismissal in localStorage under this key. */
10
+ storageKey?: string;
11
+ }
12
+ /**
13
+ * Asks the user to enable push notifications. Hidden when:
14
+ * - notifications are not supported,
15
+ * - permission is already granted/denied,
16
+ * - the user dismissed it previously (persisted in localStorage),
17
+ * - or the app already has an active subscription.
18
+ *
19
+ * Requires `<OpenpeepsProvider>` to be mounted up the tree (uses `useOpenpeeps`
20
+ * to obtain the API client).
21
+ */
22
+ export declare function NotificationPermissionPrompt({ applicationServerKey, className, message, enableLabel, dismissLabel, storageKey, }: NotificationPermissionPromptProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /// <reference lib="dom" />
3
+ import { useEffect, useState } from 'react';
4
+ import { Button } from '@openpeepshq/react-ui';
5
+ import { useOpenpeeps } from '../contexts/openpeeps/index.js';
6
+ import { usePushSubscription } from '../push/usePushSubscription.js';
7
+ /**
8
+ * Asks the user to enable push notifications. Hidden when:
9
+ * - notifications are not supported,
10
+ * - permission is already granted/denied,
11
+ * - the user dismissed it previously (persisted in localStorage),
12
+ * - or the app already has an active subscription.
13
+ *
14
+ * Requires `<OpenpeepsProvider>` to be mounted up the tree (uses `useOpenpeeps`
15
+ * to obtain the API client).
16
+ */
17
+ export function NotificationPermissionPrompt({ applicationServerKey, className, message = 'Get notified when something new happens.', enableLabel = 'Enable notifications', dismissLabel = 'Not now', storageKey = 'op:notif-prompt-dismissed', }) {
18
+ const { client } = useOpenpeeps();
19
+ const { isSubscribed, permission, subscribe } = usePushSubscription({
20
+ client,
21
+ applicationServerKey,
22
+ });
23
+ const [dismissed, setDismissed] = useState(() => {
24
+ if (typeof window === 'undefined')
25
+ return false;
26
+ try {
27
+ return window.localStorage.getItem(storageKey) === '1';
28
+ }
29
+ catch {
30
+ return false;
31
+ }
32
+ });
33
+ // Re-check `Notification.permission` after a successful subscribe call
34
+ const [browserPermission, setBrowserPermission] = useState(permission);
35
+ useEffect(() => {
36
+ setBrowserPermission(permission);
37
+ }, [permission, isSubscribed]);
38
+ if (browserPermission === 'unsupported' ||
39
+ browserPermission !== 'default' ||
40
+ dismissed ||
41
+ isSubscribed) {
42
+ return null;
43
+ }
44
+ return (_jsxs("div", { className: className ??
45
+ 'border-border bg-card flex w-full items-center justify-between gap-3 rounded border p-3 text-sm shadow-sm', children: [_jsx("div", { children: message }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { variant: "variant-soft", action: () => {
46
+ try {
47
+ window.localStorage.setItem(storageKey, '1');
48
+ }
49
+ catch {
50
+ /* ignore */
51
+ }
52
+ setDismissed(true);
53
+ }, children: dismissLabel }), _jsx(Button, { variant: "variant-filled-primary", action: async () => {
54
+ await subscribe();
55
+ }, children: enableLabel })] })] }));
56
+ }
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type UseServiceWorkerOptions } from './useServiceWorker';
3
+ export interface PwaProviderProps extends Omit<UseServiceWorkerOptions, 'onNavigate' | 'onInvalidateQueries'> {
4
+ children?: ReactNode;
5
+ /** Override how navigations triggered by SW NAVIGATE_TO are handled. */
6
+ onNavigate?: (url: string) => void;
7
+ }
8
+ /**
9
+ * High-level wrapper that registers the service worker and connects:
10
+ * - SW NAVIGATE_TO → router.navigate
11
+ * - SW INVALIDATE_QUERIES → react-query.invalidateQueries
12
+ *
13
+ * Mount this once near the top of your app (inside QueryClientProvider and
14
+ * RouterProvider).
15
+ */
16
+ export declare function PwaProvider({ children, onNavigate, ...options }: PwaProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,56 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useQueryClient } from '@tanstack/react-query';
3
+ import { applyNotificationStatsToCache } from '../lib/notificationBadge.js';
4
+ import { useServiceWorker, } from './useServiceWorker.js';
5
+ import { useNavigate } from '../contexts/router/index.js';
6
+ import { toRouterPath } from './navigationUrl.js';
7
+ import { normalizePushInvalidateMessage } from './pushInvalidate.js';
8
+ import { useNotificationBadgeSync } from './useNotificationBadgeSync.js';
9
+ /**
10
+ * High-level wrapper that registers the service worker and connects:
11
+ * - SW NAVIGATE_TO → router.navigate
12
+ * - SW INVALIDATE_QUERIES → react-query.invalidateQueries
13
+ *
14
+ * Mount this once near the top of your app (inside QueryClientProvider and
15
+ * RouterProvider).
16
+ */
17
+ export function PwaProvider({ children, onNavigate, ...options }) {
18
+ let navigate;
19
+ try {
20
+ navigate = useNavigate();
21
+ }
22
+ catch {
23
+ navigate = undefined;
24
+ }
25
+ const queryClient = useQueryClient();
26
+ useNotificationBadgeSync();
27
+ const handleNavigate = onNavigate ??
28
+ ((url) => {
29
+ // React Router resolves absolute URLs as pathnames (`/https:/…`).
30
+ const path = toRouterPath(url);
31
+ if (navigate)
32
+ navigate(path);
33
+ else if (typeof window !== 'undefined')
34
+ window.location.assign(url);
35
+ });
36
+ useServiceWorker({
37
+ ...options,
38
+ onNavigate: handleNavigate,
39
+ onInvalidateQueries: (message) => {
40
+ const { keys, notificationStats } = normalizePushInvalidateMessage(message);
41
+ if (notificationStats) {
42
+ applyNotificationStatsToCache(queryClient, notificationStats);
43
+ }
44
+ if (keys.length === 0) {
45
+ queryClient.invalidateQueries();
46
+ return;
47
+ }
48
+ for (const key of keys) {
49
+ queryClient.invalidateQueries({
50
+ queryKey: key,
51
+ });
52
+ }
53
+ },
54
+ });
55
+ return _jsx(_Fragment, { children: children });
56
+ }
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type UseServiceWorkerOptions } from './useServiceWorker';
3
+ export interface UpdatePromptProps {
4
+ className?: string;
5
+ message?: ReactNode;
6
+ reloadLabel?: string;
7
+ /** Optionally pass-through SW options if you don't already mount PwaProvider. */
8
+ swOptions?: UseServiceWorkerOptions;
9
+ }
10
+ /**
11
+ * Inline banner shown when a new service worker version is waiting. Calling
12
+ * "Reload" triggers SKIP_WAITING; a controllerchange will then reload the page.
13
+ */
14
+ export declare function UpdatePrompt({ className, message, reloadLabel, swOptions, }?: UpdatePromptProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from '@openpeepshq/react-ui';
3
+ import { useServiceWorker, } from './useServiceWorker.js';
4
+ /**
5
+ * Inline banner shown when a new service worker version is waiting. Calling
6
+ * "Reload" triggers SKIP_WAITING; a controllerchange will then reload the page.
7
+ */
8
+ export function UpdatePrompt({ className, message = 'A new version is available.', reloadLabel = 'Reload', swOptions, } = {}) {
9
+ const { isUpdateAvailable, applyUpdate } = useServiceWorker(swOptions);
10
+ if (!isUpdateAvailable)
11
+ return null;
12
+ return (_jsxs("div", { className: className ??
13
+ 'border-warning-500 bg-warning-50 dark:bg-warning-900/30 flex w-full items-center justify-between gap-3 rounded border p-3 text-sm shadow-sm', children: [_jsx("div", { children: message }), _jsx(Button, { variant: "variant-filled-warning", action: applyUpdate, children: reloadLabel })] }));
14
+ }
@@ -0,0 +1,18 @@
1
+ export { registerServiceWorker, type RegisterServiceWorkerOptions, type ServiceWorkerHandle, } from './registration';
2
+ export { useServiceWorker, type UseServiceWorkerOptions, type UseServiceWorkerResult, } from './useServiceWorker';
3
+ export { useInstallPrompt, type UseInstallPromptResult, } from './useInstallPrompt';
4
+ export { PwaProvider, type PwaProviderProps } from './PwaProvider';
5
+ export { InstallPrompt, type InstallPromptProps } from './InstallPrompt';
6
+ export { UpdatePrompt, type UpdatePromptProps } from './UpdatePrompt';
7
+ export { NotificationPermissionPrompt, type NotificationPermissionPromptProps, } from './NotificationPermissionPrompt';
8
+ export type { SWMessageFromPage, SWMessageToPage } from './sw-types';
9
+ /**
10
+ * Build a vite-plugin-pwa config that uses our shipped service-worker.ts.
11
+ *
12
+ * Prefer `@openpeepshq/react/pwa-vite` in Vite configs so the import stays a
13
+ * single subpath and does not pull in React PWA UI modules.
14
+ *
15
+ * import { openpeepsPwaPluginConfig } from '@openpeepshq/react/pwa-vite';
16
+ */
17
+ export { openpeepsPwaPluginConfig } from './vite';
18
+ export type { OpenpeepsPwaPluginOptions } from './vite';
@@ -0,0 +1,16 @@
1
+ export { registerServiceWorker, } from './registration.js';
2
+ export { useServiceWorker, } from './useServiceWorker.js';
3
+ export { useInstallPrompt, } from './useInstallPrompt.js';
4
+ export { PwaProvider } from './PwaProvider.js';
5
+ export { InstallPrompt } from './InstallPrompt.js';
6
+ export { UpdatePrompt } from './UpdatePrompt.js';
7
+ export { NotificationPermissionPrompt, } from './NotificationPermissionPrompt.js';
8
+ /**
9
+ * Build a vite-plugin-pwa config that uses our shipped service-worker.ts.
10
+ *
11
+ * Prefer `@openpeepshq/react/pwa-vite` in Vite configs so the import stays a
12
+ * single subpath and does not pull in React PWA UI modules.
13
+ *
14
+ * import { openpeepsPwaPluginConfig } from '@openpeepshq/react/pwa-vite';
15
+ */
16
+ export { openpeepsPwaPluginConfig } from './vite.js';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * React Router path helpers treat strings with a scheme as relative pathnames
3
+ * (e.g. `https://host/posts/1` → `/https:/host/posts/1`). Convert same-origin
4
+ * absolute URLs to path+search+hash before handing them to a router navigate.
5
+ */
6
+ export declare const toRouterPath: (url: string, origin?: string) => string;
7
+ /** Path after the `goto:` prefix (supports absolute or relative targets). */
8
+ export declare const parseGotoAction: (action: string) => string;
9
+ /**
10
+ * Resolve a `goto:` action to an absolute URL for openWindow / Client.navigate,
11
+ * and a same-origin router path for in-page NAVIGATE_TO messages.
12
+ */
13
+ export declare const resolveGotoTarget: (action: string, origin: string, basePath?: string) => {
14
+ absoluteUrl: string;
15
+ routerPath: string;
16
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * React Router path helpers treat strings with a scheme as relative pathnames
3
+ * (e.g. `https://host/posts/1` → `/https:/host/posts/1`). Convert same-origin
4
+ * absolute URLs to path+search+hash before handing them to a router navigate.
5
+ */
6
+ export const toRouterPath = (url, origin = typeof window !== 'undefined' ? window.location.origin : '') => {
7
+ if (!url || !origin)
8
+ return url;
9
+ try {
10
+ if (!(url.startsWith('http://') || url.startsWith('https://'))) {
11
+ return url;
12
+ }
13
+ const parsed = new URL(url);
14
+ if (parsed.origin !== origin)
15
+ return url;
16
+ return `${parsed.pathname}${parsed.search}${parsed.hash}`;
17
+ }
18
+ catch {
19
+ return url;
20
+ }
21
+ };
22
+ /** Path after the `goto:` prefix (supports absolute or relative targets). */
23
+ export const parseGotoAction = (action) => {
24
+ if (!action.startsWith('goto:'))
25
+ return '/';
26
+ return action.slice('goto:'.length) || '/';
27
+ };
28
+ /**
29
+ * Resolve a `goto:` action to an absolute URL for openWindow / Client.navigate,
30
+ * and a same-origin router path for in-page NAVIGATE_TO messages.
31
+ */
32
+ export const resolveGotoTarget = (action, origin, basePath = '/') => {
33
+ const gotoPath = parseGotoAction(action);
34
+ let absoluteUrl;
35
+ if (gotoPath.startsWith('http://') || gotoPath.startsWith('https://')) {
36
+ absoluteUrl = gotoPath;
37
+ }
38
+ else {
39
+ const normalizedBase = basePath === '/'
40
+ ? ''
41
+ : basePath.endsWith('/')
42
+ ? basePath.slice(0, -1)
43
+ : basePath;
44
+ const normalizedRel = gotoPath.startsWith('/') ? gotoPath : `/${gotoPath}`;
45
+ absoluteUrl = new URL(`${normalizedBase}${normalizedRel}`, origin).toString();
46
+ }
47
+ return {
48
+ absoluteUrl,
49
+ routerPath: toRouterPath(absoluteUrl, origin),
50
+ };
51
+ };