@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
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 All Peep Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# AllPeeP React Components & Utilities
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CredentialsStore } from './types';
|
|
2
|
+
/** localStorage key — exported for `storage` listeners in other modules. */
|
|
3
|
+
export declare const AUTH_CREDENTIALS_STORAGE_KEY = "auth_credentials";
|
|
4
|
+
/** Fired on the window after any successful `set` / `clear` on the store. */
|
|
5
|
+
export declare const OPENPEEPS_CREDENTIALS_CHANGED_EVENT = "openpeeps-credentials-changed";
|
|
6
|
+
/** Cross-platform credential change subscription (required on React Native). */
|
|
7
|
+
export declare const subscribeCredentialsChanged: (listener: () => void) => () => void;
|
|
8
|
+
export declare const notifyCredentialsChanged: () => void;
|
|
9
|
+
export declare const credentialsStore: CredentialsStore;
|
|
10
|
+
export type { CredentialsStore } from './types';
|
|
11
|
+
export type { Credentials } from '@openpeepshq/common/types';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** localStorage key — exported for `storage` listeners in other modules. */
|
|
2
|
+
export const AUTH_CREDENTIALS_STORAGE_KEY = 'auth_credentials';
|
|
3
|
+
/** Fired on the window after any successful `set` / `clear` on the store. */
|
|
4
|
+
export const OPENPEEPS_CREDENTIALS_CHANGED_EVENT = 'openpeeps-credentials-changed';
|
|
5
|
+
const credentialsChangedListeners = new Set();
|
|
6
|
+
/** Cross-platform credential change subscription (required on React Native). */
|
|
7
|
+
export const subscribeCredentialsChanged = (listener) => {
|
|
8
|
+
credentialsChangedListeners.add(listener);
|
|
9
|
+
return () => {
|
|
10
|
+
credentialsChangedListeners.delete(listener);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export const notifyCredentialsChanged = () => {
|
|
14
|
+
credentialsChangedListeners.forEach((listener) => listener());
|
|
15
|
+
if (typeof window === 'undefined')
|
|
16
|
+
return;
|
|
17
|
+
// Defer so callers finish mutating localStorage before listeners run (avoids
|
|
18
|
+
// synchronous re-entrancy and duplicate work during the same task).
|
|
19
|
+
queueMicrotask(() => {
|
|
20
|
+
if (typeof window.dispatchEvent === 'function') {
|
|
21
|
+
window.dispatchEvent(new Event(OPENPEEPS_CREDENTIALS_CHANGED_EVENT));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const get = async () => {
|
|
26
|
+
const stored = localStorage.getItem(AUTH_CREDENTIALS_STORAGE_KEY);
|
|
27
|
+
if (!stored)
|
|
28
|
+
return null;
|
|
29
|
+
try {
|
|
30
|
+
return JSON.parse(stored);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const set = async (credentials) => {
|
|
37
|
+
const prevRaw = localStorage.getItem(AUTH_CREDENTIALS_STORAGE_KEY);
|
|
38
|
+
const nextRaw = credentials ? JSON.stringify(credentials) : null;
|
|
39
|
+
// Avoid redundant writes + credential-changed storms (e.g. clear when empty,
|
|
40
|
+
// or set with identical JSON), which could retrigger profile fetches and
|
|
41
|
+
// interact badly with auth routes.
|
|
42
|
+
if (prevRaw === nextRaw)
|
|
43
|
+
return;
|
|
44
|
+
if (credentials) {
|
|
45
|
+
localStorage.setItem(AUTH_CREDENTIALS_STORAGE_KEY, nextRaw);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
localStorage.removeItem(AUTH_CREDENTIALS_STORAGE_KEY);
|
|
49
|
+
}
|
|
50
|
+
notifyCredentialsChanged();
|
|
51
|
+
};
|
|
52
|
+
const clear = async () => set();
|
|
53
|
+
export const credentialsStore = {
|
|
54
|
+
get,
|
|
55
|
+
set,
|
|
56
|
+
clear,
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SignUpLoginModalProps {
|
|
2
|
+
onClose: () => void;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Translation of @openpeepshq/svelte/components/core/accounts/modals/
|
|
6
|
+
* SignUpLoginModal.svelte. Prompts a guest to sign in before performing an
|
|
7
|
+
* action that requires authentication (e.g. replying to a post).
|
|
8
|
+
*/
|
|
9
|
+
export declare function SignUpLoginModal({ onClose }: SignUpLoginModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
3
|
+
import { useT } from '../../i18n/index.js';
|
|
4
|
+
import { useRouter } from '../../contexts/router/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Translation of @openpeepshq/svelte/components/core/accounts/modals/
|
|
7
|
+
* SignUpLoginModal.svelte. Prompts a guest to sign in before performing an
|
|
8
|
+
* action that requires authentication (e.g. replying to a post).
|
|
9
|
+
*/
|
|
10
|
+
export function SignUpLoginModal({ onClose }) {
|
|
11
|
+
const t = useT();
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-md", showCloseButton: false, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: t('accounts.login.title', { defaultValue: 'Login' }) }), _jsx(DialogDescription, { children: t('accounts.login.description', {
|
|
14
|
+
defaultValue: 'Login to your account',
|
|
15
|
+
}) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ringed-surface", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "variant-filled-primary", action: () => {
|
|
16
|
+
router.navigate('/auth/login');
|
|
17
|
+
onClose();
|
|
18
|
+
}, children: t('accounts.login.loginButton', { defaultValue: 'Log In' }) })] })] }) }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
interface SignUpLoginModalContextValue {
|
|
3
|
+
/** Open the guest sign-up / login prompt. */
|
|
4
|
+
openSignUpLogin: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function SignUpLoginModalProvider({ children, }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useSignUpLoginModal(): SignUpLoginModalContextValue;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useState, } from 'react';
|
|
3
|
+
import { SignUpLoginModal } from './SignUpLoginModal.js';
|
|
4
|
+
const SignUpLoginModalContext = createContext(null);
|
|
5
|
+
export function SignUpLoginModalProvider({ children, }) {
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
const openSignUpLogin = useCallback(() => setOpen(true), []);
|
|
8
|
+
return (_jsxs(SignUpLoginModalContext.Provider, { value: { openSignUpLogin }, children: [children, open ? _jsx(SignUpLoginModal, { onClose: () => setOpen(false) }) : null] }));
|
|
9
|
+
}
|
|
10
|
+
export function useSignUpLoginModal() {
|
|
11
|
+
const ctx = useContext(SignUpLoginModalContext);
|
|
12
|
+
if (!ctx) {
|
|
13
|
+
throw new Error('useSignUpLoginModal must be used within SignUpLoginModalProvider');
|
|
14
|
+
}
|
|
15
|
+
return ctx;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ZodObject, type ZodRawShape } from 'zod';
|
|
2
|
+
export interface ConfigurationCategoryProps {
|
|
3
|
+
schema: ZodObject<ZodRawShape>;
|
|
4
|
+
config: Record<string, unknown>;
|
|
5
|
+
defaults: Record<string, unknown>;
|
|
6
|
+
path?: (string | number)[];
|
|
7
|
+
value?: Record<string, unknown>;
|
|
8
|
+
onChange: (value: Record<string, unknown>) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
collapsible?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function ConfigurationCategory({ schema, config, defaults, path, value: valueProp, onChange, disabled: disabledProp, collapsible, }: ConfigurationCategoryProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { ZodObject, ZodArray } from 'zod';
|
|
4
|
+
import { capitalizeFirstLetter } from '@openpeepshq/common';
|
|
5
|
+
import { ExpandableBox } from '@openpeepshq/react-ui';
|
|
6
|
+
import { useT } from '../../i18n/index.js';
|
|
7
|
+
import { diffConfigTrees, equal, isFieldHidden, unwrap, } from '../../lib/configuration/helpers.js';
|
|
8
|
+
import { ConfigurationList } from './ConfigurationList.js';
|
|
9
|
+
import { ConfigurationValueEditor } from './ConfigurationValueEditor.js';
|
|
10
|
+
export function ConfigurationCategory({ schema, config, defaults, path = [], value: valueProp, onChange, disabled: disabledProp, collapsible = true, }) {
|
|
11
|
+
const t = useT();
|
|
12
|
+
const disabled = disabledProp ?? schema.description === 'fixed';
|
|
13
|
+
const [value, setValue] = useState(() => structuredClone(valueProp ?? config));
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setValue(structuredClone(valueProp ?? config));
|
|
16
|
+
}, [valueProp, config]);
|
|
17
|
+
const setAndNotify = (next) => {
|
|
18
|
+
setValue(next);
|
|
19
|
+
onChange(next);
|
|
20
|
+
};
|
|
21
|
+
const dirty = !equal(config, value);
|
|
22
|
+
const dirtyPaths = useMemo(() => {
|
|
23
|
+
const diff = diffConfigTrees(config, value);
|
|
24
|
+
return Object.keys(diff).flatMap((key) => [...path.map(String), key]);
|
|
25
|
+
}, [config, value, path]);
|
|
26
|
+
const pathName = path.at(-1);
|
|
27
|
+
const fields = Object.entries(schema.shape).map(([key, def]) => ({
|
|
28
|
+
key,
|
|
29
|
+
def: def,
|
|
30
|
+
path: [...path, key],
|
|
31
|
+
}));
|
|
32
|
+
const updateField = (key, fieldValue) => {
|
|
33
|
+
setAndNotify({ ...value, [key]: fieldValue });
|
|
34
|
+
};
|
|
35
|
+
const hasKey = (key) => dirtyPaths.includes(key);
|
|
36
|
+
if (fields.length === 0)
|
|
37
|
+
return null;
|
|
38
|
+
const body = (_jsx(_Fragment, { children: fields.map((field) => {
|
|
39
|
+
if (isFieldHidden(field.def))
|
|
40
|
+
return null;
|
|
41
|
+
const fieldSchema = unwrap(field.def);
|
|
42
|
+
if (isFieldHidden(fieldSchema))
|
|
43
|
+
return null;
|
|
44
|
+
const title = (_jsx("p", { className: !collapsible
|
|
45
|
+
? dirty && hasKey(String(field.key))
|
|
46
|
+
? 'font-bold'
|
|
47
|
+
: ''
|
|
48
|
+
: dirty && hasKey(String(field.key))
|
|
49
|
+
? 'font-bold'
|
|
50
|
+
: '', children: capitalizeFirstLetter(String(field.key)) }));
|
|
51
|
+
if (fieldSchema instanceof ZodObject) {
|
|
52
|
+
const nested = (_jsx(ConfigurationCategory, { schema: fieldSchema, path: field.path, config: (config[field.key] ?? {}), defaults: (defaults[field.key] ?? {}), value: (value[field.key] ?? {}), onChange: (v) => updateField(String(field.key), v), collapsible: false, disabled: disabled }));
|
|
53
|
+
return collapsible ? (_jsx(ExpandableBox, { title: title, initialOpen: false, children: nested }, String(field.key))) : (_jsxs("div", { children: [title, nested] }, String(field.key)));
|
|
54
|
+
}
|
|
55
|
+
if (fieldSchema instanceof ZodArray) {
|
|
56
|
+
return (_jsx(ConfigurationList, { schema: fieldSchema, path: field.path, config: (config[field.key] ?? []), value: (value[field.key] ?? []), onChange: (v) => updateField(String(field.key), v), disabled: disabled }, String(field.key)));
|
|
57
|
+
}
|
|
58
|
+
return (_jsx(ConfigurationValueEditor, { schema: field.def, path: field.path.map(String), config: config[field.key], defaults: defaults[field.key], value: value[field.key], onChange: (v) => updateField(String(field.key), v), disabled: disabled }, String(field.key)));
|
|
59
|
+
}) }));
|
|
60
|
+
return (_jsxs("div", { className: collapsible ? 'mt-4 pl-4' : '', children: [collapsible && (_jsx("p", { className: dirty ? 'font-bold' : '', children: pathName || t('configuration.title', { defaultValue: 'Configuration' }) })), body] }));
|
|
61
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ZodArray, type ZodTypeAny } from 'zod';
|
|
2
|
+
export interface ConfigurationListProps {
|
|
3
|
+
schema: ZodArray<ZodTypeAny>;
|
|
4
|
+
config: unknown[];
|
|
5
|
+
path?: (string | number)[];
|
|
6
|
+
value?: unknown[];
|
|
7
|
+
onChange: (value: unknown[]) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function ConfigurationList({ schema, config, path, value: valueProp, onChange, disabled: disabledProp, }: ConfigurationListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { z, ZodArray } from 'zod';
|
|
4
|
+
import { Minus, Plus } from 'lucide-react';
|
|
5
|
+
import { useT } from '../../i18n/index.js';
|
|
6
|
+
import { equal, unwrap } from '../../lib/configuration/helpers.js';
|
|
7
|
+
import { ConfigurationCategory } from './ConfigurationCategory.js';
|
|
8
|
+
import { ConfigurationValueEditor } from './ConfigurationValueEditor.js';
|
|
9
|
+
export function ConfigurationList({ schema, config, path = [], value: valueProp, onChange, disabled: disabledProp, }) {
|
|
10
|
+
const t = useT();
|
|
11
|
+
const disabled = disabledProp ?? schema.description === 'fixed';
|
|
12
|
+
const elementSchema = (schema.element ?? schema._def.type);
|
|
13
|
+
const unwrappedElementSchema = unwrap(elementSchema);
|
|
14
|
+
const defaults = useMemo(() => elementSchema.parse(undefined), [elementSchema]);
|
|
15
|
+
const [value, setValue] = useState(valueProp ?? [...config]);
|
|
16
|
+
const setAndNotify = (next) => {
|
|
17
|
+
setValue(next);
|
|
18
|
+
onChange(next);
|
|
19
|
+
};
|
|
20
|
+
const dirty = !equal(config, value); // list roots are arrays
|
|
21
|
+
return (_jsxs("div", { className: "mt-4 pl-4", children: [_jsx("p", { className: dirty ? 'font-bold' : '', children: path.at(-1) || t('admin.configuration.unnamedSection', { defaultValue: 'Section' }) }), value.map((_, index) => (_jsxs("div", { children: [unwrappedElementSchema instanceof z.ZodObject ? (_jsx(ConfigurationCategory, { schema: unwrappedElementSchema, path: [...path, String(index)], config: (config?.[index] ?? defaults), defaults: defaults, value: (value[index] ?? defaults), onChange: (entry) => {
|
|
22
|
+
const next = [...value];
|
|
23
|
+
next[index] = entry;
|
|
24
|
+
setAndNotify(next);
|
|
25
|
+
}, disabled: disabled, collapsible: false })) : (_jsx(ConfigurationValueEditor, { schema: elementSchema, path: [...path, index], config: config?.[index] ?? defaults, defaults: defaults, value: value[index], onChange: (entry) => {
|
|
26
|
+
const next = [...value];
|
|
27
|
+
next[index] = entry;
|
|
28
|
+
setAndNotify(next);
|
|
29
|
+
}, disabled: disabled })), _jsx("button", { type: "button", title: t('common.listEditor.removeTitle', { defaultValue: 'Remove' }), onClick: () => setAndNotify(value.toSpliced(index, 1)), children: _jsx(Minus, { className: "h-4 w-4" }) })] }, index))), _jsx("button", { type: "button", title: t('common.listEditor.addTitle', { defaultValue: 'Add' }), onClick: () => setAndNotify([...value, structuredClone(defaults)]), children: _jsx(Plus, { className: "h-4 w-4" }) })] }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ZodObject, type ZodRawShape } from 'zod';
|
|
2
|
+
export interface ConfigurationTreeProps {
|
|
3
|
+
schema: ZodObject<ZodRawShape>;
|
|
4
|
+
config: Record<string, unknown>;
|
|
5
|
+
defaults: Record<string, unknown>;
|
|
6
|
+
onSave: (patch: Record<string, unknown>) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare function ConfigurationTree({ schema, config, defaults, onSave, }: ConfigurationTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { ZodObject } from 'zod';
|
|
4
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useT } from '../../i18n/index.js';
|
|
6
|
+
import { diffConfigTrees, equal } from '../../lib/configuration/helpers.js';
|
|
7
|
+
import { ConfigurationCategory } from './ConfigurationCategory.js';
|
|
8
|
+
export function ConfigurationTree({ schema, config, defaults, onSave, }) {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const [value, setValue] = useState(() => structuredClone(config));
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setValue(structuredClone(config));
|
|
13
|
+
}, [config]);
|
|
14
|
+
const unchanged = useMemo(() => equal(config, value), [config, value]);
|
|
15
|
+
const handleSubmit = async () => {
|
|
16
|
+
const data = diffConfigTrees(config, value);
|
|
17
|
+
await onSave(data);
|
|
18
|
+
};
|
|
19
|
+
return (_jsxs("div", { className: "mb-20 h-full", children: [_jsx(ConfigurationCategory, { schema: schema, config: config, defaults: defaults, value: value, onChange: setValue, collapsible: false }), _jsx("div", { className: "mt-4 flex justify-end", children: _jsx(Button, { title: t('common.submit', { defaultValue: 'Submit' }), variant: "variant-filled-primary", disabled: unchanged, action: handleSubmit, children: t('common.submit', { defaultValue: 'Submit' }) }) })] }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ZodType } from 'zod';
|
|
2
|
+
export interface ConfigurationValueEditorProps {
|
|
3
|
+
schema: ZodType;
|
|
4
|
+
config: unknown;
|
|
5
|
+
defaults: unknown;
|
|
6
|
+
path: (string | number)[];
|
|
7
|
+
value?: unknown;
|
|
8
|
+
onChange: (value: unknown) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function ConfigurationValueEditor({ schema, config, defaults, path, value: valueProp, onChange, disabled: disabledProp, }: ConfigurationValueEditorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { Input, Textarea } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useT } from '../../i18n/index.js';
|
|
6
|
+
import { unwrap } from '../../lib/configuration/helpers.js';
|
|
7
|
+
export function ConfigurationValueEditor({ schema, config, defaults, path, value: valueProp, onChange, disabled: disabledProp, }) {
|
|
8
|
+
const t = useT();
|
|
9
|
+
const unwrappedSchema = useMemo(() => unwrap(schema), [schema]);
|
|
10
|
+
const disabled = disabledProp ?? schema.description === 'fixed';
|
|
11
|
+
const [value, setValue] = useState(valueProp ?? config);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setValue(valueProp ?? config);
|
|
14
|
+
}, [valueProp, config]);
|
|
15
|
+
const setAndNotify = (next) => {
|
|
16
|
+
setValue(next);
|
|
17
|
+
onChange(next);
|
|
18
|
+
};
|
|
19
|
+
const dirty = value !== config;
|
|
20
|
+
const label = t(String(path.at(-1)), {
|
|
21
|
+
defaultValue: String(path.at(-1)),
|
|
22
|
+
});
|
|
23
|
+
const password = schema.description === 'password';
|
|
24
|
+
const longText = schema.description === 'longText';
|
|
25
|
+
if (unwrappedSchema instanceof z.ZodString) {
|
|
26
|
+
if (longText) {
|
|
27
|
+
return (_jsx("div", { className: "my-2 pl-4", children: _jsxs("label", { className: "label flex flex-col gap-1", children: [_jsx("span", { className: dirty ? 'font-bold' : '', children: label }), _jsx(Textarea, { value: String(value ?? ''), placeholder: String(defaults ?? ''), disabled: disabled, onChange: (e) => setAndNotify(e.target.value) })] }) }));
|
|
28
|
+
}
|
|
29
|
+
return (_jsx("div", { className: "my-2 pl-4", children: _jsxs("label", { className: "label flex flex-col gap-1", children: [_jsx("span", { className: dirty ? 'font-bold' : '', children: label }), _jsx(Input, { type: password ? 'password' : 'text', value: String(value ?? ''), placeholder: String(defaults ?? ''), disabled: disabled, onChange: (e) => setAndNotify(e.target.value) })] }) }));
|
|
30
|
+
}
|
|
31
|
+
if (unwrappedSchema instanceof z.ZodNumber) {
|
|
32
|
+
return (_jsx("div", { className: "my-2 pl-4", children: _jsxs("label", { className: "label flex flex-col gap-1", children: [_jsx("span", { className: dirty ? 'font-bold' : '', children: label }), _jsx(Input, { type: "number", value: value === undefined || value === null ? '' : String(value), placeholder: String(defaults ?? ''), disabled: disabled, onChange: (e) => setAndNotify(e.target.value === '' ? undefined : Number(e.target.value)) })] }) }));
|
|
33
|
+
}
|
|
34
|
+
if (unwrappedSchema instanceof z.ZodBoolean) {
|
|
35
|
+
return (_jsx("div", { className: "my-2 pl-4", children: _jsxs("label", { className: "flex items-center gap-2", children: [_jsx("input", { type: "checkbox", className: "checkbox", checked: Boolean(value), disabled: disabled, onChange: (e) => setAndNotify(e.target.checked) }), _jsx("span", { className: dirty ? 'font-bold' : '', children: label })] }) }));
|
|
36
|
+
}
|
|
37
|
+
if (unwrappedSchema instanceof z.ZodEnum) {
|
|
38
|
+
const options = unwrappedSchema.options ??
|
|
39
|
+
(unwrappedSchema._def?.entries
|
|
40
|
+
? Object.keys(unwrappedSchema._def.entries)
|
|
41
|
+
: []);
|
|
42
|
+
return (_jsxs("div", { className: "my-2 pl-4", children: [_jsx("p", { className: dirty ? 'font-bold' : '', children: label }), options.map((option) => (_jsxs("label", { className: "flex items-center gap-2", children: [_jsx("input", { type: "radio", className: "radio", name: path.join('-'), value: option, checked: value === option, disabled: disabled, onChange: () => setAndNotify(option) }), _jsx("span", { children: option })] }, option)))] }));
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCurrentProfile } from '../layout/IdentityContext.js';
|
|
3
|
+
import { FeedPostContent } from '../post/FeedPostContent.js';
|
|
4
|
+
export function ConversationMessageBubble({ message, }) {
|
|
5
|
+
const me = useCurrentProfile();
|
|
6
|
+
const mine = message.profile.id === me?.id;
|
|
7
|
+
return (_jsx("div", { className: `mt-4 flex w-full ${mine ? 'justify-end' : 'justify-start'}`, children: _jsx("div", { className: `mt-2 w-[80%] rounded-t-xl p-3 md:w-[60%] ${mine
|
|
8
|
+
? 'variant-soft-primary bg-primary/10 rounded-bl-xl'
|
|
9
|
+
: 'bg-surface-200 rounded-br-xl'}`, children: _jsx(FeedPostContent, { post: message }) }) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PublicProfile } from '@openpeepshq/common/types';
|
|
2
|
+
export interface CreateNewConversationProps {
|
|
3
|
+
profiles?: PublicProfile[];
|
|
4
|
+
message?: string;
|
|
5
|
+
skipProfileSelection?: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const CreateNewConversation: ({ profiles: initialProfiles, message: initialMessage, skipProfileSelection, onClose, }: CreateNewConversationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
|
|
4
|
+
import { useNavigate } from '../../contexts/router/index.js';
|
|
5
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
6
|
+
import { useT } from '../../i18n/index.js';
|
|
7
|
+
import { useCurrentProfile } from '../layout/IdentityContext.js';
|
|
8
|
+
import { ProfilesInput } from '../profile/index.js';
|
|
9
|
+
const MAX_MESSAGE_LENGTH = 500;
|
|
10
|
+
export const CreateNewConversation = ({ profiles: initialProfiles = [], message: initialMessage = '', skipProfileSelection = false, onClose, }) => {
|
|
11
|
+
const t = useT();
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const me = useCurrentProfile();
|
|
14
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
15
|
+
const createPost = openpeepsApi.createPostAction();
|
|
16
|
+
const [step, setStep] = useState(skipProfileSelection ? 2 : 1);
|
|
17
|
+
const [selectedProfiles, setSelectedProfiles] = useState(initialProfiles);
|
|
18
|
+
const [message, setMessage] = useState(initialMessage);
|
|
19
|
+
const [submitting, setSubmitting] = useState(false);
|
|
20
|
+
const [error, setError] = useState(null);
|
|
21
|
+
const send = async () => {
|
|
22
|
+
if (!me || selectedProfiles.length === 0)
|
|
23
|
+
return;
|
|
24
|
+
setError(null);
|
|
25
|
+
setSubmitting(true);
|
|
26
|
+
try {
|
|
27
|
+
const payload = {
|
|
28
|
+
visibility: 'direct',
|
|
29
|
+
type: 'note',
|
|
30
|
+
audience: [me, ...selectedProfiles],
|
|
31
|
+
data: {
|
|
32
|
+
type: 'note',
|
|
33
|
+
content: message.trim(),
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const created = await createPost(payload);
|
|
37
|
+
onClose();
|
|
38
|
+
navigate(`/conversations/${created.id}`);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
setError(err.message);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
setSubmitting(false);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsx(DialogContent, { className: "flex max-h-[85vh] max-w-lg flex-col overflow-hidden", children: step === 1 ? (_jsxs(_Fragment, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('conversations.createNew.title', {
|
|
48
|
+
defaultValue: 'New message',
|
|
49
|
+
}) }) }), _jsx("div", { className: "min-h-0 flex-1 space-y-2 overflow-y-auto", children: _jsx(ProfilesInput, { value: selectedProfiles, onChange: setSelectedProfiles, banlist: me ? [me] : [], placeholder: t('conversations.createNew.searchPlaceholder', {
|
|
50
|
+
defaultValue: 'Search members…',
|
|
51
|
+
}), title: t('conversations.createNew.title', {
|
|
52
|
+
defaultValue: 'New message',
|
|
53
|
+
}) }) }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "variant-ghost-primary", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "variant-filled-primary", disabled: selectedProfiles.length === 0, action: () => setStep(2), children: t('common.next', { defaultValue: 'Next' }) })] })] })) : (_jsxs(_Fragment, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('conversations.createNew.sendMessage', {
|
|
54
|
+
defaultValue: 'Send message',
|
|
55
|
+
}) }) }), _jsx("textarea", { className: "bg-surface-100 min-h-32 w-full rounded-lg border p-3 text-sm outline-none", placeholder: t('conversations.createNew.messagePlaceholder', {
|
|
56
|
+
defaultValue: 'Write a message…',
|
|
57
|
+
}), value: message, maxLength: MAX_MESSAGE_LENGTH, onChange: (e) => setMessage(e.target.value) }), error ? _jsx("p", { className: "text-error text-sm", children: error }) : null, _jsxs(DialogFooter, { className: "flex-wrap gap-2", children: [!skipProfileSelection ? (_jsx(Button, { variant: "variant-ringed-surface", action: () => setStep(1), children: t('common.back', { defaultValue: 'Back' }) })) : (_jsx(Button, { variant: "variant-ringed-surface", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) })), _jsx("span", { className: "text-muted-foreground flex-1 text-right text-sm", children: MAX_MESSAGE_LENGTH - message.length }), _jsx(Button, { variant: "variant-filled-primary", disabled: submitting || selectedProfiles.length === 0, action: send, children: submitting
|
|
58
|
+
? t('common.sending', { defaultValue: 'Sending…' })
|
|
59
|
+
: t('conversations.createNew.send', {
|
|
60
|
+
defaultValue: 'Send',
|
|
61
|
+
}) })] })] })) }) }));
|
|
62
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { PublicProfile } from '@openpeepshq/common/types';
|
|
3
|
+
export interface CreateConversationOptions {
|
|
4
|
+
profiles?: PublicProfile[];
|
|
5
|
+
message?: string;
|
|
6
|
+
skipProfileSelection?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface CreateNewConversationContextValue {
|
|
9
|
+
openCreateConversation: (options?: CreateConversationOptions) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function CreateNewConversationProvider({ children, }: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function useCreateNewConversation(): CreateNewConversationContextValue;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useState, } from 'react';
|
|
3
|
+
import { CreateNewConversation } from './CreateNewConversation.js';
|
|
4
|
+
const CreateNewConversationContext = createContext(null);
|
|
5
|
+
export function CreateNewConversationProvider({ children, }) {
|
|
6
|
+
const [options, setOptions] = useState();
|
|
7
|
+
const openCreateConversation = useCallback((opts) => {
|
|
8
|
+
setOptions(opts ?? {});
|
|
9
|
+
}, []);
|
|
10
|
+
return (_jsxs(CreateNewConversationContext.Provider, { value: { openCreateConversation }, children: [children, options !== undefined ? (_jsx(CreateNewConversation, { profiles: options.profiles, message: options.message, skipProfileSelection: options.skipProfileSelection, onClose: () => setOptions(undefined) })) : null] }));
|
|
11
|
+
}
|
|
12
|
+
export function useCreateNewConversation() {
|
|
13
|
+
const ctx = useContext(CreateNewConversationContext);
|
|
14
|
+
if (!ctx) {
|
|
15
|
+
throw new Error('useCreateNewConversation must be used within CreateNewConversationProvider');
|
|
16
|
+
}
|
|
17
|
+
return ctx;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function DirectMessagesHeaderActions(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Plus } from 'lucide-react';
|
|
3
|
+
import { Button } from '@openpeepshq/react-ui';
|
|
4
|
+
import { useT } from '../../i18n/index.js';
|
|
5
|
+
import { useCreateNewConversation } from './CreateNewConversationContext.js';
|
|
6
|
+
export function DirectMessagesHeaderActions() {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const { openCreateConversation } = useCreateNewConversation();
|
|
9
|
+
return (_jsxs(Button, { variant: "variant-filled-primary", title: t('conversations.newMessage', { defaultValue: 'New message' }), action: () => openCreateConversation(), children: [_jsx(Plus, { className: "size-4" }), t('conversations.newMessage', { defaultValue: 'New message' })] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
2
|
+
export interface MessageInThreadProps {
|
|
3
|
+
previous: PublicPost | undefined;
|
|
4
|
+
message: PublicPost;
|
|
5
|
+
multipleParticipants?: boolean;
|
|
6
|
+
conversationRootId?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Translation of `@openpeepshq/svelte` `MessageInThread.svelte`: renders a single
|
|
10
|
+
* thread message together with the participant system messages (started/added/
|
|
11
|
+
* left/removed) derived from how the audience changed between posts.
|
|
12
|
+
*/
|
|
13
|
+
export declare function MessageInThread({ previous, message, multipleParticipants, conversationRootId, }: MessageInThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { profileName } from '@openpeepshq/common';
|
|
3
|
+
import { useT } from '../../i18n/index.js';
|
|
4
|
+
import { usePostViewRef } from '../../lib/postViewCounter.js';
|
|
5
|
+
import { isUnreadPostForViewer } from '../../lib/postUnread.js';
|
|
6
|
+
import { UpdatingDate } from '@openpeepshq/react-ui';
|
|
7
|
+
import { Avatar } from '../profile/index.js';
|
|
8
|
+
import { useCurrentProfile } from '../layout/IdentityContext.js';
|
|
9
|
+
import { ConversationMessageBubble } from './ConversationMessageBubble.js';
|
|
10
|
+
import { UnreadPostIndicator } from '../post/pieces/UnreadPostIndicator.js';
|
|
11
|
+
const inAudience = (post, profile) => !!post.audience?.some((p) => p.id === profile.id);
|
|
12
|
+
const audienceDiff = (previous, message) => {
|
|
13
|
+
const before = previous?.audience ?? [];
|
|
14
|
+
const after = message.audience ?? [];
|
|
15
|
+
return {
|
|
16
|
+
added: after.filter((p) => !before.some((b) => b.id === p.id)),
|
|
17
|
+
removed: before.filter((p) => !after.some((a) => a.id === p.id)),
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Translation of `@openpeepshq/svelte` `MessageInThread.svelte`: renders a single
|
|
22
|
+
* thread message together with the participant system messages (started/added/
|
|
23
|
+
* left/removed) derived from how the audience changed between posts.
|
|
24
|
+
*/
|
|
25
|
+
export function MessageInThread({ previous, message, multipleParticipants = true, conversationRootId, }) {
|
|
26
|
+
const t = useT();
|
|
27
|
+
const me = useCurrentProfile();
|
|
28
|
+
const isUnread = isUnreadPostForViewer(message, me?.id);
|
|
29
|
+
const postViewRef = usePostViewRef(message.id, {
|
|
30
|
+
conversationRootId,
|
|
31
|
+
adjustUnread: isUnread,
|
|
32
|
+
});
|
|
33
|
+
const { added, removed } = audienceDiff(previous, message);
|
|
34
|
+
const name = profileName(message.profile);
|
|
35
|
+
const isMe = message.profile.id === me?.id;
|
|
36
|
+
return (_jsxs(_Fragment, { children: [!previous && (_jsx("div", { className: "mt-2 w-full text-center text-sm", children: message.inReplyToId
|
|
37
|
+
? t('conversations.messageInThread.addedBy', { name })
|
|
38
|
+
: t('conversations.messageInThread.startedBy', { name }) })), previous &&
|
|
39
|
+
inAudience(previous, message.profile) &&
|
|
40
|
+
!inAudience(message, message.profile) && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Avatar, { profile: message.profile, size: 2.5, borderless: true, navigate: true }), t('conversations.messageInThread.left', { name })] })), previous && added.length > 0 && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex -space-x-2", children: added.map((p) => (_jsx(Avatar, { profile: p, size: 2.5, borderless: true, navigate: true }, p.id))) }), t('conversations.messageInThread.addedBy', { name })] })), removed.length > 0 && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex -space-x-2", children: removed.map((p) => (_jsx(Avatar, { profile: p, size: 2.5, borderless: true, navigate: true }, p.id))) }), t('conversations.messageInThread.removedBy', { name })] })), _jsxs("div", { ref: postViewRef, className: "flex", children: [!isMe && multipleParticipants && (_jsx(Avatar, { containerClassName: "mt-6 mr-2", profile: message.profile, navigate: true })), _jsxs("div", { className: "relative min-w-0 flex-1", children: [!isMe ? (_jsx(UnreadPostIndicator, { show: isUnread, className: "left-0 top-1/2 -translate-y-1/2" })) : null, _jsx(ConversationMessageBubble, { message: message })] })] }), _jsxs("div", { className: `mt-2 w-full text-sm ${isMe ? 'text-right' : 'text-left'}`, children: [multipleParticipants && !isMe && _jsxs("span", { children: [name, " \u00B7 "] }), _jsx(UpdatingDate, { date: message.createdAt })] })] }));
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { CreateNewConversation } from './CreateNewConversation';
|
|
2
|
+
export type { CreateNewConversationProps } from './CreateNewConversation';
|
|
3
|
+
export { CreateNewConversationProvider, useCreateNewConversation, } from './CreateNewConversationContext';
|
|
4
|
+
export type { CreateConversationOptions } from './CreateNewConversationContext';
|
|
5
|
+
export { DirectMessagesHeaderActions } from './DirectMessagesHeaderActions';
|
|
6
|
+
export { ConversationMessageBubble } from './ConversationMessageBubble';
|
|
7
|
+
export { MessageInThread } from './MessageInThread';
|
|
8
|
+
export type { MessageInThreadProps } from './MessageInThread';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CreateNewConversation } from './CreateNewConversation.js';
|
|
2
|
+
export { CreateNewConversationProvider, useCreateNewConversation, } from './CreateNewConversationContext.js';
|
|
3
|
+
export { DirectMessagesHeaderActions } from './DirectMessagesHeaderActions.js';
|
|
4
|
+
export { ConversationMessageBubble } from './ConversationMessageBubble.js';
|
|
5
|
+
export { MessageInThread } from './MessageInThread.js';
|