@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.
- package/LICENSE.md +21 -0
- package/README.md +1 -0
- package/dist/auth/credentials/index.d.ts +11 -0
- package/dist/auth/credentials/index.js +57 -0
- package/dist/auth/credentials/types.d.ts +6 -0
- package/dist/auth/credentials/types.js +1 -0
- package/dist/components/accounts/SignUpLoginModal.d.ts +9 -0
- package/dist/components/accounts/SignUpLoginModal.js +19 -0
- package/dist/components/accounts/SignUpLoginModalContext.d.ts +10 -0
- package/dist/components/accounts/SignUpLoginModalContext.js +16 -0
- package/dist/components/accounts/index.d.ts +3 -0
- package/dist/components/accounts/index.js +2 -0
- package/dist/components/configuration/ConfigurationCategory.d.ts +12 -0
- package/dist/components/configuration/ConfigurationCategory.js +61 -0
- package/dist/components/configuration/ConfigurationList.d.ts +10 -0
- package/dist/components/configuration/ConfigurationList.js +30 -0
- package/dist/components/configuration/ConfigurationTree.d.ts +8 -0
- package/dist/components/configuration/ConfigurationTree.js +20 -0
- package/dist/components/configuration/ConfigurationValueEditor.d.ts +11 -0
- package/dist/components/configuration/ConfigurationValueEditor.js +45 -0
- package/dist/components/configuration/index.d.ts +4 -0
- package/dist/components/configuration/index.js +4 -0
- package/dist/components/conversations/ConversationMessageBubble.d.ts +4 -0
- package/dist/components/conversations/ConversationMessageBubble.js +10 -0
- package/dist/components/conversations/CreateNewConversation.d.ts +8 -0
- package/dist/components/conversations/CreateNewConversation.js +62 -0
- package/dist/components/conversations/CreateNewConversationContext.d.ts +15 -0
- package/dist/components/conversations/CreateNewConversationContext.js +18 -0
- package/dist/components/conversations/DirectMessagesHeaderActions.d.ts +1 -0
- package/dist/components/conversations/DirectMessagesHeaderActions.js +10 -0
- package/dist/components/conversations/MessageInThread.d.ts +13 -0
- package/dist/components/conversations/MessageInThread.js +41 -0
- package/dist/components/conversations/index.d.ts +8 -0
- package/dist/components/conversations/index.js +5 -0
- package/dist/components/form/HeaderAvatarInput.d.ts +13 -0
- package/dist/components/form/HeaderAvatarInput.js +16 -0
- package/dist/components/form/ImageEditModal.d.ts +23 -0
- package/dist/components/form/ImageEditModal.js +75 -0
- package/dist/components/form/ImageInput.d.ts +32 -0
- package/dist/components/form/ImageInput.js +65 -0
- package/dist/components/form/LocationInput.d.ts +20 -0
- package/dist/components/form/LocationInput.js +59 -0
- package/dist/components/form/index.d.ts +8 -0
- package/dist/components/form/index.js +4 -0
- package/dist/components/groups/AddGroupMemberModal.d.ts +6 -0
- package/dist/components/groups/AddGroupMemberModal.js +40 -0
- package/dist/components/groups/AddGroupMembersButton.d.ts +5 -0
- package/dist/components/groups/AddGroupMembersButton.js +17 -0
- package/dist/components/groups/ChangeGroupRolesModal.d.ts +7 -0
- package/dist/components/groups/ChangeGroupRolesModal.js +45 -0
- package/dist/components/groups/ConfirmGroupExitModal.d.ts +6 -0
- package/dist/components/groups/ConfirmGroupExitModal.js +35 -0
- package/dist/components/groups/ConfirmMemberRemovalModal.d.ts +7 -0
- package/dist/components/groups/ConfirmMemberRemovalModal.js +33 -0
- package/dist/components/groups/DeleteGroupModal.d.ts +6 -0
- package/dist/components/groups/DeleteGroupModal.js +34 -0
- package/dist/components/groups/GroupAvatar.d.ts +14 -0
- package/dist/components/groups/GroupAvatar.js +32 -0
- package/dist/components/groups/GroupCard.d.ts +19 -0
- package/dist/components/groups/GroupCard.js +12 -0
- package/dist/components/groups/GroupFeed.d.ts +9 -0
- package/dist/components/groups/GroupFeed.js +14 -0
- package/dist/components/groups/GroupForm.d.ts +7 -0
- package/dist/components/groups/GroupForm.js +73 -0
- package/dist/components/groups/GroupHeader.d.ts +5 -0
- package/dist/components/groups/GroupHeader.js +14 -0
- package/dist/components/groups/GroupMembersList.d.ts +5 -0
- package/dist/components/groups/GroupMembersList.js +38 -0
- package/dist/components/groups/GroupOptionsMenu.d.ts +5 -0
- package/dist/components/groups/GroupOptionsMenu.js +61 -0
- package/dist/components/groups/GroupShareMenu.d.ts +5 -0
- package/dist/components/groups/GroupShareMenu.js +29 -0
- package/dist/components/groups/JoinGroupButton.d.ts +6 -0
- package/dist/components/groups/JoinGroupButton.js +28 -0
- package/dist/components/groups/index.d.ts +30 -0
- package/dist/components/groups/index.js +15 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/index.js +15 -0
- package/dist/components/jams/CreateNewJam.d.ts +4 -0
- package/dist/components/jams/CreateNewJam.js +138 -0
- package/dist/components/jams/CreateNewJamContext.d.ts +9 -0
- package/dist/components/jams/CreateNewJamContext.js +16 -0
- package/dist/components/jams/JamAnimatedEmoji.d.ts +4 -0
- package/dist/components/jams/JamAnimatedEmoji.js +12 -0
- package/dist/components/jams/JamCallParticipant.d.ts +15 -0
- package/dist/components/jams/JamCallParticipant.js +101 -0
- package/dist/components/jams/JamCapacityGate.d.ts +7 -0
- package/dist/components/jams/JamCapacityGate.js +30 -0
- package/dist/components/jams/JamChatDrawer.d.ts +6 -0
- package/dist/components/jams/JamChatDrawer.js +88 -0
- package/dist/components/jams/JamChatMessage.d.ts +5 -0
- package/dist/components/jams/JamChatMessage.js +35 -0
- package/dist/components/jams/JamConference.d.ts +8 -0
- package/dist/components/jams/JamConference.js +38 -0
- package/dist/components/jams/JamContext.d.ts +20 -0
- package/dist/components/jams/JamContext.js +24 -0
- package/dist/components/jams/JamDetailsDrawer.d.ts +9 -0
- package/dist/components/jams/JamDetailsDrawer.js +39 -0
- package/dist/components/jams/JamDeviceSelectors.d.ts +12 -0
- package/dist/components/jams/JamDeviceSelectors.js +71 -0
- package/dist/components/jams/JamEventsContext.d.ts +14 -0
- package/dist/components/jams/JamEventsContext.js +143 -0
- package/dist/components/jams/JamFooter.d.ts +18 -0
- package/dist/components/jams/JamFooter.js +171 -0
- package/dist/components/jams/JamGuestForm.d.ts +1 -0
- package/dist/components/jams/JamGuestForm.js +55 -0
- package/dist/components/jams/JamLobby.d.ts +17 -0
- package/dist/components/jams/JamLobby.js +159 -0
- package/dist/components/jams/JamObserverShell.d.ts +6 -0
- package/dist/components/jams/JamObserverShell.js +11 -0
- package/dist/components/jams/JamParticipantConference.d.ts +7 -0
- package/dist/components/jams/JamParticipantConference.js +80 -0
- package/dist/components/jams/JamPeopleDrawer.d.ts +10 -0
- package/dist/components/jams/JamPeopleDrawer.js +76 -0
- package/dist/components/jams/JamReactionMenu.d.ts +12 -0
- package/dist/components/jams/JamReactionMenu.js +79 -0
- package/dist/components/jams/JamRequestJoin.d.ts +9 -0
- package/dist/components/jams/JamRequestJoin.js +34 -0
- package/dist/components/jams/JamRoom.d.ts +21 -0
- package/dist/components/jams/JamRoom.js +166 -0
- package/dist/components/jams/JamRoomIndicators.d.ts +10 -0
- package/dist/components/jams/JamRoomIndicators.js +39 -0
- package/dist/components/jams/JamVideoCall.d.ts +15 -0
- package/dist/components/jams/JamVideoCall.js +18 -0
- package/dist/components/jams/JamVideoLayout.d.ts +13 -0
- package/dist/components/jams/JamVideoLayout.js +68 -0
- package/dist/components/jams/LeaveCloseButton.d.ts +6 -0
- package/dist/components/jams/LeaveCloseButton.js +58 -0
- package/dist/components/jams/LiveJamsSection.d.ts +1 -0
- package/dist/components/jams/LiveJamsSection.js +16 -0
- package/dist/components/jams/animateEmoji.d.ts +1 -0
- package/dist/components/jams/animateEmoji.js +48 -0
- package/dist/components/jams/blurProcessor.d.ts +8 -0
- package/dist/components/jams/blurProcessor.js +28 -0
- package/dist/components/jams/constants.d.ts +10 -0
- package/dist/components/jams/constants.js +44 -0
- package/dist/components/jams/index.d.ts +24 -0
- package/dist/components/jams/index.js +19 -0
- package/dist/components/jams/jamEventActions.d.ts +26 -0
- package/dist/components/jams/jamEventActions.js +76 -0
- package/dist/components/jams/jamLocalSettings.d.ts +17 -0
- package/dist/components/jams/jamLocalSettings.js +53 -0
- package/dist/components/jams/jamReactionPreferences.d.ts +15 -0
- package/dist/components/jams/jamReactionPreferences.js +53 -0
- package/dist/components/jams/jamRecordingState.d.ts +10 -0
- package/dist/components/jams/jamRecordingState.js +25 -0
- package/dist/components/jams/reactionEmojis.d.ts +30 -0
- package/dist/components/jams/reactionEmojis.js +73 -0
- package/dist/components/jams/useJamHands.d.ts +7 -0
- package/dist/components/jams/useJamHands.js +39 -0
- package/dist/components/jams/useJamLiveKitTheme.d.ts +3 -0
- package/dist/components/jams/useJamLiveKitTheme.js +10 -0
- package/dist/components/layout/AccessDenied.d.ts +14 -0
- package/dist/components/layout/AccessDenied.js +28 -0
- package/dist/components/layout/AccessDeniedLoader.d.ts +16 -0
- package/dist/components/layout/AccessDeniedLoader.js +12 -0
- package/dist/components/layout/Auth.d.ts +22 -0
- package/dist/components/layout/Auth.js +82 -0
- package/dist/components/layout/IdentityContext.d.ts +17 -0
- package/dist/components/layout/IdentityContext.js +38 -0
- package/dist/components/layout/Infos.d.ts +5 -0
- package/dist/components/layout/Infos.js +42 -0
- package/dist/components/layout/OpenpeepsContextProvider.d.ts +10 -0
- package/dist/components/layout/OpenpeepsContextProvider.js +63 -0
- package/dist/components/layout/OpenpeepsThemeProvider.d.ts +11 -0
- package/dist/components/layout/OpenpeepsThemeProvider.js +47 -0
- package/dist/components/layout/ProfileGuard.d.ts +14 -0
- package/dist/components/layout/ProfileGuard.js +38 -0
- package/dist/components/layout/ProfileProvider.d.ts +10 -0
- package/dist/components/layout/ProfileProvider.js +60 -0
- package/dist/components/layout/Root.d.ts +16 -0
- package/dist/components/layout/Root.js +36 -0
- package/dist/components/layout/ToastProvider.d.ts +22 -0
- package/dist/components/layout/ToastProvider.js +37 -0
- package/dist/components/layout/index.d.ts +21 -0
- package/dist/components/layout/index.js +11 -0
- package/dist/components/markdown/CompiledMarkdown.d.ts +5 -0
- package/dist/components/markdown/CompiledMarkdown.js +3 -0
- package/dist/components/markdown/OpenpeepsMarkdown.d.ts +16 -0
- package/dist/components/markdown/OpenpeepsMarkdown.js +66 -0
- package/dist/components/markdown/classes.d.ts +2 -0
- package/dist/components/markdown/classes.js +2 -0
- package/dist/components/markdown/compileMarkdown.d.ts +5 -0
- package/dist/components/markdown/compileMarkdown.js +36 -0
- package/dist/components/markdown/index.d.ts +11 -0
- package/dist/components/markdown/index.js +7 -0
- package/dist/components/markdown/linkTargets.d.ts +3 -0
- package/dist/components/markdown/linkTargets.js +27 -0
- package/dist/components/markdown/staticRender.d.ts +16 -0
- package/dist/components/markdown/staticRender.js +17 -0
- package/dist/components/navigation/ContentHeader.d.ts +1 -0
- package/dist/components/navigation/ContentHeader.js +18 -0
- package/dist/components/navigation/FooterMobile.d.ts +5 -0
- package/dist/components/navigation/FooterMobile.js +8 -0
- package/dist/components/navigation/HeaderMobile.d.ts +11 -0
- package/dist/components/navigation/HeaderMobile.js +26 -0
- package/dist/components/navigation/MobileMenuItem.d.ts +7 -0
- package/dist/components/navigation/MobileMenuItem.js +13 -0
- package/dist/components/navigation/PageHeaderAction.d.ts +5 -0
- package/dist/components/navigation/PageHeaderAction.js +7 -0
- package/dist/components/navigation/PlusButton.d.ts +1 -0
- package/dist/components/navigation/PlusButton.js +11 -0
- package/dist/components/navigation/SideBar.d.ts +16 -0
- package/dist/components/navigation/SideBar.js +24 -0
- package/dist/components/navigation/SidebarNavContext.d.ts +3 -0
- package/dist/components/navigation/SidebarNavContext.js +4 -0
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.d.ts +1 -0
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.js +10 -0
- package/dist/components/navigation/breadcrumbs/Crumb.d.ts +5 -0
- package/dist/components/navigation/breadcrumbs/Crumb.js +4 -0
- package/dist/components/navigation/index.d.ts +17 -0
- package/dist/components/navigation/index.js +11 -0
- package/dist/components/navigation/sideBarNavLinkClass.d.ts +4 -0
- package/dist/components/navigation/sideBarNavLinkClass.js +3 -0
- package/dist/components/notifications/NotificationErrorBoundary.d.ts +16 -0
- package/dist/components/notifications/NotificationErrorBoundary.js +21 -0
- package/dist/components/notifications/NotificationHeaderActions.d.ts +6 -0
- package/dist/components/notifications/NotificationHeaderActions.js +35 -0
- package/dist/components/notifications/NotificationItem.d.ts +5 -0
- package/dist/components/notifications/NotificationItem.js +6 -0
- package/dist/components/notifications/NotificationWrapper.d.ts +10 -0
- package/dist/components/notifications/NotificationWrapper.js +6 -0
- package/dist/components/notifications/NotificationsList.d.ts +12 -0
- package/dist/components/notifications/NotificationsList.js +88 -0
- package/dist/components/notifications/TypedNotification.d.ts +4 -0
- package/dist/components/notifications/TypedNotification.js +201 -0
- package/dist/components/notifications/index.d.ts +7 -0
- package/dist/components/notifications/index.js +5 -0
- package/dist/components/post/Feed.d.ts +20 -0
- package/dist/components/post/Feed.js +63 -0
- package/dist/components/post/FeedPost.d.ts +17 -0
- package/dist/components/post/FeedPost.js +31 -0
- package/dist/components/post/FeedPostContent.d.ts +5 -0
- package/dist/components/post/FeedPostContent.js +22 -0
- package/dist/components/post/FullPostLayout.d.ts +7 -0
- package/dist/components/post/FullPostLayout.js +23 -0
- package/dist/components/post/Markdown.d.ts +2 -0
- package/dist/components/post/Markdown.js +1 -0
- package/dist/components/post/NewEventButton.d.ts +14 -0
- package/dist/components/post/NewEventButton.js +39 -0
- package/dist/components/post/NewNoteButton.d.ts +14 -0
- package/dist/components/post/NewNoteButton.js +38 -0
- package/dist/components/post/PinnedPost.d.ts +5 -0
- package/dist/components/post/PinnedPost.js +15 -0
- package/dist/components/post/PostDetail.d.ts +4 -0
- package/dist/components/post/PostDetail.js +31 -0
- package/dist/components/post/ReplyBox.d.ts +5 -0
- package/dist/components/post/ReplyBox.js +30 -0
- package/dist/components/post/VideoPlayOverlay.d.ts +5 -0
- package/dist/components/post/VideoPlayOverlay.js +8 -0
- package/dist/components/post/attachmentPreview.d.ts +5 -0
- package/dist/components/post/attachmentPreview.js +14 -0
- package/dist/components/post/feed/events/EventsFeed.d.ts +7 -0
- package/dist/components/post/feed/events/EventsFeed.js +44 -0
- package/dist/components/post/feed/threaded/ThreadPost.d.ts +9 -0
- package/dist/components/post/feed/threaded/ThreadPost.js +19 -0
- package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +10 -0
- package/dist/components/post/feed/threaded/ThreadedFeed.js +8 -0
- package/dist/components/post/helpers.d.ts +6 -0
- package/dist/components/post/helpers.js +24 -0
- package/dist/components/post/index.d.ts +78 -0
- package/dist/components/post/index.js +57 -0
- package/dist/components/post/pieces/Attachments.d.ts +5 -0
- package/dist/components/post/pieces/Attachments.js +44 -0
- package/dist/components/post/pieces/EventLocation.d.ts +7 -0
- package/dist/components/post/pieces/EventLocation.js +28 -0
- package/dist/components/post/pieces/EventMenu.d.ts +6 -0
- package/dist/components/post/pieces/EventMenu.js +35 -0
- package/dist/components/post/pieces/EventRsvpButton.d.ts +5 -0
- package/dist/components/post/pieces/EventRsvpButton.js +60 -0
- package/dist/components/post/pieces/FeedPostStats.d.ts +5 -0
- package/dist/components/post/pieces/FeedPostStats.js +27 -0
- package/dist/components/post/pieces/GalleryModal.d.ts +7 -0
- package/dist/components/post/pieces/GalleryModal.js +16 -0
- package/dist/components/post/pieces/ParticipantsCard.d.ts +8 -0
- package/dist/components/post/pieces/ParticipantsCard.js +13 -0
- package/dist/components/post/pieces/PollContent.d.ts +5 -0
- package/dist/components/post/pieces/PollContent.js +109 -0
- package/dist/components/post/pieces/PostActions.d.ts +6 -0
- package/dist/components/post/pieces/PostActions.js +63 -0
- package/dist/components/post/pieces/PostInfoHeader.d.ts +7 -0
- package/dist/components/post/pieces/PostInfoHeader.js +8 -0
- package/dist/components/post/pieces/PostMenu.d.ts +6 -0
- package/dist/components/post/pieces/PostMenu.js +77 -0
- package/dist/components/post/pieces/PostReactionHeader.d.ts +12 -0
- package/dist/components/post/pieces/PostReactionHeader.js +31 -0
- package/dist/components/post/pieces/ShareMenu.d.ts +6 -0
- package/dist/components/post/pieces/ShareMenu.js +46 -0
- package/dist/components/post/pieces/UnreadPostIndicator.d.ts +9 -0
- package/dist/components/post/pieces/UnreadPostIndicator.js +6 -0
- package/dist/components/post/pieces/VideoPlayer.d.ts +16 -0
- package/dist/components/post/pieces/VideoPlayer.js +127 -0
- package/dist/components/post/pieces/modals/DeletePostModal.d.ts +8 -0
- package/dist/components/post/pieces/modals/DeletePostModal.js +20 -0
- package/dist/components/post/pieces/modals/ReactionsModal.d.ts +7 -0
- package/dist/components/post/pieces/modals/ReactionsModal.js +11 -0
- package/dist/components/post/pieces/modals/RepostModal.d.ts +7 -0
- package/dist/components/post/pieces/modals/RepostModal.js +13 -0
- package/dist/components/post/post-form/ArticleForm.d.ts +7 -0
- package/dist/components/post/post-form/ArticleForm.js +45 -0
- package/dist/components/post/post-form/AttachmentCard.d.ts +29 -0
- package/dist/components/post/post-form/AttachmentCard.js +120 -0
- package/dist/components/post/post-form/ComposeAttachments.d.ts +25 -0
- package/dist/components/post/post-form/ComposeAttachments.js +137 -0
- package/dist/components/post/post-form/ComposePreviewLinks.d.ts +4 -0
- package/dist/components/post/post-form/ComposePreviewLinks.js +9 -0
- package/dist/components/post/post-form/DescriptionEditModal.d.ts +13 -0
- package/dist/components/post/post-form/DescriptionEditModal.js +22 -0
- package/dist/components/post/post-form/EditPostModal.d.ts +6 -0
- package/dist/components/post/post-form/EditPostModal.js +81 -0
- package/dist/components/post/post-form/EditPostModalContext.d.ts +10 -0
- package/dist/components/post/post-form/EditPostModalContext.js +18 -0
- package/dist/components/post/post-form/EventForm.d.ts +7 -0
- package/dist/components/post/post-form/EventForm.js +104 -0
- package/dist/components/post/post-form/EventTypeSwitcher.d.ts +8 -0
- package/dist/components/post/post-form/EventTypeSwitcher.js +165 -0
- package/dist/components/post/post-form/NewPostModal.d.ts +13 -0
- package/dist/components/post/post-form/NewPostModal.js +272 -0
- package/dist/components/post/post-form/NewPostModalContext.d.ts +15 -0
- package/dist/components/post/post-form/NewPostModalContext.js +20 -0
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.d.ts +19 -0
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +65 -0
- package/dist/components/post/post-form/PollComposerFields.d.ts +12 -0
- package/dist/components/post/post-form/PollComposerFields.js +19 -0
- package/dist/components/post/post-form/PostAudienceSelector.d.ts +12 -0
- package/dist/components/post/post-form/PostAudienceSelector.js +83 -0
- package/dist/components/post/post-form/PostTypeSwitcher.d.ts +16 -0
- package/dist/components/post/post-form/PostTypeSwitcher.js +22 -0
- package/dist/components/post/post-form/ReplyModal.d.ts +6 -0
- package/dist/components/post/post-form/ReplyModal.js +202 -0
- package/dist/components/post/post-form/ReplyModalContext.d.ts +10 -0
- package/dist/components/post/post-form/ReplyModalContext.js +18 -0
- package/dist/components/post/post-form/VisibilitySelector.d.ts +8 -0
- package/dist/components/post/post-form/VisibilitySelector.js +35 -0
- package/dist/components/post/post-form/audienceChoices.d.ts +14 -0
- package/dist/components/post/post-form/audienceChoices.js +66 -0
- package/dist/components/post/types/Article.d.ts +5 -0
- package/dist/components/post/types/Article.js +14 -0
- package/dist/components/post/types/Event.d.ts +5 -0
- package/dist/components/post/types/Event.js +19 -0
- package/dist/components/post/types/Note.d.ts +5 -0
- package/dist/components/post/types/Note.js +10 -0
- package/dist/components/post/types/Poll.d.ts +7 -0
- package/dist/components/post/types/Poll.js +11 -0
- package/dist/components/post/types/article/FullArticle.d.ts +5 -0
- package/dist/components/post/types/article/FullArticle.js +8 -0
- package/dist/components/post/types/event/CardEvent.d.ts +5 -0
- package/dist/components/post/types/event/CardEvent.js +45 -0
- package/dist/components/post/types/event/FullEvent.d.ts +5 -0
- package/dist/components/post/types/event/FullEvent.js +161 -0
- package/dist/components/post/types/event/ProfileEventRelationship.d.ts +5 -0
- package/dist/components/post/types/event/ProfileEventRelationship.js +31 -0
- package/dist/components/post/types/note/FullNote.d.ts +5 -0
- package/dist/components/post/types/note/FullNote.js +5 -0
- package/dist/components/post/types/poll/FullPoll.d.ts +5 -0
- package/dist/components/post/types/poll/FullPoll.js +7 -0
- package/dist/components/post/visibility.d.ts +7 -0
- package/dist/components/post/visibility.js +10 -0
- package/dist/components/preview-link/LocalPreviewLink.d.ts +4 -0
- package/dist/components/preview-link/LocalPreviewLink.js +12 -0
- package/dist/components/preview-link/PreviewLink.d.ts +4 -0
- package/dist/components/preview-link/PreviewLink.js +11 -0
- package/dist/components/preview-link/RemotePreviewLink.d.ts +4 -0
- package/dist/components/preview-link/RemotePreviewLink.js +21 -0
- package/dist/components/preview-link/helpers.d.ts +7 -0
- package/dist/components/preview-link/helpers.js +31 -0
- package/dist/components/preview-link/index.d.ts +3 -0
- package/dist/components/preview-link/index.js +2 -0
- package/dist/components/preview-link/local/GroupPreview.d.ts +4 -0
- package/dist/components/preview-link/local/GroupPreview.js +15 -0
- package/dist/components/preview-link/local/JamPreview.d.ts +9 -0
- package/dist/components/preview-link/local/JamPreview.js +20 -0
- package/dist/components/preview-link/local/PostPreview.d.ts +4 -0
- package/dist/components/preview-link/local/PostPreview.js +15 -0
- package/dist/components/profile/Avatar.d.ts +17 -0
- package/dist/components/profile/Avatar.js +36 -0
- package/dist/components/profile/AvatarWithName.d.ts +5 -0
- package/dist/components/profile/AvatarWithName.js +5 -0
- package/dist/components/profile/FollowUnfollowButton.d.ts +8 -0
- package/dist/components/profile/FollowUnfollowButton.js +27 -0
- package/dist/components/profile/ProfileBadge.d.ts +7 -0
- package/dist/components/profile/ProfileBadge.js +12 -0
- package/dist/components/profile/ProfileCard.d.ts +24 -0
- package/dist/components/profile/ProfileCard.js +12 -0
- package/dist/components/profile/ProfileFromId.d.ts +6 -0
- package/dist/components/profile/ProfileFromId.js +15 -0
- package/dist/components/profile/ProfileHeader.d.ts +10 -0
- package/dist/components/profile/ProfileHeader.js +16 -0
- package/dist/components/profile/ProfileLink.d.ts +9 -0
- package/dist/components/profile/ProfileLink.js +9 -0
- package/dist/components/profile/ProfilePageAction.d.ts +6 -0
- package/dist/components/profile/ProfilePageAction.js +35 -0
- package/dist/components/profile/ProfilePostsAndReplies.d.ts +9 -0
- package/dist/components/profile/ProfilePostsAndReplies.js +24 -0
- package/dist/components/profile/ProfileSelector.d.ts +14 -0
- package/dist/components/profile/ProfileSelector.js +72 -0
- package/dist/components/profile/ProfileStats.d.ts +5 -0
- package/dist/components/profile/ProfileStats.js +6 -0
- package/dist/components/profile/ProfileWithActionCard.d.ts +5 -0
- package/dist/components/profile/ProfileWithActionCard.js +6 -0
- package/dist/components/profile/ProfilesInput.d.ts +15 -0
- package/dist/components/profile/ProfilesInput.js +31 -0
- package/dist/components/profile/ReportProfileOrPostModal.d.ts +9 -0
- package/dist/components/profile/ReportProfileOrPostModal.js +75 -0
- package/dist/components/profile/index.d.ts +30 -0
- package/dist/components/profile/index.js +15 -0
- package/dist/components/registry/ErrorComponent.d.ts +6 -0
- package/dist/components/registry/ErrorComponent.js +7 -0
- package/dist/components/registry/PluginLoader.d.ts +3 -0
- package/dist/components/registry/PluginLoader.js +51 -0
- package/dist/components/registry/PluginRegistryProvider.d.ts +23 -0
- package/dist/components/registry/PluginRegistryProvider.js +57 -0
- package/dist/components/registry/PluginSlot.d.ts +7 -0
- package/dist/components/registry/PluginSlot.js +31 -0
- package/dist/components/registry/index.d.ts +10 -0
- package/dist/components/registry/index.js +16 -0
- package/dist/components/server-data/ServerDataProvider.d.ts +8 -0
- package/dist/components/server-data/ServerDataProvider.js +30 -0
- package/dist/components/server-data/context.d.ts +121 -0
- package/dist/components/server-data/context.js +10 -0
- package/dist/components/server-data/index.d.ts +4 -0
- package/dist/components/server-data/index.js +2 -0
- package/dist/components/server-data/types.d.ts +5 -0
- package/dist/components/server-data/types.js +1 -0
- package/dist/contexts/credentialsStore/index.d.ts +8 -0
- package/dist/contexts/credentialsStore/index.js +13 -0
- package/dist/contexts/credentialsStore/types.d.ts +4 -0
- package/dist/contexts/credentialsStore/types.js +1 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/index.js +3 -0
- package/dist/contexts/openpeeps/helpers.d.ts +93 -0
- package/dist/contexts/openpeeps/helpers.js +311 -0
- package/dist/contexts/openpeeps/hooks/accounts.d.ts +302 -0
- package/dist/contexts/openpeeps/hooks/accounts.js +17 -0
- package/dist/contexts/openpeeps/hooks/admin.d.ts +17177 -0
- package/dist/contexts/openpeeps/hooks/admin.js +115 -0
- package/dist/contexts/openpeeps/hooks/auth.d.ts +55 -0
- package/dist/contexts/openpeeps/hooks/auth.js +22 -0
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +9815 -0
- package/dist/contexts/openpeeps/hooks/conversations.js +6 -0
- package/dist/contexts/openpeeps/hooks/groups.d.ts +319 -0
- package/dist/contexts/openpeeps/hooks/groups.js +31 -0
- package/dist/contexts/openpeeps/hooks/index.d.ts +18 -0
- package/dist/contexts/openpeeps/hooks/index.js +26 -0
- package/dist/contexts/openpeeps/hooks/jams.d.ts +3318 -0
- package/dist/contexts/openpeeps/hooks/jams.js +32 -0
- package/dist/contexts/openpeeps/hooks/other.d.ts +239 -0
- package/dist/contexts/openpeeps/hooks/other.js +89 -0
- package/dist/contexts/openpeeps/hooks/payments.d.ts +36 -0
- package/dist/contexts/openpeeps/hooks/payments.js +10 -0
- package/dist/contexts/openpeeps/hooks/posts.d.ts +26001 -0
- package/dist/contexts/openpeeps/hooks/posts.js +139 -0
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +6896 -0
- package/dist/contexts/openpeeps/hooks/profiles.js +43 -0
- package/dist/contexts/openpeeps/hooks/search.d.ts +9620 -0
- package/dist/contexts/openpeeps/hooks/search.js +24 -0
- package/dist/contexts/openpeeps/hooks/streaming.d.ts +26 -0
- package/dist/contexts/openpeeps/hooks/streaming.js +10 -0
- package/dist/contexts/openpeeps/hooks/useHasAuthToken.d.ts +2 -0
- package/dist/contexts/openpeeps/hooks/useHasAuthToken.js +35 -0
- package/dist/contexts/openpeeps/index.d.ts +21 -0
- package/dist/contexts/openpeeps/index.js +180 -0
- package/dist/contexts/openpeeps/types.d.ts +11 -0
- package/dist/contexts/openpeeps/types.js +1 -0
- package/dist/contexts/router/index.d.ts +28 -0
- package/dist/contexts/router/index.js +69 -0
- package/dist/email/index.d.ts +13 -0
- package/dist/email/index.js +10 -0
- package/dist/i18n/I18nProvider.d.ts +19 -0
- package/dist/i18n/I18nProvider.js +33 -0
- package/dist/i18n/context.d.ts +8 -0
- package/dist/i18n/context.js +10 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.js +23 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/lib/apiErrorMessage.d.ts +3 -0
- package/dist/lib/apiErrorMessage.js +14 -0
- package/dist/lib/canvasUtils.d.ts +12 -0
- package/dist/lib/canvasUtils.js +104 -0
- package/dist/lib/configuration/helpers.d.ts +7 -0
- package/dist/lib/configuration/helpers.js +83 -0
- package/dist/lib/configuration/resolveSchema.d.ts +3 -0
- package/dist/lib/configuration/resolveSchema.js +8 -0
- package/dist/lib/groupCapabilityHelpers.d.ts +24 -0
- package/dist/lib/groupCapabilityHelpers.js +119 -0
- package/dist/lib/notificationBadge.d.ts +5 -0
- package/dist/lib/notificationBadge.js +25 -0
- package/dist/lib/postUnread.d.ts +2 -0
- package/dist/lib/postUnread.js +1 -0
- package/dist/lib/postViewCounter.d.ts +17 -0
- package/dist/lib/postViewCounter.js +162 -0
- package/dist/lib/threadHelpers.d.ts +5 -0
- package/dist/lib/threadHelpers.js +23 -0
- package/dist/lib/unseenCountsOptimistic.d.ts +15 -0
- package/dist/lib/unseenCountsOptimistic.js +43 -0
- package/dist/log/index.d.ts +11 -0
- package/dist/log/index.js +14 -0
- package/dist/push/index.d.ts +16 -0
- package/dist/push/index.js +145 -0
- package/dist/push/usePushSubscription.d.ts +18 -0
- package/dist/push/usePushSubscription.js +102 -0
- package/dist/push/vapid.d.ts +6 -0
- package/dist/push/vapid.js +12 -0
- package/dist/pwa/InstallPrompt.d.ts +13 -0
- package/dist/pwa/InstallPrompt.js +17 -0
- package/dist/pwa/NotificationPermissionPrompt.d.ts +22 -0
- package/dist/pwa/NotificationPermissionPrompt.js +56 -0
- package/dist/pwa/PwaProvider.d.ts +16 -0
- package/dist/pwa/PwaProvider.js +56 -0
- package/dist/pwa/UpdatePrompt.d.ts +14 -0
- package/dist/pwa/UpdatePrompt.js +14 -0
- package/dist/pwa/index.d.ts +18 -0
- package/dist/pwa/index.js +16 -0
- package/dist/pwa/navigationUrl.d.ts +16 -0
- package/dist/pwa/navigationUrl.js +51 -0
- package/dist/pwa/pushInvalidate.d.ts +7 -0
- package/dist/pwa/pushInvalidate.js +29 -0
- package/dist/pwa/registration.d.ts +28 -0
- package/dist/pwa/registration.js +71 -0
- package/dist/pwa/sw-types.d.ts +14 -0
- package/dist/pwa/sw-types.js +1 -0
- package/dist/pwa/sw.d.ts +2 -0
- package/dist/pwa/sw.js +171 -0
- package/dist/pwa/useInstallPrompt.d.ts +10 -0
- package/dist/pwa/useInstallPrompt.js +45 -0
- package/dist/pwa/useNotificationBadgeSync.d.ts +2 -0
- package/dist/pwa/useNotificationBadgeSync.js +23 -0
- package/dist/pwa/useServiceWorker.d.ts +19 -0
- package/dist/pwa/useServiceWorker.js +49 -0
- package/dist/pwa/vite.d.ts +50 -0
- package/dist/pwa/vite.js +53 -0
- package/dist/react-native.d.ts +11 -0
- package/dist/react-native.js +11 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +5 -0
- package/dist/stores/breadcrumbs.d.ts +5 -0
- package/dist/stores/breadcrumbs.js +5 -0
- package/dist/stores/createStore.d.ts +19 -0
- package/dist/stores/createStore.js +63 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/index.js +9 -0
- package/dist/stores/newPosts.d.ts +591 -0
- package/dist/stores/newPosts.js +191 -0
- package/dist/stores/pageHeader.d.ts +15 -0
- package/dist/stores/pageHeader.js +22 -0
- package/dist/stores/plusButton.d.ts +5 -0
- package/dist/stores/plusButton.js +13 -0
- package/dist/stores/types.d.ts +35 -0
- package/dist/stores/types.js +1 -0
- package/dist/streaming.d.ts +6 -0
- package/dist/streaming.js +6 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/index.js +1 -0
- package/package.json +72 -0
- package/src/pwa/navigationUrl.ts +61 -0
- package/src/pwa/sw-types.ts +9 -0
- package/src/pwa/sw.ts +228 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { infiniteOffsetQueryApiHook, apiHook } from '../helpers.js';
|
|
2
|
+
export const searchHooks = (client) => ({
|
|
3
|
+
useSearchGroups: (q, limit = 15) => infiniteOffsetQueryApiHook(client.search.groups, {
|
|
4
|
+
queryParams: { q, limit: limit },
|
|
5
|
+
pageSize: 15,
|
|
6
|
+
}),
|
|
7
|
+
useSearchPosts: (q, limit = 15) => infiniteOffsetQueryApiHook(client.search.posts, {
|
|
8
|
+
queryParams: { q, limit: limit },
|
|
9
|
+
pageSize: 15,
|
|
10
|
+
}),
|
|
11
|
+
useSearchJams: (q, limit = 15) => infiniteOffsetQueryApiHook(client.search.jams, {
|
|
12
|
+
queryParams: { q, limit: limit },
|
|
13
|
+
pageSize: 15,
|
|
14
|
+
}),
|
|
15
|
+
useSearchProfiles: (q, limit = 15) => infiniteOffsetQueryApiHook(client.search.profiles, {
|
|
16
|
+
queryParams: { q, limit: limit },
|
|
17
|
+
pageSize: 15,
|
|
18
|
+
}),
|
|
19
|
+
useSearchEvents: (q, limit = 15) => infiniteOffsetQueryApiHook(client.search.events, {
|
|
20
|
+
queryParams: { q, limit: limit },
|
|
21
|
+
pageSize: 15,
|
|
22
|
+
}),
|
|
23
|
+
useSearchCounts: (q) => apiHook(client.search.counts, { queryParams: { q } }),
|
|
24
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OpenpeepsClient } from '@openpeepshq/client';
|
|
2
|
+
import type { MediaStream } from '@openpeepshq/common';
|
|
3
|
+
export type StreamingHooks = ReturnType<typeof streamingHooks>;
|
|
4
|
+
export declare const streamingHooks: (client: OpenpeepsClient) => {
|
|
5
|
+
createVodStreamAction: (defaultPathParams?: undefined) => (input: {
|
|
6
|
+
url: string;
|
|
7
|
+
}, pathParams?: undefined, queryParams?: undefined, headers?: Record<string, string>) => Promise<{
|
|
8
|
+
storageId: string;
|
|
9
|
+
status: "error" | "processing" | "ready";
|
|
10
|
+
error?: string | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
useVodStreamStatus: (storageId: string) => import("@tanstack/react-query").UseQueryResult<{
|
|
13
|
+
storageId: string;
|
|
14
|
+
status: "error" | "processing" | "ready";
|
|
15
|
+
error?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
success: boolean;
|
|
18
|
+
message?: string | undefined;
|
|
19
|
+
key?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
vodMasterPlaylistUrl: (storageId: string, originHint?: string) => string;
|
|
22
|
+
};
|
|
23
|
+
export type VodStreamStatusHook = ReturnType<StreamingHooks['useVodStreamStatus']>;
|
|
24
|
+
export type CreateVodStreamAction = (input: {
|
|
25
|
+
url: string;
|
|
26
|
+
}) => Promise<MediaStream>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { payloadMutation, apiHook } from '../helpers.js';
|
|
2
|
+
export const streamingHooks = (client) => ({
|
|
3
|
+
createVodStreamAction: payloadMutation(client.streaming.vod.create),
|
|
4
|
+
useVodStreamStatus: (storageId) => apiHook(client.streaming.vod.status, { pathParams: { storageId } }),
|
|
5
|
+
vodMasterPlaylistUrl: (storageId, originHint) => {
|
|
6
|
+
const origin = originHint ??
|
|
7
|
+
(typeof window !== 'undefined' ? window.location.origin : '');
|
|
8
|
+
return `${origin}/media/streaming/${storageId}/hls.m3u8`;
|
|
9
|
+
},
|
|
10
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { AUTH_CREDENTIALS_STORAGE_KEY, subscribeCredentialsChanged, } from '../../../auth/credentials/index.js';
|
|
3
|
+
import { useCredentialsStore } from '../../credentialsStore/index.js';
|
|
4
|
+
/** True when credentials storage contains a bearer token (sync read + store listener). */
|
|
5
|
+
export function useHasAuthToken() {
|
|
6
|
+
const { credentialsStore } = useCredentialsStore();
|
|
7
|
+
const [hasToken, setHasToken] = useState(false);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
let cancelled = false;
|
|
10
|
+
const refresh = async () => {
|
|
11
|
+
const next = !!(await credentialsStore.get())?.token;
|
|
12
|
+
if (!cancelled)
|
|
13
|
+
setHasToken(next);
|
|
14
|
+
};
|
|
15
|
+
void refresh();
|
|
16
|
+
const unsubCredentials = subscribeCredentialsChanged(() => void refresh());
|
|
17
|
+
const hasWindow = typeof window !== 'undefined' &&
|
|
18
|
+
typeof window.addEventListener === 'function';
|
|
19
|
+
const onStorage = (e) => {
|
|
20
|
+
if (e.key === AUTH_CREDENTIALS_STORAGE_KEY || e.key === null)
|
|
21
|
+
void refresh();
|
|
22
|
+
};
|
|
23
|
+
if (hasWindow) {
|
|
24
|
+
window.addEventListener('storage', onStorage);
|
|
25
|
+
}
|
|
26
|
+
return () => {
|
|
27
|
+
cancelled = true;
|
|
28
|
+
unsubCredentials();
|
|
29
|
+
if (hasWindow) {
|
|
30
|
+
window.removeEventListener('storage', onStorage);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, [credentialsStore]);
|
|
34
|
+
return hasToken;
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { OpenpeepsContextValue } from './types';
|
|
3
|
+
import type { CredentialsStore } from '../../auth/credentials/types';
|
|
4
|
+
export { useHasAuthToken } from './hooks/useHasAuthToken';
|
|
5
|
+
export declare const useOpenpeeps: () => OpenpeepsContextValue;
|
|
6
|
+
export declare const OpenpeepsProvider: React.FC<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
credentialsStore: CredentialsStore;
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Optional subscription to "app returned to foreground" events. Used in
|
|
13
|
+
* environments that lack `document.visibilitychange` (e.g. React Native).
|
|
14
|
+
* Must return an unsubscribe function.
|
|
15
|
+
*
|
|
16
|
+
* React Native consumers should import `OpenpeepsProvider` from
|
|
17
|
+
* `@openpeepshq/react-native`, which wires this up against `AppState` so
|
|
18
|
+
* `@openpeepshq/react` itself stays free of any `react-native` import.
|
|
19
|
+
*/
|
|
20
|
+
subscribeToForeground?: (onForeground: () => void) => () => void;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { createContext, useContext, useState, useEffect, useMemo, useCallback, } from 'react';
|
|
3
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
4
|
+
import { openpeepsClient, } from '@openpeepshq/client';
|
|
5
|
+
import { AUTH_CREDENTIALS_STORAGE_KEY, OPENPEEPS_CREDENTIALS_CHANGED_EVENT, } from '../../auth/credentials/index.js';
|
|
6
|
+
import { buildOpenpeepsApi } from './hooks/index.js';
|
|
7
|
+
import { CredentialsStoreProvider } from '../credentialsStore/index.js';
|
|
8
|
+
export { useHasAuthToken } from './hooks/useHasAuthToken.js';
|
|
9
|
+
import { isServiceOnlyJwt, jwtHasRemainingValidityAtLeast, } from '@openpeepshq/common';
|
|
10
|
+
/** Refresh when less than this many seconds remain (login JWTs are 1w). */
|
|
11
|
+
const REFRESH_WHEN_REMAINING_BELOW_SEC = 24 * 60 * 60;
|
|
12
|
+
const isAuthFailure = (error) => {
|
|
13
|
+
if (!error || typeof error !== 'object')
|
|
14
|
+
return false;
|
|
15
|
+
const { status, statusCode } = error;
|
|
16
|
+
const code = status ?? statusCode;
|
|
17
|
+
return code === 401 || code === 403;
|
|
18
|
+
};
|
|
19
|
+
/** Web-only; RN relies on cleared profile for the auth/main switch. */
|
|
20
|
+
const redirectToLogin = () => {
|
|
21
|
+
if (typeof window === 'undefined' ||
|
|
22
|
+
typeof window.location?.href !== 'string') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const { pathname, search } = window.location;
|
|
26
|
+
if (pathname.startsWith('/auth'))
|
|
27
|
+
return;
|
|
28
|
+
window.location.href = `/auth/login?redirect=${encodeURIComponent(`${pathname}${search}`)}`;
|
|
29
|
+
};
|
|
30
|
+
const OpenpeepsContext = createContext(null);
|
|
31
|
+
export const useOpenpeeps = () => {
|
|
32
|
+
const context = useContext(OpenpeepsContext);
|
|
33
|
+
if (!context) {
|
|
34
|
+
throw new Error('useOpenpeeps must be used within an OpenpeepsProvider');
|
|
35
|
+
}
|
|
36
|
+
return context;
|
|
37
|
+
};
|
|
38
|
+
export const OpenpeepsProvider = ({ children, credentialsStore, baseUrl, subscribeToForeground }) => {
|
|
39
|
+
const openpeepsClientOptionsProvider = useCallback(async () => {
|
|
40
|
+
return {
|
|
41
|
+
token: (await credentialsStore.get())?.token,
|
|
42
|
+
baseUrl,
|
|
43
|
+
};
|
|
44
|
+
}, [credentialsStore, baseUrl]);
|
|
45
|
+
const client = useMemo(() => openpeepsClient(openpeepsClientOptionsProvider), [openpeepsClientOptionsProvider]);
|
|
46
|
+
const queryClient = useMemo(() => new QueryClient(), []);
|
|
47
|
+
const [currentProfile, setCurrentProfile] = useState(undefined);
|
|
48
|
+
const [currentAccount, setCurrentAccount] = useState(undefined);
|
|
49
|
+
const openpeepsApi = buildOpenpeepsApi(client, (profile) => {
|
|
50
|
+
if (profile?.id !== currentProfile?.id) {
|
|
51
|
+
setCurrentProfile(profile);
|
|
52
|
+
}
|
|
53
|
+
}, (account) => {
|
|
54
|
+
if (account?.id !== currentAccount?.id) {
|
|
55
|
+
setCurrentAccount(account);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const endSession = useCallback(async () => {
|
|
59
|
+
await credentialsStore.clear();
|
|
60
|
+
queryClient.clear();
|
|
61
|
+
setCurrentProfile(undefined);
|
|
62
|
+
setCurrentAccount(undefined);
|
|
63
|
+
redirectToLogin();
|
|
64
|
+
}, [credentialsStore, queryClient]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const fetchProfile = async () => {
|
|
67
|
+
const cred = await credentialsStore.get();
|
|
68
|
+
if (!cred?.token) {
|
|
69
|
+
setCurrentProfile(undefined);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// Service-only JWTs (jam observer links) have no profile — skip the fetch
|
|
73
|
+
// so a 403 does not clear credentials and bounce to login.
|
|
74
|
+
if (isServiceOnlyJwt(cred.token)) {
|
|
75
|
+
setCurrentProfile(undefined);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const res = await client.profiles.current.read();
|
|
79
|
+
if (!('data' in res)) {
|
|
80
|
+
if (isAuthFailure(res.error)) {
|
|
81
|
+
await endSession();
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
setCurrentProfile(res.data);
|
|
86
|
+
};
|
|
87
|
+
void fetchProfile();
|
|
88
|
+
const onCredentialsChanged = () => void fetchProfile();
|
|
89
|
+
const onStorage = (e) => {
|
|
90
|
+
if (e.key === AUTH_CREDENTIALS_STORAGE_KEY)
|
|
91
|
+
void fetchProfile();
|
|
92
|
+
};
|
|
93
|
+
const hasWindow = typeof window !== 'undefined' &&
|
|
94
|
+
typeof window.addEventListener === 'function';
|
|
95
|
+
if (hasWindow) {
|
|
96
|
+
window.addEventListener(OPENPEEPS_CREDENTIALS_CHANGED_EVENT, onCredentialsChanged);
|
|
97
|
+
window.addEventListener('storage', onStorage);
|
|
98
|
+
}
|
|
99
|
+
return () => {
|
|
100
|
+
if (hasWindow) {
|
|
101
|
+
window.removeEventListener(OPENPEEPS_CREDENTIALS_CHANGED_EVENT, onCredentialsChanged);
|
|
102
|
+
window.removeEventListener('storage', onStorage);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}, [credentialsStore, client, endSession]);
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
const refreshIfExpiringSoon = async () => {
|
|
108
|
+
const token = (await credentialsStore.get())?.token;
|
|
109
|
+
if (!token?.trim())
|
|
110
|
+
return;
|
|
111
|
+
// Observer/egress service JWTs are not refreshed via /auth/refresh.
|
|
112
|
+
if (isServiceOnlyJwt(token)) {
|
|
113
|
+
if (!jwtHasRemainingValidityAtLeast(token, 1)) {
|
|
114
|
+
await endSession();
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (!jwtHasRemainingValidityAtLeast(token, 1)) {
|
|
119
|
+
await endSession();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (jwtHasRemainingValidityAtLeast(token, REFRESH_WHEN_REMAINING_BELOW_SEC)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const res = await client.auth.refresh({});
|
|
126
|
+
if (!('data' in res)) {
|
|
127
|
+
if (isAuthFailure(res.error)) {
|
|
128
|
+
await endSession();
|
|
129
|
+
}
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
await credentialsStore.set({ token: res.data.token });
|
|
133
|
+
queryClient.invalidateQueries({ queryKey: ['profiles', 'current'] });
|
|
134
|
+
const profile = await client.profiles.current
|
|
135
|
+
.read()
|
|
136
|
+
.then((r) => ('data' in r ? r.data : undefined));
|
|
137
|
+
setCurrentProfile(profile);
|
|
138
|
+
const account = await client.accounts.current
|
|
139
|
+
.read()
|
|
140
|
+
.then((r) => ('data' in r ? r.data : undefined));
|
|
141
|
+
setCurrentAccount(account);
|
|
142
|
+
};
|
|
143
|
+
void refreshIfExpiringSoon();
|
|
144
|
+
const id = setInterval(() => void refreshIfExpiringSoon(), 60_000);
|
|
145
|
+
const cleanups = [() => clearInterval(id)];
|
|
146
|
+
if (typeof document !== 'undefined' &&
|
|
147
|
+
typeof document.addEventListener === 'function') {
|
|
148
|
+
const onVis = () => {
|
|
149
|
+
if (document.visibilityState === 'visible') {
|
|
150
|
+
void refreshIfExpiringSoon();
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
document.addEventListener('visibilitychange', onVis);
|
|
154
|
+
cleanups.push(() => document.removeEventListener('visibilitychange', onVis));
|
|
155
|
+
}
|
|
156
|
+
else if (subscribeToForeground) {
|
|
157
|
+
const unsubscribe = subscribeToForeground(() => {
|
|
158
|
+
void refreshIfExpiringSoon();
|
|
159
|
+
});
|
|
160
|
+
cleanups.push(unsubscribe);
|
|
161
|
+
}
|
|
162
|
+
return () => {
|
|
163
|
+
for (const cleanup of cleanups)
|
|
164
|
+
cleanup();
|
|
165
|
+
};
|
|
166
|
+
}, [
|
|
167
|
+
client,
|
|
168
|
+
credentialsStore,
|
|
169
|
+
queryClient,
|
|
170
|
+
subscribeToForeground,
|
|
171
|
+
endSession,
|
|
172
|
+
]);
|
|
173
|
+
return (_jsx(OpenpeepsContext.Provider, { value: {
|
|
174
|
+
openpeepsApi,
|
|
175
|
+
client,
|
|
176
|
+
currentProfile,
|
|
177
|
+
currentAccount,
|
|
178
|
+
queryClient,
|
|
179
|
+
}, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(CredentialsStoreProvider, { credentialsStore: credentialsStore, children: children }) }) }));
|
|
180
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OpenpeepsClient } from '@openpeepshq/client';
|
|
2
|
+
import type { buildOpenpeepsApi } from './hooks';
|
|
3
|
+
import type { ProfileWithMeta, PublicAccount } from '@openpeepshq/common';
|
|
4
|
+
import type { QueryClient } from '@tanstack/react-query';
|
|
5
|
+
export interface OpenpeepsContextValue {
|
|
6
|
+
openpeepsApi: ReturnType<typeof buildOpenpeepsApi>;
|
|
7
|
+
client: OpenpeepsClient;
|
|
8
|
+
currentProfile: ProfileWithMeta | undefined;
|
|
9
|
+
currentAccount: PublicAccount | undefined;
|
|
10
|
+
queryClient: QueryClient;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface RouterAdapter {
|
|
3
|
+
pathname: string;
|
|
4
|
+
searchParams: URLSearchParams;
|
|
5
|
+
navigate: (url: string) => void;
|
|
6
|
+
back: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const useRouter: () => RouterAdapter;
|
|
9
|
+
export declare const useNavigate: () => (url: string) => void;
|
|
10
|
+
export declare const usePathname: () => string;
|
|
11
|
+
export declare const useSearchParams: () => URLSearchParams;
|
|
12
|
+
/** Pathname when inside `RouterProvider`, otherwise `undefined` (no throw). */
|
|
13
|
+
export declare const useOptionalPathname: () => string | undefined;
|
|
14
|
+
export interface RouterProviderProps {
|
|
15
|
+
adapter: RouterAdapter;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Bring-your-own-router context. Provide an adapter that maps to whichever
|
|
20
|
+
* routing library the host application uses (react-router, Next.js, Tanstack
|
|
21
|
+
* Router, etc).
|
|
22
|
+
*/
|
|
23
|
+
export declare function RouterProvider({ adapter, children }: RouterProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Browser-only fallback — uses `window.location` + `popstate`. Suitable for
|
|
26
|
+
* standalone PWAs that don't ship with a real router (e.g. dev shells).
|
|
27
|
+
*/
|
|
28
|
+
export declare function useBrowserRouter(): RouterAdapter;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useMemo, useState, } from 'react';
|
|
3
|
+
const RouterContext = createContext(null);
|
|
4
|
+
export const useRouter = () => {
|
|
5
|
+
const ctx = useContext(RouterContext);
|
|
6
|
+
if (!ctx)
|
|
7
|
+
throw new Error('useRouter must be used inside <RouterProvider>');
|
|
8
|
+
return ctx;
|
|
9
|
+
};
|
|
10
|
+
export const useNavigate = () => useRouter().navigate;
|
|
11
|
+
export const usePathname = () => useRouter().pathname;
|
|
12
|
+
export const useSearchParams = () => useRouter().searchParams;
|
|
13
|
+
/** Pathname when inside `RouterProvider`, otherwise `undefined` (no throw). */
|
|
14
|
+
export const useOptionalPathname = () => {
|
|
15
|
+
const ctx = useContext(RouterContext);
|
|
16
|
+
return ctx?.pathname;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Bring-your-own-router context. Provide an adapter that maps to whichever
|
|
20
|
+
* routing library the host application uses (react-router, Next.js, Tanstack
|
|
21
|
+
* Router, etc).
|
|
22
|
+
*/
|
|
23
|
+
export function RouterProvider({ adapter, children }) {
|
|
24
|
+
return (_jsx(RouterContext.Provider, { value: adapter, children: children }));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Browser-only fallback — uses `window.location` + `popstate`. Suitable for
|
|
28
|
+
* standalone PWAs that don't ship with a real router (e.g. dev shells).
|
|
29
|
+
*/
|
|
30
|
+
export function useBrowserRouter() {
|
|
31
|
+
const initial = useMemo(() => {
|
|
32
|
+
if (typeof window === 'undefined') {
|
|
33
|
+
return { pathname: '/', searchParams: new URLSearchParams() };
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
pathname: window.location.pathname,
|
|
37
|
+
searchParams: new URLSearchParams(window.location.search),
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
const [state, setState] = useState(initial);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (typeof window === 'undefined')
|
|
43
|
+
return;
|
|
44
|
+
const update = () => setState({
|
|
45
|
+
pathname: window.location.pathname,
|
|
46
|
+
searchParams: new URLSearchParams(window.location.search),
|
|
47
|
+
});
|
|
48
|
+
window.addEventListener('popstate', update);
|
|
49
|
+
return () => window.removeEventListener('popstate', update);
|
|
50
|
+
}, []);
|
|
51
|
+
return useMemo(() => ({
|
|
52
|
+
pathname: state.pathname,
|
|
53
|
+
searchParams: state.searchParams,
|
|
54
|
+
navigate: (url) => {
|
|
55
|
+
if (typeof window === 'undefined')
|
|
56
|
+
return;
|
|
57
|
+
history.pushState({}, '', url);
|
|
58
|
+
setState({
|
|
59
|
+
pathname: window.location.pathname,
|
|
60
|
+
searchParams: new URLSearchParams(window.location.search),
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
back: () => {
|
|
64
|
+
if (typeof window === 'undefined')
|
|
65
|
+
return;
|
|
66
|
+
history.back();
|
|
67
|
+
},
|
|
68
|
+
}), [state]);
|
|
69
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR-safe surface for rendering post content in server-rendered emails.
|
|
3
|
+
*
|
|
4
|
+
* Imports the concrete content components directly (not the `components/post`
|
|
5
|
+
* barrel) so consumers in non-browser environments (the email worker) don't
|
|
6
|
+
* pull in interactive/livekit/emoji-picker code paths.
|
|
7
|
+
*/
|
|
8
|
+
export { FeedPostContent } from '../components/post/FeedPostContent';
|
|
9
|
+
export type { FeedPostContentProps } from '../components/post/FeedPostContent';
|
|
10
|
+
export { StaticRenderContext, resolveStaticUrl, useStaticRender, } from '../components/markdown/staticRender';
|
|
11
|
+
export type { StaticRenderContextValue } from '../components/markdown/staticRender';
|
|
12
|
+
export { I18nContext } from '../i18n/context';
|
|
13
|
+
export type { I18nContextValue } from '../i18n/context';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR-safe surface for rendering post content in server-rendered emails.
|
|
3
|
+
*
|
|
4
|
+
* Imports the concrete content components directly (not the `components/post`
|
|
5
|
+
* barrel) so consumers in non-browser environments (the email worker) don't
|
|
6
|
+
* pull in interactive/livekit/emoji-picker code paths.
|
|
7
|
+
*/
|
|
8
|
+
export { FeedPostContent } from '../components/post/FeedPostContent.js';
|
|
9
|
+
export { StaticRenderContext, resolveStaticUrl, useStaticRender, } from '../components/markdown/staticRender.js';
|
|
10
|
+
export { I18nContext } from '../i18n/context.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type i18n as I18nInstance } from 'i18next';
|
|
3
|
+
export interface I18nProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Optional pre-initialised i18n instance — when omitted we use the global
|
|
7
|
+
* `i18next` instance and assume `initI18N(...)` has already been called.
|
|
8
|
+
*/
|
|
9
|
+
instance?: I18nInstance;
|
|
10
|
+
/** Render this fallback while the i18n instance is initializing. */
|
|
11
|
+
fallback?: ReactNode;
|
|
12
|
+
/** When provided, the provider will set the language at mount. */
|
|
13
|
+
lang?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* React port of @openpeepshq/svelte/I18nProvider. Provides an i18next instance
|
|
17
|
+
* + bound `t` to the tree.
|
|
18
|
+
*/
|
|
19
|
+
export declare function I18nProvider({ children, instance, fallback, lang, }: I18nProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import i18next, {} from 'i18next';
|
|
4
|
+
import { I18nContext } from './context.js';
|
|
5
|
+
/**
|
|
6
|
+
* React port of @openpeepshq/svelte/I18nProvider. Provides an i18next instance
|
|
7
|
+
* + bound `t` to the tree.
|
|
8
|
+
*/
|
|
9
|
+
export function I18nProvider({ children, instance, fallback = null, lang, }) {
|
|
10
|
+
const [ready, setReady] = useState(() => (instance ?? i18next).isInitialized);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const i18n = instance ?? i18next;
|
|
13
|
+
if (lang && i18n.isInitialized) {
|
|
14
|
+
void i18n.changeLanguage(lang);
|
|
15
|
+
}
|
|
16
|
+
if (!i18n.isInitialized) {
|
|
17
|
+
const onInitialized = () => setReady(true);
|
|
18
|
+
i18n.on('initialized', onInitialized);
|
|
19
|
+
return () => {
|
|
20
|
+
i18n.off('initialized', onInitialized);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
setReady(true);
|
|
24
|
+
return undefined;
|
|
25
|
+
}, [instance, lang]);
|
|
26
|
+
const value = useMemo(() => {
|
|
27
|
+
const i18n = instance ?? i18next;
|
|
28
|
+
return { i18n, t: i18n.t.bind(i18n) };
|
|
29
|
+
}, [instance]);
|
|
30
|
+
if (!ready)
|
|
31
|
+
return _jsx(_Fragment, { children: fallback });
|
|
32
|
+
return _jsx(I18nContext.Provider, { value: value, children: children });
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { i18n as I18nInstance, TFunction } from 'i18next';
|
|
2
|
+
export interface I18nContextValue {
|
|
3
|
+
i18n: I18nInstance;
|
|
4
|
+
t: TFunction;
|
|
5
|
+
}
|
|
6
|
+
export declare const I18nContext: import("react").Context<I18nContextValue | null>;
|
|
7
|
+
export declare const useI18n: () => I18nContextValue;
|
|
8
|
+
export declare const useT: () => TFunction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const I18nContext = createContext(null);
|
|
3
|
+
export const useI18n = () => {
|
|
4
|
+
const ctx = useContext(I18nContext);
|
|
5
|
+
if (!ctx) {
|
|
6
|
+
throw new Error('useI18n must be used inside an <I18nProvider>');
|
|
7
|
+
}
|
|
8
|
+
return ctx;
|
|
9
|
+
};
|
|
10
|
+
export const useT = () => useI18n().t;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type i18n as I18nInstance } from 'i18next';
|
|
2
|
+
export declare const initI18N: (lang: string, baseUrl: string, debug?: boolean) => Promise<I18nInstance>;
|
|
3
|
+
export { I18nProvider } from './I18nProvider';
|
|
4
|
+
export type { I18nProviderProps } from './I18nProvider';
|
|
5
|
+
export { useT, useI18n, I18nContext } from './context';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import i18next, {} from 'i18next';
|
|
2
|
+
import httpBackend from 'i18next-http-backend';
|
|
3
|
+
import { initReactI18next } from 'react-i18next';
|
|
4
|
+
export const initI18N = (lang, baseUrl, debug = false) => {
|
|
5
|
+
const instance = i18next.createInstance();
|
|
6
|
+
return instance
|
|
7
|
+
.use(httpBackend)
|
|
8
|
+
.use(initReactI18next)
|
|
9
|
+
.init({
|
|
10
|
+
lng: lang,
|
|
11
|
+
fallbackLng: lang,
|
|
12
|
+
debug,
|
|
13
|
+
interpolation: {
|
|
14
|
+
escapeValue: false,
|
|
15
|
+
},
|
|
16
|
+
backend: {
|
|
17
|
+
loadPath: `${baseUrl}/api/openpeeps/core/v1/i18n/{{lng}}`,
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
.then(() => instance);
|
|
21
|
+
};
|
|
22
|
+
export { I18nProvider } from './I18nProvider.js';
|
|
23
|
+
export { useT, useI18n, I18nContext } from './context.js';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './auth/credentials';
|
|
2
|
+
export * from './contexts';
|
|
3
|
+
export * from './i18n';
|
|
4
|
+
export * from './streaming';
|
|
5
|
+
export * from './stores';
|
|
6
|
+
export * from './push';
|
|
7
|
+
export * from './lib/postViewCounter';
|
|
8
|
+
export * from './lib/unseenCountsOptimistic';
|
|
9
|
+
export * from './lib/notificationBadge';
|
|
10
|
+
export * from './lib/postUnread';
|
|
11
|
+
export * from './components';
|
|
12
|
+
export { resolveAdminConfigSchema } from './lib/configuration/resolveSchema';
|
|
13
|
+
export { diffConfigTrees, equal } from './lib/configuration/helpers';
|
|
14
|
+
export * as pwa from './pwa';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './auth/credentials/index.js';
|
|
2
|
+
export * from './contexts/index.js';
|
|
3
|
+
export * from './i18n/index.js';
|
|
4
|
+
export * from './streaming.js';
|
|
5
|
+
export * from './stores/index.js';
|
|
6
|
+
export * from './push/index.js';
|
|
7
|
+
export * from './lib/postViewCounter.js';
|
|
8
|
+
export * from './lib/unseenCountsOptimistic.js';
|
|
9
|
+
export * from './lib/notificationBadge.js';
|
|
10
|
+
export * from './lib/postUnread.js';
|
|
11
|
+
export * from './components/index.js';
|
|
12
|
+
export { resolveAdminConfigSchema } from './lib/configuration/resolveSchema.js';
|
|
13
|
+
export { diffConfigTrees, equal } from './lib/configuration/helpers.js';
|
|
14
|
+
export * as pwa from './pwa/index.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const apiErrorMessage = (err, t, fallback = t('common.errors.error', { defaultValue: 'Error' })) => {
|
|
2
|
+
const candidate = err?.errorKey ??
|
|
3
|
+
err?.key ??
|
|
4
|
+
err?.error?.key ??
|
|
5
|
+
err?.error?.message ??
|
|
6
|
+
err?.message;
|
|
7
|
+
if (typeof candidate === 'string' && candidate.length > 0) {
|
|
8
|
+
if (candidate.startsWith('error.')) {
|
|
9
|
+
return t(candidate, { defaultValue: candidate });
|
|
10
|
+
}
|
|
11
|
+
return candidate;
|
|
12
|
+
}
|
|
13
|
+
return fallback;
|
|
14
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ImageSource = string | File;
|
|
2
|
+
export declare const createImage: (imageSrc: ImageSource) => Promise<HTMLImageElement>;
|
|
3
|
+
export declare const getCroppedImg: (imageSrc: ImageSource, pixelCrop: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}) => Promise<File>;
|
|
9
|
+
export declare const centerCropToAspectRatio: (imageSrc: ImageSource, aspectW: number, aspectH: number) => Promise<File>;
|
|
10
|
+
export declare const getRotatedImage: (imageSrc: ImageSource, rotation?: number) => Promise<File>;
|
|
11
|
+
export declare const getZoomedImage: (imageSrc: ImageSource, zoom: number) => Promise<File>;
|
|
12
|
+
export declare function convertToWebpIfHeic(file: File): Promise<File>;
|