@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,311 @@
|
|
|
1
|
+
import { QueryClient, QueryClientContext, useInfiniteQuery, useQuery, } from '@tanstack/react-query';
|
|
2
|
+
import { useContext, useEffect, useState } from 'react';
|
|
3
|
+
import { useCredentialsStore } from '../credentialsStore/index.js';
|
|
4
|
+
import { invalidatePostsExceptUnseenCounts } from '../../lib/unseenCountsOptimistic.js';
|
|
5
|
+
const throwError = (callbacks) => async (result) => {
|
|
6
|
+
if ('data' in result) {
|
|
7
|
+
await callbacks?.onSuccess?.(result.data);
|
|
8
|
+
return result.data;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
await callbacks?.onError?.(result.error);
|
|
12
|
+
throw result.error;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const handleMutationResult = (queryClient, queryKeys) => throwError({
|
|
16
|
+
onSuccess: async () => {
|
|
17
|
+
if (queryKeys) {
|
|
18
|
+
for (const queryKey of queryKeys) {
|
|
19
|
+
await queryClient.invalidateQueries({ queryKey });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const handlePostsReadMutationResult = (queryClient) => throwError({
|
|
25
|
+
onSuccess: async () => {
|
|
26
|
+
await invalidatePostsExceptUnseenCounts(queryClient);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
export const retrieveProfile = (client) => () => client.profiles.current
|
|
30
|
+
.read()
|
|
31
|
+
.then((r) => ('data' in r ? r.data : undefined));
|
|
32
|
+
export const retrieveAccount = (client) => () => client.accounts.current
|
|
33
|
+
.read()
|
|
34
|
+
.then((r) => ('data' in r ? r.data : undefined));
|
|
35
|
+
export const updateCredentialsWrapper = (fn, retrieveProfile, setCurrentProfile, retrieveAccount, setCurrentAccount) => () => {
|
|
36
|
+
const { credentialsStore } = useCredentialsStore();
|
|
37
|
+
const queryClient = useContext(QueryClientContext);
|
|
38
|
+
return (i) => fn(i).then(throwError({
|
|
39
|
+
onSuccess: async (tr) => {
|
|
40
|
+
credentialsStore.set({ token: tr.token });
|
|
41
|
+
queryClient?.invalidateQueries({
|
|
42
|
+
queryKey: ['profiles', 'current'],
|
|
43
|
+
});
|
|
44
|
+
const profile = await retrieveProfile();
|
|
45
|
+
setCurrentProfile(profile);
|
|
46
|
+
const account = await retrieveAccount();
|
|
47
|
+
setCurrentAccount(account);
|
|
48
|
+
},
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
export const apiHook = (endpoint, options) => useQuery({
|
|
52
|
+
queryKey: endpoint.queryKey({
|
|
53
|
+
pathParameters: options?.pathParams,
|
|
54
|
+
queryParameters: options?.queryParams,
|
|
55
|
+
}),
|
|
56
|
+
enabled: options?.enabled ?? true,
|
|
57
|
+
queryFn: async () => {
|
|
58
|
+
await options?.preQueryCheck?.({
|
|
59
|
+
endpoint,
|
|
60
|
+
pathParams: options?.pathParams,
|
|
61
|
+
queryParams: options?.queryParams,
|
|
62
|
+
});
|
|
63
|
+
return endpoint({
|
|
64
|
+
pathParameters: options?.pathParams,
|
|
65
|
+
queryParameters: options?.queryParams,
|
|
66
|
+
}).then(throwError({
|
|
67
|
+
onSuccess: options?.onSuccess,
|
|
68
|
+
onError: options?.onError,
|
|
69
|
+
}));
|
|
70
|
+
},
|
|
71
|
+
retry: false,
|
|
72
|
+
refetchInterval: options?.refetchInterval,
|
|
73
|
+
});
|
|
74
|
+
export const infiniteChronologicalQueryApiHook = (endpoint, options) => useInfiniteQuery({
|
|
75
|
+
queryKey: endpoint.queryKey({
|
|
76
|
+
pathParameters: options?.pathParams,
|
|
77
|
+
queryParameters: options?.queryParams,
|
|
78
|
+
}),
|
|
79
|
+
queryFn: async ({ pageParam }) => {
|
|
80
|
+
const baseParams = { ...options?.queryParams };
|
|
81
|
+
const currentQueryParams = pageParam
|
|
82
|
+
? { ...baseParams, start: String(pageParam) }
|
|
83
|
+
: baseParams;
|
|
84
|
+
await options?.preQueryCheck?.({
|
|
85
|
+
endpoint,
|
|
86
|
+
pathParams: options?.pathParams,
|
|
87
|
+
queryParams: currentQueryParams,
|
|
88
|
+
});
|
|
89
|
+
return await endpoint({
|
|
90
|
+
pathParameters: options?.pathParams,
|
|
91
|
+
queryParameters: currentQueryParams,
|
|
92
|
+
}).then(throwError({
|
|
93
|
+
onSuccess: options?.onSuccess,
|
|
94
|
+
onError: options?.onError,
|
|
95
|
+
}));
|
|
96
|
+
},
|
|
97
|
+
initialPageParam: undefined,
|
|
98
|
+
getNextPageParam: (lastPage) => {
|
|
99
|
+
const last = Array.isArray(lastPage) ? lastPage : [];
|
|
100
|
+
if (!last.length)
|
|
101
|
+
return undefined;
|
|
102
|
+
// A short page means we've reached the end. Without this, feeds that
|
|
103
|
+
// ignore `start` (or return a non-empty repeat) keep fetching forever —
|
|
104
|
+
// which toggles the next-page spinner and jitters the sticky plus button.
|
|
105
|
+
const limit = Number(options?.queryParams?.limit ?? 0);
|
|
106
|
+
if (limit > 0 && last.length < limit)
|
|
107
|
+
return undefined;
|
|
108
|
+
return last[last.length - 1]?.id;
|
|
109
|
+
},
|
|
110
|
+
retry: false,
|
|
111
|
+
refetchInterval: options?.refetchInterval,
|
|
112
|
+
enabled: options?.enabled ?? true,
|
|
113
|
+
});
|
|
114
|
+
export const infiniteOffsetQueryApiHook = (endpoint, options) => useInfiniteQuery({
|
|
115
|
+
queryKey: endpoint.queryKey({
|
|
116
|
+
pathParameters: options?.pathParams,
|
|
117
|
+
queryParameters: options?.queryParams,
|
|
118
|
+
}),
|
|
119
|
+
queryFn: async ({ pageParam }) => {
|
|
120
|
+
const baseParams = {
|
|
121
|
+
...options?.queryParams,
|
|
122
|
+
limit: options?.pageSize,
|
|
123
|
+
};
|
|
124
|
+
const queryParams = pageParam
|
|
125
|
+
? { ...baseParams, offset: pageParam }
|
|
126
|
+
: baseParams;
|
|
127
|
+
await options?.preQueryCheck?.({
|
|
128
|
+
endpoint,
|
|
129
|
+
pathParams: options?.pathParams,
|
|
130
|
+
queryParams,
|
|
131
|
+
});
|
|
132
|
+
return await endpoint({
|
|
133
|
+
pathParameters: options?.pathParams,
|
|
134
|
+
queryParameters: queryParams,
|
|
135
|
+
}).then(throwError({
|
|
136
|
+
onSuccess: options?.onSuccess,
|
|
137
|
+
onError: options?.onError,
|
|
138
|
+
}));
|
|
139
|
+
},
|
|
140
|
+
initialPageParam: 0,
|
|
141
|
+
getNextPageParam: (lastPage, _, lastPageParam) => {
|
|
142
|
+
const lastPageFull = Array.isArray(lastPage) && lastPage.length >= (options?.pageSize ?? 0);
|
|
143
|
+
if (lastPageFull) {
|
|
144
|
+
const nextPageParam = lastPageParam + (options?.pageSize ?? 0);
|
|
145
|
+
return nextPageParam;
|
|
146
|
+
}
|
|
147
|
+
return undefined;
|
|
148
|
+
},
|
|
149
|
+
retry: false,
|
|
150
|
+
refetchInterval: options?.refetchInterval,
|
|
151
|
+
});
|
|
152
|
+
export const payloadMutation = (endpoint, queryKeys) => (defaultPathParams) => {
|
|
153
|
+
const queryClient = useContext(QueryClientContext);
|
|
154
|
+
if (!queryClient) {
|
|
155
|
+
throw new Error('QueryClientContext is not set');
|
|
156
|
+
}
|
|
157
|
+
return async (input, pathParams, queryParams, headers) => endpoint(input, {
|
|
158
|
+
pathParameters: {
|
|
159
|
+
...(defaultPathParams ?? {}),
|
|
160
|
+
...(pathParams ?? {}),
|
|
161
|
+
},
|
|
162
|
+
queryParameters: queryParams,
|
|
163
|
+
headers,
|
|
164
|
+
}).then(handleMutationResult(queryClient, queryKeys));
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Like {@link payloadMutation} but for endpoints that route through
|
|
168
|
+
* `XMLHttpRequest` and accept an `onUploadProgress` callback (typically
|
|
169
|
+
* media uploads).
|
|
170
|
+
*/
|
|
171
|
+
export const payloadProgressMutation = (endpoint, queryKeys) => (defaultPathParams) => {
|
|
172
|
+
const queryClient = useContext(QueryClientContext);
|
|
173
|
+
if (!queryClient) {
|
|
174
|
+
throw new Error('QueryClientContext is not set');
|
|
175
|
+
}
|
|
176
|
+
return async (input, pathParams, queryParams, headers, onUploadProgress) => endpoint(input, {
|
|
177
|
+
pathParameters: {
|
|
178
|
+
...(defaultPathParams ?? {}),
|
|
179
|
+
...(pathParams ?? {}),
|
|
180
|
+
},
|
|
181
|
+
queryParameters: queryParams,
|
|
182
|
+
headers,
|
|
183
|
+
onUploadProgress,
|
|
184
|
+
}).then(handleMutationResult(queryClient, queryKeys));
|
|
185
|
+
};
|
|
186
|
+
export const noPayloadMutation = (endpoint, queryKeys) => (defaultPathParams) => {
|
|
187
|
+
const queryClient = useContext(QueryClientContext);
|
|
188
|
+
if (!queryClient) {
|
|
189
|
+
throw new Error('QueryClientContext is not set');
|
|
190
|
+
}
|
|
191
|
+
return async (pathParams, queryParams, headers) => endpoint({
|
|
192
|
+
pathParameters: {
|
|
193
|
+
...(defaultPathParams ?? {}),
|
|
194
|
+
...(pathParams ?? {}),
|
|
195
|
+
},
|
|
196
|
+
queryParameters: queryParams,
|
|
197
|
+
headers,
|
|
198
|
+
}).then(handleMutationResult(queryClient, queryKeys));
|
|
199
|
+
};
|
|
200
|
+
export const payloadPostsReadMutation = (endpoint) => (defaultPathParams) => {
|
|
201
|
+
const queryClient = useContext(QueryClientContext);
|
|
202
|
+
if (!queryClient) {
|
|
203
|
+
throw new Error('QueryClientContext is not set');
|
|
204
|
+
}
|
|
205
|
+
return async (input, pathParams, queryParams, headers) => endpoint(input, {
|
|
206
|
+
pathParameters: {
|
|
207
|
+
...(defaultPathParams ?? {}),
|
|
208
|
+
...(pathParams ?? {}),
|
|
209
|
+
},
|
|
210
|
+
queryParameters: queryParams,
|
|
211
|
+
headers,
|
|
212
|
+
}).then(handlePostsReadMutationResult(queryClient));
|
|
213
|
+
};
|
|
214
|
+
export const noPayloadPostsReadMutation = (endpoint) => (defaultPathParams) => {
|
|
215
|
+
const queryClient = useContext(QueryClientContext);
|
|
216
|
+
if (!queryClient) {
|
|
217
|
+
throw new Error('QueryClientContext is not set');
|
|
218
|
+
}
|
|
219
|
+
return async (pathParams, queryParams, headers) => endpoint({
|
|
220
|
+
pathParameters: {
|
|
221
|
+
...(defaultPathParams ?? {}),
|
|
222
|
+
...(pathParams ?? {}),
|
|
223
|
+
},
|
|
224
|
+
queryParameters: queryParams,
|
|
225
|
+
headers,
|
|
226
|
+
}).then(handlePostsReadMutationResult(queryClient));
|
|
227
|
+
};
|
|
228
|
+
export const noPayloadStream = (typedEventSource) => ({
|
|
229
|
+
last: (options) => {
|
|
230
|
+
const { credentialsStore } = useCredentialsStore();
|
|
231
|
+
const [state, setState] = useState();
|
|
232
|
+
const pathKey = JSON.stringify(options.pathParameters ?? null);
|
|
233
|
+
const queryKey = JSON.stringify(options.queryParameters ?? null);
|
|
234
|
+
const headerKey = JSON.stringify(options.headers ?? null);
|
|
235
|
+
useEffect(() => {
|
|
236
|
+
const params = options.pathParameters;
|
|
237
|
+
if (params && Object.values(params).some((v) => v == null || v === '')) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
let closed = false;
|
|
241
|
+
let source;
|
|
242
|
+
void (async () => {
|
|
243
|
+
const token = (await credentialsStore.get())?.token;
|
|
244
|
+
if (closed)
|
|
245
|
+
return;
|
|
246
|
+
source = await typedEventSource({
|
|
247
|
+
...options,
|
|
248
|
+
headers: {
|
|
249
|
+
...(options.headers || {}),
|
|
250
|
+
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
251
|
+
},
|
|
252
|
+
handler: (e) => {
|
|
253
|
+
if (!closed)
|
|
254
|
+
setState(e);
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
if (!closed) {
|
|
258
|
+
void source.stream();
|
|
259
|
+
}
|
|
260
|
+
})();
|
|
261
|
+
return () => {
|
|
262
|
+
closed = true;
|
|
263
|
+
void source?.close();
|
|
264
|
+
};
|
|
265
|
+
// Reconnect when route params change; do not depend on `state` — that
|
|
266
|
+
// closed the stream after every SSE event and broke RN progress feeds.
|
|
267
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
268
|
+
}, [credentialsStore, pathKey, queryKey, headerKey]);
|
|
269
|
+
return state;
|
|
270
|
+
},
|
|
271
|
+
all: (options) => {
|
|
272
|
+
const { credentialsStore } = useCredentialsStore();
|
|
273
|
+
const [state, setState] = useState([]);
|
|
274
|
+
const pathKey = JSON.stringify(options.pathParameters ?? null);
|
|
275
|
+
const queryKey = JSON.stringify(options.queryParameters ?? null);
|
|
276
|
+
const headerKey = JSON.stringify(options.headers ?? null);
|
|
277
|
+
useEffect(() => {
|
|
278
|
+
const params = options.pathParameters;
|
|
279
|
+
if (params && Object.values(params).some((v) => v == null || v === '')) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
let closed = false;
|
|
283
|
+
let source;
|
|
284
|
+
void (async () => {
|
|
285
|
+
const token = (await credentialsStore.get())?.token;
|
|
286
|
+
if (closed)
|
|
287
|
+
return;
|
|
288
|
+
source = await typedEventSource({
|
|
289
|
+
...options,
|
|
290
|
+
headers: {
|
|
291
|
+
...(options.headers || {}),
|
|
292
|
+
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
293
|
+
},
|
|
294
|
+
handler: (e) => {
|
|
295
|
+
if (!closed)
|
|
296
|
+
setState((prev) => [...prev, e]);
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
if (!closed) {
|
|
300
|
+
void source.stream();
|
|
301
|
+
}
|
|
302
|
+
})();
|
|
303
|
+
return () => {
|
|
304
|
+
closed = true;
|
|
305
|
+
void source?.close();
|
|
306
|
+
};
|
|
307
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
308
|
+
}, [credentialsStore, pathKey, queryKey, headerKey]);
|
|
309
|
+
return state;
|
|
310
|
+
},
|
|
311
|
+
});
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import type { OpenpeepsClient } from '@openpeepshq/client';
|
|
2
|
+
export declare const accountHooks: (client: OpenpeepsClient) => {
|
|
3
|
+
useCurrentAccount: () => import("@tanstack/react-query").UseQueryResult<{
|
|
4
|
+
id: string;
|
|
5
|
+
email: string;
|
|
6
|
+
emailValidated: boolean;
|
|
7
|
+
}, {
|
|
8
|
+
success: boolean;
|
|
9
|
+
message?: string | undefined;
|
|
10
|
+
key?: string | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
updateCurrentAccountAction: (defaultPathParams?: undefined) => (input: {
|
|
13
|
+
oldPassword: string;
|
|
14
|
+
email?: string | undefined;
|
|
15
|
+
newPassword?: string | undefined;
|
|
16
|
+
confirmPassword?: string | undefined;
|
|
17
|
+
}, pathParams?: undefined, queryParams?: undefined, headers?: Record<string, string>) => Promise<{
|
|
18
|
+
success: true;
|
|
19
|
+
}>;
|
|
20
|
+
createPushSubscriptionAction: (defaultPathParams?: undefined) => (input: {
|
|
21
|
+
type: "web";
|
|
22
|
+
endpoint: string;
|
|
23
|
+
keys: {
|
|
24
|
+
auth: string;
|
|
25
|
+
p256dh: string;
|
|
26
|
+
};
|
|
27
|
+
deviceName?: string | undefined;
|
|
28
|
+
alerts?: {
|
|
29
|
+
poll: boolean;
|
|
30
|
+
followRequest: boolean;
|
|
31
|
+
status: boolean;
|
|
32
|
+
favorite: boolean;
|
|
33
|
+
follow: boolean;
|
|
34
|
+
repost: boolean;
|
|
35
|
+
mention: boolean;
|
|
36
|
+
update: boolean;
|
|
37
|
+
admin: {
|
|
38
|
+
signUp: boolean;
|
|
39
|
+
report: boolean;
|
|
40
|
+
};
|
|
41
|
+
} | undefined;
|
|
42
|
+
} | {
|
|
43
|
+
type: "apn";
|
|
44
|
+
apnToken: string;
|
|
45
|
+
deviceName?: string | undefined;
|
|
46
|
+
alerts?: {
|
|
47
|
+
poll: boolean;
|
|
48
|
+
followRequest: boolean;
|
|
49
|
+
status: boolean;
|
|
50
|
+
favorite: boolean;
|
|
51
|
+
follow: boolean;
|
|
52
|
+
repost: boolean;
|
|
53
|
+
mention: boolean;
|
|
54
|
+
update: boolean;
|
|
55
|
+
admin: {
|
|
56
|
+
signUp: boolean;
|
|
57
|
+
report: boolean;
|
|
58
|
+
};
|
|
59
|
+
} | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
type: "fcm";
|
|
62
|
+
fcmToken: string;
|
|
63
|
+
deviceName?: string | undefined;
|
|
64
|
+
alerts?: {
|
|
65
|
+
poll: boolean;
|
|
66
|
+
followRequest: boolean;
|
|
67
|
+
status: boolean;
|
|
68
|
+
favorite: boolean;
|
|
69
|
+
follow: boolean;
|
|
70
|
+
repost: boolean;
|
|
71
|
+
mention: boolean;
|
|
72
|
+
update: boolean;
|
|
73
|
+
admin: {
|
|
74
|
+
signUp: boolean;
|
|
75
|
+
report: boolean;
|
|
76
|
+
};
|
|
77
|
+
} | undefined;
|
|
78
|
+
} | {
|
|
79
|
+
type: "webhook";
|
|
80
|
+
url: string;
|
|
81
|
+
publicKey: string;
|
|
82
|
+
alerts?: {
|
|
83
|
+
poll: boolean;
|
|
84
|
+
followRequest: boolean;
|
|
85
|
+
status: boolean;
|
|
86
|
+
favorite: boolean;
|
|
87
|
+
follow: boolean;
|
|
88
|
+
repost: boolean;
|
|
89
|
+
mention: boolean;
|
|
90
|
+
update: boolean;
|
|
91
|
+
admin: {
|
|
92
|
+
signUp: boolean;
|
|
93
|
+
report: boolean;
|
|
94
|
+
};
|
|
95
|
+
} | undefined;
|
|
96
|
+
}, pathParams?: undefined, queryParams?: undefined, headers?: Record<string, string>) => Promise<{
|
|
97
|
+
type: "web";
|
|
98
|
+
endpoint: string;
|
|
99
|
+
keys: {
|
|
100
|
+
auth: string;
|
|
101
|
+
p256dh: string;
|
|
102
|
+
};
|
|
103
|
+
id: string;
|
|
104
|
+
createdAt: string;
|
|
105
|
+
updatedAt: string;
|
|
106
|
+
deviceName?: string | undefined;
|
|
107
|
+
alerts?: {
|
|
108
|
+
poll: boolean;
|
|
109
|
+
followRequest: boolean;
|
|
110
|
+
status: boolean;
|
|
111
|
+
favorite: boolean;
|
|
112
|
+
follow: boolean;
|
|
113
|
+
repost: boolean;
|
|
114
|
+
mention: boolean;
|
|
115
|
+
update: boolean;
|
|
116
|
+
admin: {
|
|
117
|
+
signUp: boolean;
|
|
118
|
+
report: boolean;
|
|
119
|
+
};
|
|
120
|
+
} | undefined;
|
|
121
|
+
deletedAt?: string | null | undefined;
|
|
122
|
+
} | {
|
|
123
|
+
type: "apn";
|
|
124
|
+
apnToken: string;
|
|
125
|
+
id: string;
|
|
126
|
+
createdAt: string;
|
|
127
|
+
updatedAt: string;
|
|
128
|
+
deviceName?: string | undefined;
|
|
129
|
+
alerts?: {
|
|
130
|
+
poll: boolean;
|
|
131
|
+
followRequest: boolean;
|
|
132
|
+
status: boolean;
|
|
133
|
+
favorite: boolean;
|
|
134
|
+
follow: boolean;
|
|
135
|
+
repost: boolean;
|
|
136
|
+
mention: boolean;
|
|
137
|
+
update: boolean;
|
|
138
|
+
admin: {
|
|
139
|
+
signUp: boolean;
|
|
140
|
+
report: boolean;
|
|
141
|
+
};
|
|
142
|
+
} | undefined;
|
|
143
|
+
deletedAt?: string | null | undefined;
|
|
144
|
+
} | {
|
|
145
|
+
type: "fcm";
|
|
146
|
+
fcmToken: string;
|
|
147
|
+
id: string;
|
|
148
|
+
createdAt: string;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
deviceName?: string | undefined;
|
|
151
|
+
alerts?: {
|
|
152
|
+
poll: boolean;
|
|
153
|
+
followRequest: boolean;
|
|
154
|
+
status: boolean;
|
|
155
|
+
favorite: boolean;
|
|
156
|
+
follow: boolean;
|
|
157
|
+
repost: boolean;
|
|
158
|
+
mention: boolean;
|
|
159
|
+
update: boolean;
|
|
160
|
+
admin: {
|
|
161
|
+
signUp: boolean;
|
|
162
|
+
report: boolean;
|
|
163
|
+
};
|
|
164
|
+
} | undefined;
|
|
165
|
+
deletedAt?: string | null | undefined;
|
|
166
|
+
} | {
|
|
167
|
+
type: "webhook";
|
|
168
|
+
url: string;
|
|
169
|
+
publicKey: string;
|
|
170
|
+
id: string;
|
|
171
|
+
createdAt: string;
|
|
172
|
+
updatedAt: string;
|
|
173
|
+
alerts?: {
|
|
174
|
+
poll: boolean;
|
|
175
|
+
followRequest: boolean;
|
|
176
|
+
status: boolean;
|
|
177
|
+
favorite: boolean;
|
|
178
|
+
follow: boolean;
|
|
179
|
+
repost: boolean;
|
|
180
|
+
mention: boolean;
|
|
181
|
+
update: boolean;
|
|
182
|
+
admin: {
|
|
183
|
+
signUp: boolean;
|
|
184
|
+
report: boolean;
|
|
185
|
+
};
|
|
186
|
+
} | undefined;
|
|
187
|
+
deletedAt?: string | null | undefined;
|
|
188
|
+
}>;
|
|
189
|
+
usePushSubscriptions: () => import("@tanstack/react-query").UseQueryResult<({
|
|
190
|
+
type: "web";
|
|
191
|
+
endpoint: string;
|
|
192
|
+
keys: {
|
|
193
|
+
auth: string;
|
|
194
|
+
p256dh: string;
|
|
195
|
+
};
|
|
196
|
+
id: string;
|
|
197
|
+
createdAt: string;
|
|
198
|
+
updatedAt: string;
|
|
199
|
+
deviceName?: string | undefined;
|
|
200
|
+
alerts?: {
|
|
201
|
+
poll: boolean;
|
|
202
|
+
followRequest: boolean;
|
|
203
|
+
status: boolean;
|
|
204
|
+
favorite: boolean;
|
|
205
|
+
follow: boolean;
|
|
206
|
+
repost: boolean;
|
|
207
|
+
mention: boolean;
|
|
208
|
+
update: boolean;
|
|
209
|
+
admin: {
|
|
210
|
+
signUp: boolean;
|
|
211
|
+
report: boolean;
|
|
212
|
+
};
|
|
213
|
+
} | undefined;
|
|
214
|
+
deletedAt?: string | null | undefined;
|
|
215
|
+
} | {
|
|
216
|
+
type: "apn";
|
|
217
|
+
apnToken: string;
|
|
218
|
+
id: string;
|
|
219
|
+
createdAt: string;
|
|
220
|
+
updatedAt: string;
|
|
221
|
+
deviceName?: string | undefined;
|
|
222
|
+
alerts?: {
|
|
223
|
+
poll: boolean;
|
|
224
|
+
followRequest: boolean;
|
|
225
|
+
status: boolean;
|
|
226
|
+
favorite: boolean;
|
|
227
|
+
follow: boolean;
|
|
228
|
+
repost: boolean;
|
|
229
|
+
mention: boolean;
|
|
230
|
+
update: boolean;
|
|
231
|
+
admin: {
|
|
232
|
+
signUp: boolean;
|
|
233
|
+
report: boolean;
|
|
234
|
+
};
|
|
235
|
+
} | undefined;
|
|
236
|
+
deletedAt?: string | null | undefined;
|
|
237
|
+
} | {
|
|
238
|
+
type: "fcm";
|
|
239
|
+
fcmToken: string;
|
|
240
|
+
id: string;
|
|
241
|
+
createdAt: string;
|
|
242
|
+
updatedAt: string;
|
|
243
|
+
deviceName?: string | undefined;
|
|
244
|
+
alerts?: {
|
|
245
|
+
poll: boolean;
|
|
246
|
+
followRequest: boolean;
|
|
247
|
+
status: boolean;
|
|
248
|
+
favorite: boolean;
|
|
249
|
+
follow: boolean;
|
|
250
|
+
repost: boolean;
|
|
251
|
+
mention: boolean;
|
|
252
|
+
update: boolean;
|
|
253
|
+
admin: {
|
|
254
|
+
signUp: boolean;
|
|
255
|
+
report: boolean;
|
|
256
|
+
};
|
|
257
|
+
} | undefined;
|
|
258
|
+
deletedAt?: string | null | undefined;
|
|
259
|
+
} | {
|
|
260
|
+
type: "webhook";
|
|
261
|
+
url: string;
|
|
262
|
+
publicKey: string;
|
|
263
|
+
id: string;
|
|
264
|
+
createdAt: string;
|
|
265
|
+
updatedAt: string;
|
|
266
|
+
alerts?: {
|
|
267
|
+
poll: boolean;
|
|
268
|
+
followRequest: boolean;
|
|
269
|
+
status: boolean;
|
|
270
|
+
favorite: boolean;
|
|
271
|
+
follow: boolean;
|
|
272
|
+
repost: boolean;
|
|
273
|
+
mention: boolean;
|
|
274
|
+
update: boolean;
|
|
275
|
+
admin: {
|
|
276
|
+
signUp: boolean;
|
|
277
|
+
report: boolean;
|
|
278
|
+
};
|
|
279
|
+
} | undefined;
|
|
280
|
+
deletedAt?: string | null | undefined;
|
|
281
|
+
})[], {
|
|
282
|
+
success: boolean;
|
|
283
|
+
message?: string | undefined;
|
|
284
|
+
key?: string | undefined;
|
|
285
|
+
}>;
|
|
286
|
+
validationEmailAction: (defaultPathParams?: undefined) => (pathParams?: undefined, queryParams?: undefined, headers?: Record<string, string>) => Promise<{
|
|
287
|
+
success: true;
|
|
288
|
+
}>;
|
|
289
|
+
testPushSubscriptionAction: (defaultPathParams?: undefined) => (input: {
|
|
290
|
+
subscriptionKey: string;
|
|
291
|
+
}, pathParams?: undefined, queryParams?: undefined, headers?: Record<string, string>) => Promise<{
|
|
292
|
+
success: true;
|
|
293
|
+
}>;
|
|
294
|
+
deletePushSubscriptionAction: (defaultPathParams?: {
|
|
295
|
+
pushSubscriptionId: string;
|
|
296
|
+
} | undefined) => (pathParams?: {
|
|
297
|
+
pushSubscriptionId: string;
|
|
298
|
+
} | undefined, queryParams?: undefined, headers?: Record<string, string>) => Promise<{
|
|
299
|
+
success: true;
|
|
300
|
+
}>;
|
|
301
|
+
};
|
|
302
|
+
export type AccountHooks = ReturnType<typeof accountHooks>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { apiHook, noPayloadMutation, payloadMutation } from '../helpers.js';
|
|
2
|
+
import { useHasAuthToken } from './useHasAuthToken.js';
|
|
3
|
+
export const accountHooks = (client) => ({
|
|
4
|
+
useCurrentAccount: () => {
|
|
5
|
+
const hasToken = useHasAuthToken();
|
|
6
|
+
return apiHook(client.accounts.current.read, { enabled: hasToken });
|
|
7
|
+
},
|
|
8
|
+
updateCurrentAccountAction: payloadMutation(client.accounts.current.update, [
|
|
9
|
+
['accounts'],
|
|
10
|
+
['current'],
|
|
11
|
+
]),
|
|
12
|
+
createPushSubscriptionAction: payloadMutation(client.accounts.current.createPushSubscription, [['accounts'], ['current']]),
|
|
13
|
+
usePushSubscriptions: () => apiHook(client.accounts.current.listPushSubscriptions),
|
|
14
|
+
validationEmailAction: noPayloadMutation(client.accounts.current.validationEmail),
|
|
15
|
+
testPushSubscriptionAction: payloadMutation(client.accounts.current.testPushSubscription),
|
|
16
|
+
deletePushSubscriptionAction: noPayloadMutation(client.accounts.current.deletePushSubcription, [['accounts'], ['current']]),
|
|
17
|
+
});
|