@openpeepshq/react 0.2.3 → 0.2.5
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/dist/components/accounts/SignUpLoginModal.js +2 -2
- package/dist/components/configuration/ConfigMenuButton.d.ts +10 -0
- package/dist/components/configuration/ConfigMenuButton.js +12 -0
- package/dist/components/configuration/ConfigurationTree.js +1 -1
- package/dist/components/configuration/index.d.ts +2 -0
- package/dist/components/configuration/index.js +1 -0
- package/dist/components/conversations/ConversationMessageBubble.d.ts +2 -1
- package/dist/components/conversations/ConversationMessageBubble.js +4 -5
- package/dist/components/conversations/CreateNewConversation.js +10 -42
- package/dist/components/conversations/DirectMessagesHeaderActions.js +1 -1
- package/dist/components/conversations/MessageInThread.js +1 -2
- package/dist/components/form/ImageEditModal.js +2 -4
- package/dist/components/form/ImageInput.js +13 -8
- package/dist/components/form/LocationInput.js +1 -1
- package/dist/components/groups/AddGroupMembersButton.d.ts +1 -1
- package/dist/components/groups/AddGroupMembersButton.js +2 -2
- package/dist/components/groups/ChangeGroupRolesModal.js +1 -1
- package/dist/components/groups/ConfirmGroupExitModal.js +2 -2
- package/dist/components/groups/ConfirmMemberRemovalModal.js +1 -1
- package/dist/components/groups/DeleteGroupModal.js +1 -1
- package/dist/components/groups/GroupAvatar.js +4 -4
- package/dist/components/groups/GroupCard.js +3 -3
- package/dist/components/groups/GroupHeader.js +1 -1
- package/dist/components/groups/GroupMembersList.js +2 -3
- package/dist/components/groups/GroupOptionsMenu.js +12 -6
- package/dist/components/groups/JoinGroupButton.js +3 -20
- package/dist/components/jams/CreateNewJam.js +4 -4
- package/dist/components/jams/JamCallParticipant.js +17 -7
- package/dist/components/jams/JamCapacityGate.js +1 -1
- package/dist/components/jams/JamChatDrawer.js +2 -2
- package/dist/components/jams/JamConference.js +1 -1
- package/dist/components/jams/JamContext.d.ts +4 -0
- package/dist/components/jams/JamContext.js +17 -2
- package/dist/components/jams/JamDetailsDrawer.js +1 -1
- package/dist/components/jams/JamDeviceSelectors.d.ts +15 -0
- package/dist/components/jams/JamDeviceSelectors.js +4 -3
- package/dist/components/jams/JamFooter.js +15 -16
- package/dist/components/jams/JamGuestForm.js +2 -2
- package/dist/components/jams/JamLobby.js +9 -19
- package/dist/components/jams/JamObserverShell.js +1 -1
- package/dist/components/jams/JamParticipantConference.js +1 -1
- package/dist/components/jams/JamPeopleDrawer.js +17 -13
- package/dist/components/jams/JamReactionMenu.js +1 -1
- package/dist/components/jams/JamRequestJoin.js +1 -1
- package/dist/components/jams/JamRoom.js +84 -4
- package/dist/components/jams/JamToolbarButton.d.ts +21 -0
- package/dist/components/jams/JamToolbarButton.js +19 -0
- package/dist/components/jams/JamVideoCall.js +8 -3
- package/dist/components/jams/JamVideoLayout.js +16 -5
- package/dist/components/jams/LeaveCloseButton.js +9 -44
- package/dist/components/jams/LiveJamsSection.js +1 -1
- package/dist/components/jams/constants.js +4 -0
- package/dist/components/jams/useParticipantConnection.d.ts +7 -0
- package/dist/components/jams/useParticipantConnection.js +11 -0
- package/dist/components/layout/Auth.js +1 -1
- package/dist/components/layout/Infos.js +2 -2
- package/dist/components/layout/OpenpeepsContextProvider.js +4 -3
- package/dist/components/layout/OpenpeepsThemeProvider.d.ts +3 -4
- package/dist/components/layout/OpenpeepsThemeProvider.js +23 -9
- package/dist/components/layout/Root.js +1 -1
- package/dist/components/markdown/CompiledMarkdown.js +15 -1
- package/dist/components/markdown/classes.d.ts +2 -0
- package/dist/components/markdown/classes.js +2 -0
- package/dist/components/markdown/index.d.ts +1 -1
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/navigation/ContentHeader.js +1 -1
- package/dist/components/navigation/FooterMobile.js +5 -1
- package/dist/components/navigation/HeaderMobile.js +1 -1
- package/dist/components/navigation/MobileMenuItem.js +1 -1
- package/dist/components/navigation/PageHeaderAction.js +1 -1
- package/dist/components/navigation/PlusButton.js +1 -1
- package/dist/components/navigation/SideBar.js +6 -1
- package/dist/components/navigation/breadcrumbs/Breadcrumbs.js +5 -1
- package/dist/components/navigation/sideBarNavLinkClass.js +1 -1
- package/dist/components/notifications/NotificationHeaderActions.js +2 -2
- package/dist/components/notifications/NotificationWrapper.js +1 -1
- package/dist/components/notifications/NotificationsList.js +3 -3
- package/dist/components/notifications/TypedNotification.js +3 -3
- package/dist/components/post/Feed.js +3 -3
- package/dist/components/post/FeedPost.d.ts +2 -1
- package/dist/components/post/FeedPost.js +11 -6
- package/dist/components/post/FeedPostContent.js +1 -1
- package/dist/components/post/FullPostLayout.js +11 -4
- package/dist/components/post/NewEventButton.js +1 -1
- package/dist/components/post/NewNoteButton.js +1 -1
- package/dist/components/post/PinnedPost.js +1 -1
- package/dist/components/post/ReplyBox.js +1 -1
- package/dist/components/post/feed/events/EventsFeed.js +3 -3
- package/dist/components/post/feed/threaded/ThreadPost.js +1 -1
- package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +3 -1
- package/dist/components/post/feed/threaded/ThreadedFeed.js +3 -3
- package/dist/components/post/pieces/Attachments.js +3 -3
- package/dist/components/post/pieces/EventMenu.js +1 -1
- package/dist/components/post/pieces/EventRsvpButton.js +3 -3
- package/dist/components/post/pieces/FeedPostStats.js +2 -2
- package/dist/components/post/pieces/GalleryModal.js +36 -5
- package/dist/components/post/pieces/PollContent.js +33 -14
- package/dist/components/post/pieces/PostActions.js +6 -45
- package/dist/components/post/pieces/PostInfoHeader.js +1 -1
- package/dist/components/post/pieces/PostMenu.js +35 -9
- package/dist/components/post/pieces/PostReactionHeader.js +1 -1
- package/dist/components/post/pieces/ShareMenu.js +4 -2
- package/dist/components/post/pieces/UnreadPostIndicator.d.ts +5 -3
- package/dist/components/post/pieces/UnreadPostIndicator.js +4 -3
- package/dist/components/post/pieces/modals/DeletePostModal.js +1 -1
- package/dist/components/post/pieces/modals/RepostModal.d.ts +5 -3
- package/dist/components/post/pieces/modals/RepostModal.js +8 -7
- package/dist/components/post/post-form/AttachmentCard.js +2 -2
- package/dist/components/post/post-form/ComposeAttachments.js +1 -1
- package/dist/components/post/post-form/DescriptionEditModal.js +1 -1
- package/dist/components/post/post-form/EditPostModal.js +22 -12
- package/dist/components/post/post-form/EventForm.js +2 -2
- package/dist/components/post/post-form/EventTypeSwitcher.js +1 -1
- package/dist/components/post/post-form/NewPostModal.d.ts +1 -1
- package/dist/components/post/post-form/NewPostModal.js +10 -10
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +2 -2
- package/dist/components/post/post-form/PollComposerFields.d.ts +2 -0
- package/dist/components/post/post-form/PollComposerFields.js +12 -8
- package/dist/components/post/post-form/PostAudienceSelector.js +3 -3
- package/dist/components/post/post-form/PostTypeSwitcher.js +1 -1
- package/dist/components/post/post-form/ReplyModal.js +9 -8
- package/dist/components/post/post-form/VisibilitySelector.js +1 -1
- package/dist/components/post/types/Article.js +2 -1
- package/dist/components/post/types/Event.js +1 -1
- package/dist/components/post/types/Note.js +2 -1
- package/dist/components/post/types/Poll.js +2 -1
- package/dist/components/post/types/event/CardEvent.js +2 -2
- package/dist/components/post/types/event/FullEvent.js +8 -8
- package/dist/components/post/types/event/ProfileEventRelationship.d.ts +1 -1
- package/dist/components/post/types/event/ProfileEventRelationship.js +38 -18
- package/dist/components/preview-link/LocalPreviewLink.js +1 -1
- package/dist/components/preview-link/RemotePreviewLink.js +5 -1
- package/dist/components/profile/Avatar.js +3 -2
- package/dist/components/profile/FollowUnfollowButton.js +2 -2
- package/dist/components/profile/ProfileBadge.js +1 -1
- package/dist/components/profile/ProfileCard.js +1 -1
- package/dist/components/profile/ProfileHeader.js +1 -1
- package/dist/components/profile/ProfilePageAction.js +3 -3
- package/dist/components/profile/ProfilePostsAndReplies.js +3 -1
- package/dist/components/profile/ProfileSelector.js +3 -3
- package/dist/components/profile/ProfilesInput.js +1 -1
- package/dist/components/profile/ReportProfileOrPostModal.js +6 -4
- package/dist/components/server-data/context.d.ts +8 -0
- package/dist/contexts/openpeeps/hooks/admin.d.ts +63 -16774
- package/dist/contexts/openpeeps/hooks/admin.js +34 -14
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +330 -0
- package/dist/contexts/openpeeps/hooks/jams.d.ts +110 -0
- package/dist/contexts/openpeeps/hooks/jams.js +1 -1
- package/dist/contexts/openpeeps/hooks/other.d.ts +8 -0
- package/dist/contexts/openpeeps/hooks/posts.d.ts +933 -53
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +220 -0
- package/dist/contexts/openpeeps/hooks/search.d.ts +330 -0
- package/dist/contexts/openpeeps/index.d.ts +1 -1
- package/dist/contexts/openpeeps/index.js +10 -2
- package/dist/contexts/router/index.d.ts +8 -3
- package/dist/contexts/router/index.js +7 -3
- package/dist/hooks/conversations/useCreateConversation.d.ts +124 -0
- package/dist/hooks/conversations/useCreateConversation.js +56 -0
- package/dist/hooks/groups/useJoinGroup.d.ts +8 -0
- package/dist/hooks/groups/useJoinGroup.js +23 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/jams/useLeaveCloseJam.d.ts +20 -0
- package/dist/hooks/jams/useLeaveCloseJam.js +59 -0
- package/dist/hooks/posts/useFeedPostActions.d.ts +18 -0
- package/dist/hooks/posts/useFeedPostActions.js +51 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/lib/Markdown.d.ts +14 -0
- package/dist/lib/Markdown.js +16 -0
- package/dist/lib/analyticsClicks.d.ts +12 -0
- package/dist/lib/analyticsClicks.js +64 -0
- package/dist/lib/auth.d.ts +8 -0
- package/dist/lib/auth.js +27 -0
- package/dist/lib/canvasUtils.d.ts +6 -0
- package/dist/lib/canvasUtils.js +62 -1
- package/dist/lib/groupCapabilityHelpers.d.ts +1 -1
- package/dist/lib/passwordStrength.d.ts +6 -0
- package/dist/lib/passwordStrength.js +26 -0
- package/dist/lib/postUnread.d.ts +7 -0
- package/dist/lib/postUnread.js +7 -0
- package/dist/lib/postViewCounter.d.ts +1 -1
- package/dist/lib/postViewCounter.js +3 -1
- package/dist/lib/routeHandles.d.ts +2 -0
- package/dist/lib/routeHandles.js +2 -0
- package/dist/lib/svgCover.d.ts +2 -0
- package/dist/lib/svgCover.js +18 -0
- package/dist/navigation/index.d.ts +11 -0
- package/dist/navigation/index.js +2 -0
- package/dist/navigation/menuItems.d.ts +8 -0
- package/dist/navigation/menuItems.js +83 -0
- package/dist/navigation/targets.d.ts +94 -0
- package/dist/navigation/targets.js +12 -0
- package/dist/pages/About.d.ts +1 -0
- package/dist/pages/About.js +19 -0
- package/dist/pages/CodeOfConduct.d.ts +1 -0
- package/dist/pages/CodeOfConduct.js +14 -0
- package/dist/pages/Explore.d.ts +1 -0
- package/dist/pages/Explore.js +132 -0
- package/dist/pages/Home.d.ts +6 -0
- package/dist/pages/Home.js +31 -0
- package/dist/pages/Members.d.ts +1 -0
- package/dist/pages/Members.js +35 -0
- package/dist/pages/NotFound.d.ts +1 -0
- package/dist/pages/NotFound.js +9 -0
- package/dist/pages/Notifications.d.ts +1 -0
- package/dist/pages/Notifications.js +8 -0
- package/dist/pages/PostDetail.d.ts +1 -0
- package/dist/pages/PostDetail.js +27 -0
- package/dist/pages/Profile.d.ts +1 -0
- package/dist/pages/Profile.js +20 -0
- package/dist/pages/Tags.d.ts +1 -0
- package/dist/pages/Tags.js +14 -0
- package/dist/pages/Welcome.d.ts +1 -0
- package/dist/pages/Welcome.js +89 -0
- package/dist/pages/admin/Analytics.d.ts +11 -0
- package/dist/pages/admin/Analytics.js +11 -0
- package/dist/pages/admin/ApiKeys.d.ts +1 -0
- package/dist/pages/admin/ApiKeys.js +141 -0
- package/dist/pages/admin/Backups.d.ts +1 -0
- package/dist/pages/admin/Backups.js +39 -0
- package/dist/pages/admin/ConfigEditor.d.ts +14 -0
- package/dist/pages/admin/ConfigEditor.js +91 -0
- package/dist/pages/admin/Configuration.d.ts +1 -0
- package/dist/pages/admin/Configuration.js +8 -0
- package/dist/pages/admin/ConfigurationCommunity.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunity.js +7 -0
- package/dist/pages/admin/ConfigurationCommunityLanguage.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunityLanguage.js +71 -0
- package/dist/pages/admin/ConfigurationEmail.d.ts +1 -0
- package/dist/pages/admin/ConfigurationEmail.js +97 -0
- package/dist/pages/admin/ConfigurationI18n.d.ts +1 -0
- package/dist/pages/admin/ConfigurationI18n.js +51 -0
- package/dist/pages/admin/Dashboard.d.ts +1 -0
- package/dist/pages/admin/Dashboard.js +40 -0
- package/dist/pages/admin/Db.d.ts +1 -0
- package/dist/pages/admin/Db.js +238 -0
- package/dist/pages/admin/Diagnostics.d.ts +1 -0
- package/dist/pages/admin/Diagnostics.js +8 -0
- package/dist/pages/admin/DiagnosticsEmail.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsEmail.js +65 -0
- package/dist/pages/admin/DiagnosticsJob.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsJob.js +51 -0
- package/dist/pages/admin/DiagnosticsLogs.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsLogs.js +62 -0
- package/dist/pages/admin/DiagnosticsPerformance.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsPerformance.js +34 -0
- package/dist/pages/admin/GroupMembers.d.ts +1 -0
- package/dist/pages/admin/GroupMembers.js +109 -0
- package/dist/pages/admin/Groups.d.ts +1 -0
- package/dist/pages/admin/Groups.js +61 -0
- package/dist/pages/admin/Invites.d.ts +1 -0
- package/dist/pages/admin/Invites.js +72 -0
- package/dist/pages/admin/Members.d.ts +1 -0
- package/dist/pages/admin/Members.js +49 -0
- package/dist/pages/admin/Moderation.d.ts +1 -0
- package/dist/pages/admin/Moderation.js +62 -0
- package/dist/pages/admin/Reports.d.ts +1 -0
- package/dist/pages/admin/Reports.js +178 -0
- package/dist/pages/admin/analytics/AnalyticsLayout.d.ts +14 -0
- package/dist/pages/admin/analytics/AnalyticsLayout.js +104 -0
- package/dist/pages/admin/analytics/AnalyticsRangeContext.d.ts +9 -0
- package/dist/pages/admin/analytics/AnalyticsRangeContext.js +9 -0
- package/dist/pages/admin/analytics/Content.d.ts +1 -0
- package/dist/pages/admin/analytics/Content.js +117 -0
- package/dist/pages/admin/analytics/Engagement.d.ts +1 -0
- package/dist/pages/admin/analytics/Engagement.js +220 -0
- package/dist/pages/admin/analytics/Groups.d.ts +1 -0
- package/dist/pages/admin/analytics/Groups.js +139 -0
- package/dist/pages/admin/analytics/Members.d.ts +1 -0
- package/dist/pages/admin/analytics/Members.js +96 -0
- package/dist/pages/admin/analytics/Overview.d.ts +1 -0
- package/dist/pages/admin/analytics/Overview.js +165 -0
- package/dist/pages/admin/analytics/ReportSettings.d.ts +1 -0
- package/dist/pages/admin/analytics/ReportSettings.js +62 -0
- package/dist/pages/admin/analytics/analyticsInfo.d.ts +3 -0
- package/dist/pages/admin/analytics/analyticsInfo.js +4 -0
- package/dist/pages/admin/analytics/downloadCsv.d.ts +2 -0
- package/dist/pages/admin/analytics/downloadCsv.js +20 -0
- package/dist/pages/admin/community/CommunityFavicons.d.ts +1 -0
- package/dist/pages/admin/community/CommunityFavicons.js +47 -0
- package/dist/pages/admin/community/CommunityInfo.d.ts +1 -0
- package/dist/pages/admin/community/CommunityInfo.js +35 -0
- package/dist/pages/admin/community/CommunityLinks.d.ts +1 -0
- package/dist/pages/admin/community/CommunityLinks.js +35 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.d.ts +8 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.js +35 -0
- package/dist/pages/admin/community/CommunityProfileFields.d.ts +1 -0
- package/dist/pages/admin/community/CommunityProfileFields.js +50 -0
- package/dist/pages/admin/community/CommunityRoles.d.ts +1 -0
- package/dist/pages/admin/community/CommunityRoles.js +109 -0
- package/dist/pages/admin/community/CommunityTheme.d.ts +1 -0
- package/dist/pages/admin/community/CommunityTheme.js +56 -0
- package/dist/pages/admin/community/useCommunityConfig.d.ts +168 -0
- package/dist/pages/admin/community/useCommunityConfig.js +28 -0
- package/dist/pages/admin/components/AdminCharts.d.ts +22 -0
- package/dist/pages/admin/components/AdminCharts.js +29 -0
- package/dist/pages/admin/components/AdminGroupCard.d.ts +6 -0
- package/dist/pages/admin/components/AdminGroupCard.js +42 -0
- package/dist/pages/admin/components/AdminInviteActions.d.ts +1 -0
- package/dist/pages/admin/components/AdminInviteActions.js +23 -0
- package/dist/pages/admin/components/InviteWithEmailModal.d.ts +3 -0
- package/dist/pages/admin/components/InviteWithEmailModal.js +82 -0
- package/dist/pages/admin/components/InviteWithLinkModal.d.ts +22 -0
- package/dist/pages/admin/components/InviteWithLinkModal.js +98 -0
- package/dist/pages/admin/components/ProfileRowActions.d.ts +5 -0
- package/dist/pages/admin/components/ProfileRowActions.js +131 -0
- package/dist/pages/admin/components/RestoreBackupModal.d.ts +4 -0
- package/dist/pages/admin/components/RestoreBackupModal.js +33 -0
- package/dist/pages/admin/components/RestoreTestBackupModal.d.ts +4 -0
- package/dist/pages/admin/components/RestoreTestBackupModal.js +36 -0
- package/dist/pages/articles/Edit.d.ts +1 -0
- package/dist/pages/articles/Edit.js +60 -0
- package/dist/pages/articles/Index.d.ts +1 -0
- package/dist/pages/articles/Index.js +18 -0
- package/dist/pages/articles/New.d.ts +1 -0
- package/dist/pages/articles/New.js +48 -0
- package/dist/pages/auth/Closed.d.ts +1 -0
- package/dist/pages/auth/Closed.js +14 -0
- package/dist/pages/auth/Login.d.ts +1 -0
- package/dist/pages/auth/Login.js +74 -0
- package/dist/pages/auth/OidcCallback.d.ts +5 -0
- package/dist/pages/auth/OidcCallback.js +31 -0
- package/dist/pages/auth/OidcPending.d.ts +5 -0
- package/dist/pages/auth/OidcPending.js +39 -0
- package/dist/pages/auth/Register.d.ts +4 -0
- package/dist/pages/auth/Register.js +124 -0
- package/dist/pages/auth/RegisterInvitation.d.ts +1 -0
- package/dist/pages/auth/RegisterInvitation.js +5 -0
- package/dist/pages/auth/RequestResetPassword.d.ts +1 -0
- package/dist/pages/auth/RequestResetPassword.js +50 -0
- package/dist/pages/auth/ResetPassword.d.ts +1 -0
- package/dist/pages/auth/ResetPassword.js +40 -0
- package/dist/pages/auth/SsoCallback.d.ts +1 -0
- package/dist/pages/auth/SsoCallback.js +34 -0
- package/dist/pages/auth/ValidateEmail.d.ts +6 -0
- package/dist/pages/auth/ValidateEmail.js +64 -0
- package/dist/pages/conversations/Index.d.ts +1 -0
- package/dist/pages/conversations/Index.js +58 -0
- package/dist/pages/conversations/Info.d.ts +1 -0
- package/dist/pages/conversations/Info.js +26 -0
- package/dist/pages/conversations/New.d.ts +1 -0
- package/dist/pages/conversations/New.js +8 -0
- package/dist/pages/conversations/Show.d.ts +1 -0
- package/dist/pages/conversations/Show.js +100 -0
- package/dist/pages/events/Edit.d.ts +1 -0
- package/dist/pages/events/Edit.js +69 -0
- package/dist/pages/events/Index.d.ts +1 -0
- package/dist/pages/events/Index.js +23 -0
- package/dist/pages/events/My.d.ts +1 -0
- package/dist/pages/events/My.js +24 -0
- package/dist/pages/events/New.d.ts +1 -0
- package/dist/pages/events/New.js +66 -0
- package/dist/pages/feeds/Bookmarks.d.ts +1 -0
- package/dist/pages/feeds/Bookmarks.js +10 -0
- package/dist/pages/feeds/Local.d.ts +1 -0
- package/dist/pages/feeds/Local.js +14 -0
- package/dist/pages/feeds/My.d.ts +1 -0
- package/dist/pages/feeds/My.js +12 -0
- package/dist/pages/groups/Edit.d.ts +1 -0
- package/dist/pages/groups/Edit.js +57 -0
- package/dist/pages/groups/Index.d.ts +1 -0
- package/dist/pages/groups/Index.js +50 -0
- package/dist/pages/groups/Info.d.ts +1 -0
- package/dist/pages/groups/Info.js +21 -0
- package/dist/pages/groups/Members.d.ts +1 -0
- package/dist/pages/groups/Members.js +28 -0
- package/dist/pages/groups/New.d.ts +1 -0
- package/dist/pages/groups/New.js +68 -0
- package/dist/pages/groups/Show.d.ts +1 -0
- package/dist/pages/groups/Show.js +64 -0
- package/dist/pages/index.d.ts +94 -0
- package/dist/pages/index.js +94 -0
- package/dist/pages/jams/Event.d.ts +8 -0
- package/dist/pages/jams/Event.js +57 -0
- package/dist/pages/jams/Index.d.ts +6 -0
- package/dist/pages/jams/Index.js +44 -0
- package/dist/pages/payment/Success.d.ts +1 -0
- package/dist/pages/payment/Success.js +30 -0
- package/dist/pages/plugins/Index.d.ts +1 -0
- package/dist/pages/plugins/Index.js +69 -0
- package/dist/pages/profile/Followers.d.ts +6 -0
- package/dist/pages/profile/Followers.js +28 -0
- package/dist/pages/settings/AccessTokens.d.ts +1 -0
- package/dist/pages/settings/AccessTokens.js +149 -0
- package/dist/pages/settings/Account.d.ts +1 -0
- package/dist/pages/settings/Account.js +81 -0
- package/dist/pages/settings/Billing.d.ts +1 -0
- package/dist/pages/settings/Billing.js +82 -0
- package/dist/pages/settings/Index.d.ts +1 -0
- package/dist/pages/settings/Index.js +13 -0
- package/dist/pages/settings/Language.d.ts +1 -0
- package/dist/pages/settings/Language.js +54 -0
- package/dist/pages/settings/NotificationPreferences.d.ts +1 -0
- package/dist/pages/settings/NotificationPreferences.js +180 -0
- package/dist/pages/settings/Notifications.d.ts +1 -0
- package/dist/pages/settings/Notifications.js +10 -0
- package/dist/pages/settings/PublicProfile.d.ts +1 -0
- package/dist/pages/settings/PublicProfile.js +135 -0
- package/dist/pages/settings/PushEnabledDevices.d.ts +1 -0
- package/dist/pages/settings/PushEnabledDevices.js +67 -0
- package/dist/pages/settings/Theme.d.ts +1 -0
- package/dist/pages/settings/Theme.js +37 -0
- package/dist/pages/test/Error.d.ts +1 -0
- package/dist/pages/test/Error.js +10 -0
- package/dist/pages/test/Markdown.d.ts +1 -0
- package/dist/pages/test/Markdown.js +32 -0
- package/dist/pwa/InstallPrompt.js +1 -1
- package/dist/pwa/NotificationPermissionPrompt.js +2 -2
- package/dist/pwa/UpdatePrompt.js +1 -1
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js +1 -0
- package/dist/session/useSessionEvents.d.ts +3 -0
- package/dist/session/useSessionEvents.js +64 -0
- package/dist/stores/newPosts.d.ts +8 -8
- package/package.json +14 -9
- package/dist/components/jams/useJamLiveKitTheme.d.ts +0 -3
- package/dist/components/jams/useJamLiveKitTheme.js +0 -10
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Link as RouterLink, useNavigate, useSearchParams, } from 'react-router-dom';
|
|
4
|
+
import { Eye, EyeOff } from 'lucide-react';
|
|
5
|
+
import { useForm } from 'react-hook-form';
|
|
6
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
7
|
+
import { registerRequestSchema, } from '@openpeepshq/common/types';
|
|
8
|
+
import { Button, Form, FormControl, FormField, FormItem, FormLabel, FormMessage, Input, Link, Toast, } from '@openpeepshq/react-ui';
|
|
9
|
+
import { useT, useOpenpeeps, useCredentialsStore } from '../../index.js';
|
|
10
|
+
import { AuthLayout, useServerInfo, useToast } from '../../components/index.js';
|
|
11
|
+
import { performRegister } from '../../lib/auth.js';
|
|
12
|
+
import { calculatePasswordStrength, getStrengthMessage, } from '../../lib/passwordStrength.js';
|
|
13
|
+
const buildRegisterFormSchema = (t) => registerRequestSchema
|
|
14
|
+
.refine((d) => d.password === d.confirmPassword, {
|
|
15
|
+
message: t('auth.register.passwordsDoNotMatch', {
|
|
16
|
+
defaultValue: 'Passwords do not match',
|
|
17
|
+
}),
|
|
18
|
+
path: ['confirmPassword'],
|
|
19
|
+
})
|
|
20
|
+
.refine((d) => d.privacyPolicyAccepted, {
|
|
21
|
+
message: t('auth.register.mustAgreePrivacyPolicy', {
|
|
22
|
+
defaultValue: 'You must agree to the privacy policy',
|
|
23
|
+
}),
|
|
24
|
+
path: ['privacyPolicyAccepted'],
|
|
25
|
+
});
|
|
26
|
+
export function Register({ invite = false }) {
|
|
27
|
+
const t = useT();
|
|
28
|
+
const navigate = useNavigate();
|
|
29
|
+
const [searchParams] = useSearchParams();
|
|
30
|
+
const { client, openpeepsApi } = useOpenpeeps();
|
|
31
|
+
const createCheckout = openpeepsApi.createCheckoutAction();
|
|
32
|
+
const { credentialsStore } = useCredentialsStore();
|
|
33
|
+
const serverInfo = useServerInfo();
|
|
34
|
+
const { success, error: toastError } = useToast();
|
|
35
|
+
const registerFormSchema = useMemo(() => buildRegisterFormSchema(t), [t]);
|
|
36
|
+
const paymentParam = searchParams.get('payment');
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (paymentParam === 'success') {
|
|
39
|
+
success(t('payment.success.message', {
|
|
40
|
+
defaultValue: 'Payment received. Redirecting…',
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
else if (paymentParam === 'cancel') {
|
|
44
|
+
toastError(t('payment.cancelled', { defaultValue: 'Checkout was cancelled.' }));
|
|
45
|
+
}
|
|
46
|
+
}, [paymentParam, success, toastError, t]);
|
|
47
|
+
const form = useForm({
|
|
48
|
+
resolver: zodResolver(registerFormSchema),
|
|
49
|
+
defaultValues: {
|
|
50
|
+
email: '',
|
|
51
|
+
handle: '',
|
|
52
|
+
displayName: '',
|
|
53
|
+
password: '',
|
|
54
|
+
privacyPolicyAccepted: false,
|
|
55
|
+
confirmPassword: '',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
59
|
+
const [error, setError] = useState(null);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const inviteCode = searchParams.get('inviteCode');
|
|
62
|
+
if (inviteCode)
|
|
63
|
+
form.setValue('inviteCode', inviteCode);
|
|
64
|
+
}, [searchParams, form]);
|
|
65
|
+
// Invited sign-ups stay open even when public registration is closed.
|
|
66
|
+
const registrationOpen = serverInfo.communityConfig?.settings?.openRegistrations;
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!invite && registrationOpen === false) {
|
|
69
|
+
navigate('/auth/closed', { replace: true });
|
|
70
|
+
}
|
|
71
|
+
}, [invite, registrationOpen, navigate]);
|
|
72
|
+
const privacyPolicyLink = serverInfo.communityConfig?.info?.privacyPolicy || '/docs/privacy';
|
|
73
|
+
const stripeMembershipEnabled = !!serverInfo.payments?.stripe?.paidMembership?.enabled;
|
|
74
|
+
const password = form.watch('password');
|
|
75
|
+
const confirmPassword = form.watch('confirmPassword');
|
|
76
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
77
|
+
setError(null);
|
|
78
|
+
try {
|
|
79
|
+
await performRegister(client, credentialsStore, data);
|
|
80
|
+
if (stripeMembershipEnabled) {
|
|
81
|
+
const checkout = await createCheckout();
|
|
82
|
+
if (checkout.url) {
|
|
83
|
+
window.location.href = checkout.url;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
navigate('/welcome');
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
setError(t(err.message));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return (_jsxs(AuthLayout, { navigate: (url) => void navigate(url), hasPayment: !!paymentParam, children: [_jsx(Form, { ...form, children: _jsxs("form", { className: "flex flex-col gap-3", onSubmit: onSubmit, children: [_jsx("h2", { className: "text-xl", children: t('auth.register.createAccount', {
|
|
94
|
+
defaultValue: 'Create account',
|
|
95
|
+
}) }), invite && (_jsx("p", { className: "my-2", children: t('auth.register.inviteMessage', {
|
|
96
|
+
communityName: serverInfo.communityConfig?.info?.name,
|
|
97
|
+
defaultValue: "You've been invited to join {{communityName}}, enter details below to be a part of the community.",
|
|
98
|
+
}) })), _jsx(FormField, { control: form.control, name: "handle", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('auth.register.handle', { defaultValue: 'Handle' }) }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", placeholder: t('auth.register.handlePlaceholder', {
|
|
99
|
+
defaultValue: 'Handle',
|
|
100
|
+
}), "data-testid": "auth-register-handle" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "displayName", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('auth.register.name', { defaultValue: 'Name' }) }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "text", placeholder: t('auth.register.namePlaceholder', {
|
|
101
|
+
defaultValue: 'Name',
|
|
102
|
+
}), "data-testid": "auth-register-name" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "email", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('auth.register.email', { defaultValue: 'Email' }) }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "email", placeholder: t('auth.register.emailPlaceholder', {
|
|
103
|
+
defaultValue: 'you@email.org',
|
|
104
|
+
}), "data-testid": "auth-register-email" }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "password", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('auth.register.password', { defaultValue: 'Password' }) }), _jsx(FormControl, { children: _jsxs("div", { className: "relative", children: [_jsx(Input, { ...field, type: showPassword ? 'text' : 'password', "data-testid": "auth-register-password", className: "pr-10" }), _jsx("button", { type: "button", onClick: () => setShowPassword((v) => !v), "aria-label": showPassword
|
|
105
|
+
? t('auth.register.hidePassword', {
|
|
106
|
+
defaultValue: 'Hide password',
|
|
107
|
+
})
|
|
108
|
+
: t('auth.register.showPassword', {
|
|
109
|
+
defaultValue: 'Show password',
|
|
110
|
+
}), className: "absolute right-2 top-1/2 -translate-y-1/2", children: showPassword ? _jsx(EyeOff, { size: 20 }) : _jsx(Eye, { size: 20 }) })] }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "confirmPassword", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('auth.register.confirmPassword', {
|
|
111
|
+
defaultValue: 'Confirm Password',
|
|
112
|
+
}) }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "password", "data-testid": "auth-register-confirm-password" }) }), _jsx(FormMessage, { "data-testid": "auth-register-confirm-password-error" })] })) }), (password ?? '').length > 0 &&
|
|
113
|
+
(confirmPassword ?? '').length === 0 && (_jsx("div", { className: "bg-surface border-border flex w-full justify-center rounded py-2", children: _jsx("p", { children: getStrengthMessage(calculatePasswordStrength(password)) }) })), _jsx(FormField, { control: form.control, name: "privacyPolicyAccepted", render: ({ field }) => (_jsxs(FormItem, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FormControl, { children: _jsx(Input, { type: "checkbox", checked: field.value, onChange: (e) => field.onChange(e.target.checked), "data-testid": "auth-register-privacy-checkbox" }) }), _jsxs("p", { children: [t('auth.register.privacyPolicyAgreement', {
|
|
114
|
+
defaultValue: 'I have read and agree to the',
|
|
115
|
+
}), ' ', _jsx("a", { href: privacyPolicyLink, target: "_blank", rel: "noopener noreferrer", className: "anchor text-sm", children: t('auth.register.privacyPolicy', {
|
|
116
|
+
defaultValue: 'Privacy Policy',
|
|
117
|
+
}) })] })] }), _jsx(FormMessage, { "data-testid": "auth-register-privacy-error" })] })) }), error && (_jsx(Toast, { variant: "error", testId: "auth-register-error", onDismiss: () => setError(null), children: error })), _jsx(Button, { type: "submit", variant: "default", title: t('auth.register.signUp', { defaultValue: 'Sign Up' }), loading: form.formState.isSubmitting, "data-testid": "auth-register-submit", children: t('auth.register.signUp', { defaultValue: 'Sign Up' }) })] }) }), serverInfo.publicContent ? (_jsxs("div", { className: "flex justify-between pt-1", children: [_jsxs("span", { children: [t('auth.register.alreadyHaveAccount', {
|
|
118
|
+
defaultValue: 'Already have an account?',
|
|
119
|
+
}), ' ', _jsx(Link, { action: "/auth/login", className: "text-sm", children: t('auth.register.signIn', { defaultValue: 'Sign In' }) })] }), _jsx(RouterLink, { to: "/feeds/local", className: "op-anchor text-sm", children: t('auth.register.seeCommunityFeed', {
|
|
120
|
+
defaultValue: 'See community feed',
|
|
121
|
+
}) })] })) : (_jsx("div", { className: "flex justify-center pt-1", children: _jsxs("span", { children: [t('auth.register.alreadyHaveAccount', {
|
|
122
|
+
defaultValue: 'Already have an account?',
|
|
123
|
+
}), ' ', _jsx(Link, { action: "/auth/login", className: "text-sm", children: t('auth.register.signIn', { defaultValue: 'Sign In' }) })] }) }))] }));
|
|
124
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function RegisterInvitation(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function RequestResetPassword(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { Button, Input, Label, Toast } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useT, useOpenpeeps } from '../../index.js';
|
|
6
|
+
import { AuthLayout } from '../../components/index.js';
|
|
7
|
+
import { performRequestResetPassword } from '../../lib/auth.js';
|
|
8
|
+
export function RequestResetPassword() {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const navigate = useNavigate();
|
|
11
|
+
const { client } = useOpenpeeps();
|
|
12
|
+
const [email, setEmail] = useState('');
|
|
13
|
+
const [prompt, setPrompt] = useState(t('auth.requestResetPassword.prompt', {
|
|
14
|
+
defaultValue: 'Enter your email address and we will send you a link to reset your password.',
|
|
15
|
+
}));
|
|
16
|
+
const [error, setError] = useState(null);
|
|
17
|
+
const [notice, setNotice] = useState(null);
|
|
18
|
+
const handleSubmit = async () => {
|
|
19
|
+
setError(null);
|
|
20
|
+
setNotice(null);
|
|
21
|
+
try {
|
|
22
|
+
await performRequestResetPassword(client, { email });
|
|
23
|
+
setPrompt(t('auth.requestResetPassword.successPrompt', {
|
|
24
|
+
defaultValue: "If your email belongs to an account in this community, you'll receive a message with a link where you can change your password.",
|
|
25
|
+
}));
|
|
26
|
+
setNotice(t('auth.requestResetPassword.successToast', {
|
|
27
|
+
defaultValue: 'Reset password link has been sent to {{email}} successfully.',
|
|
28
|
+
email,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
setError(err.message ||
|
|
33
|
+
t('auth.requestResetPassword.errorFallback', {
|
|
34
|
+
defaultValue: 'Failed to send reset password link, wrong email',
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return (_jsx(AuthLayout, { navigate: (url) => void navigate(url), children: _jsxs("form", { className: "text-token flex h-fit flex-col gap-6", onSubmit: (e) => {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
void handleSubmit();
|
|
41
|
+
}, children: [_jsx("h2", { className: "text-xl", "data-testid": "auth-request-reset-heading", children: t('auth.requestResetPassword.heading', {
|
|
42
|
+
defaultValue: 'Request Password Reset',
|
|
43
|
+
}) }), _jsx("p", { className: "pt-4", children: prompt }), _jsx(Label, { title: t('auth.requestResetPassword.email', {
|
|
44
|
+
defaultValue: 'Email',
|
|
45
|
+
}), children: _jsx(Input, { type: "email", "data-testid": "auth-request-reset-email", value: email, onChange: (e) => setEmail(e.target.value), required: true, placeholder: t('auth.requestResetPassword.emailPlaceholder', {
|
|
46
|
+
defaultValue: 'you@email.org',
|
|
47
|
+
}) }) }), error && (_jsx("p", { className: "text-error border-error/40 rounded-md border p-2 text-sm", children: error })), notice && (_jsx(Toast, { variant: "success", testId: "auth-request-reset-success", onDismiss: () => setNotice(null), children: notice })), _jsx(Button, { title: t('auth.requestResetPassword.title', {
|
|
48
|
+
defaultValue: 'Request Password Reset',
|
|
49
|
+
}), action: handleSubmit, variant: "default", className: "w-full", "data-testid": "auth-request-reset-submit", children: t('auth.requestResetPassword.proceed', { defaultValue: 'Proceed' }) })] }) }));
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ResetPassword(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { Button, Input, Label, Toast } from '@openpeepshq/react-ui';
|
|
5
|
+
import { useT, useOpenpeeps } from '../../index.js';
|
|
6
|
+
import { AuthLayout } from '../../components/index.js';
|
|
7
|
+
import { performResetPassword } from '../../lib/auth.js';
|
|
8
|
+
export function ResetPassword() {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const navigate = useNavigate();
|
|
11
|
+
const { client } = useOpenpeeps();
|
|
12
|
+
const [password, setPassword] = useState('');
|
|
13
|
+
const [confirmPassword, setConfirmPassword] = useState('');
|
|
14
|
+
const [token, setToken] = useState('');
|
|
15
|
+
const [error, setError] = useState(null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
// Token arrives as `#token=...` in the URL hash.
|
|
18
|
+
setToken(window.location.hash.replace(/^#token=/, ''));
|
|
19
|
+
}, []);
|
|
20
|
+
const handleSubmit = async () => {
|
|
21
|
+
setError(null);
|
|
22
|
+
try {
|
|
23
|
+
await performResetPassword(client, { password }, token);
|
|
24
|
+
navigate('/auth/login');
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
setError(err.message);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(AuthLayout, { navigate: (url) => void navigate(url), children: _jsxs("form", { className: "text-token flex h-fit flex-col gap-6", onSubmit: (e) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
void handleSubmit();
|
|
33
|
+
}, children: [_jsx("h2", { className: "text-xl", children: t('auth.resetPassword.heading', { defaultValue: 'Reset Password' }) }), _jsx(Label, { title: t('auth.resetPassword.newPassword', {
|
|
34
|
+
defaultValue: 'New Password',
|
|
35
|
+
}), children: _jsx(Input, { value: password, onChange: (e) => setPassword(e.target.value), required: true, type: "password" }) }), _jsx(Label, { title: t('auth.resetPassword.confirmPassword', {
|
|
36
|
+
defaultValue: 'Confirm Password',
|
|
37
|
+
}), children: _jsx(Input, { value: confirmPassword, onChange: (e) => setConfirmPassword(e.target.value), required: true, type: "password" }) }), error && (_jsx(Toast, { variant: "error", onDismiss: () => setError(null), children: error })), _jsx(Button, { title: t('auth.resetPassword.heading', {
|
|
38
|
+
defaultValue: 'Reset Password',
|
|
39
|
+
}), disabled: confirmPassword !== password || password.length === 0, variant: "default", action: handleSubmit, className: "w-full", children: t('auth.resetPassword.submitButton', { defaultValue: 'Submit' }) })] }) }));
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SsoCallback(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { useCredentialsStore, useOpenpeeps, useT } from '../../index.js';
|
|
5
|
+
export function SsoCallback() {
|
|
6
|
+
const t = useT();
|
|
7
|
+
const navigate = useNavigate();
|
|
8
|
+
const { client } = useOpenpeeps();
|
|
9
|
+
const { credentialsStore } = useCredentialsStore();
|
|
10
|
+
const [error, setError] = useState(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const fragmentParams = Object.fromEntries(new URLSearchParams(location.hash.replace(/^#/, '')).entries());
|
|
13
|
+
const queryParams = Object.fromEntries(new URLSearchParams(location.search).entries());
|
|
14
|
+
const data = { ...queryParams, ...fragmentParams };
|
|
15
|
+
client.sso.generic
|
|
16
|
+
.authenticate({ data })
|
|
17
|
+
.then(async (res) => {
|
|
18
|
+
if ('data' in res) {
|
|
19
|
+
await credentialsStore.set({ token: res.data.token });
|
|
20
|
+
navigate('/feeds/local');
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
setError(res.error?.error ?? 'Authentication failed');
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
.catch((err) => {
|
|
27
|
+
setError(err.message);
|
|
28
|
+
});
|
|
29
|
+
}, [client, credentialsStore, navigate]);
|
|
30
|
+
if (error) {
|
|
31
|
+
return (_jsx("div", { className: "flex min-h-screen items-center justify-center p-4 text-center", children: _jsxs("h1", { className: "text-error text-2xl font-semibold", children: [t('common.error', { defaultValue: 'Error' }), ": ", error] }) }));
|
|
32
|
+
}
|
|
33
|
+
return (_jsx("div", { className: "flex min-h-screen items-center justify-center p-4 text-center", children: _jsx("h1", { className: "text-2xl font-semibold", children: t('auth.sso.signingIn', { defaultValue: 'Signing you in…' }) }) }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPA handler for the `/auth/validate-email?token=...` email link. Calls the
|
|
3
|
+
* backend validation endpoint and, on success, sends the user home with a
|
|
4
|
+
* confirmation toast.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ValidateEmail(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useNavigate, useSearchParams } from 'react-router-dom';
|
|
4
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
5
|
+
import { useT, useOpenpeeps } from '../../index.js';
|
|
6
|
+
import { AuthLayout, useToast } from '../../components/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* SPA handler for the `/auth/validate-email?token=...` email link. Calls the
|
|
9
|
+
* backend validation endpoint and, on success, sends the user home with a
|
|
10
|
+
* confirmation toast.
|
|
11
|
+
*/
|
|
12
|
+
export function ValidateEmail() {
|
|
13
|
+
const t = useT();
|
|
14
|
+
const navigate = useNavigate();
|
|
15
|
+
const [searchParams] = useSearchParams();
|
|
16
|
+
const { success, error: toastError } = useToast();
|
|
17
|
+
const { client } = useOpenpeeps();
|
|
18
|
+
const queryClient = useQueryClient();
|
|
19
|
+
const [failed, setFailed] = useState(false);
|
|
20
|
+
const ranRef = useRef(false);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (ranRef.current)
|
|
23
|
+
return;
|
|
24
|
+
ranRef.current = true;
|
|
25
|
+
const fail = () => {
|
|
26
|
+
setFailed(true);
|
|
27
|
+
toastError(t('auth.emails.validation.error', {
|
|
28
|
+
defaultValue: 'This verification link is invalid or has expired.',
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
const token = searchParams.get('token');
|
|
32
|
+
if (!token) {
|
|
33
|
+
fail();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
void (async () => {
|
|
37
|
+
try {
|
|
38
|
+
const result = await client.auth.validateEmail({
|
|
39
|
+
queryParameters: { token },
|
|
40
|
+
});
|
|
41
|
+
if ('error' in result)
|
|
42
|
+
throw new Error('validation failed');
|
|
43
|
+
await queryClient.invalidateQueries({ queryKey: ['accounts'] });
|
|
44
|
+
await queryClient.invalidateQueries({
|
|
45
|
+
queryKey: ['profiles', 'current'],
|
|
46
|
+
});
|
|
47
|
+
success(t('auth.emails.validation.success', {
|
|
48
|
+
defaultValue: 'Your email is now verified. You may fully participate in the community.',
|
|
49
|
+
}));
|
|
50
|
+
navigate('/');
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
fail();
|
|
54
|
+
}
|
|
55
|
+
})();
|
|
56
|
+
}, [searchParams, navigate, success, toastError, t, client, queryClient]);
|
|
57
|
+
return (_jsx(AuthLayout, { navigate: (url) => void navigate(url), noRedirect: true, children: _jsx("div", { className: "text-token variant-glass flex h-fit flex-col items-center justify-center space-y-4 p-4 md:w-96", children: failed ? (_jsxs(_Fragment, { children: [_jsx("h2", { className: "text-lg font-bold", children: t('auth.emails.validation.errorHeading', {
|
|
58
|
+
defaultValue: 'Verification failed',
|
|
59
|
+
}) }), _jsx("p", { className: "text-center", children: t('auth.emails.validation.error', {
|
|
60
|
+
defaultValue: 'This verification link is invalid or has expired.',
|
|
61
|
+
}) })] })) : (_jsx("p", { className: "text-center", children: t('auth.emails.validation.loading', {
|
|
62
|
+
defaultValue: 'Verifying your email…',
|
|
63
|
+
}) })) }) }));
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ConversationsIndex(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { MessageCircleOff, Calendar, MessageSquarePlus } from 'lucide-react';
|
|
4
|
+
import { canCreatePost, truncateText } from '@openpeepshq/common';
|
|
5
|
+
import { useT, useOpenpeeps, useSetPlusButtonActions, useSetPageHeader, } from '../../index.js';
|
|
6
|
+
import { Avatar, PostMarkdown, useAuthData, useCurrentProfile, useCreateNewConversation, AccessDeniedLoader, } from '../../components/index.js';
|
|
7
|
+
import { UpdatingDate } from '@openpeepshq/react-ui';
|
|
8
|
+
function ChatPreview({ conversation, unreadCount = 0, }) {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const me = useCurrentProfile();
|
|
11
|
+
const lastMessage = conversation[conversation.length - 1];
|
|
12
|
+
if (!lastMessage)
|
|
13
|
+
return null;
|
|
14
|
+
const participants = lastMessage.audience ?? [];
|
|
15
|
+
const otherNames = participants
|
|
16
|
+
.filter((p) => p.id !== me?.id)
|
|
17
|
+
.map((p) => p.displayName || `@${p.handle}`)
|
|
18
|
+
.join(', ');
|
|
19
|
+
const title = otherNames
|
|
20
|
+
? t('conversations.titleWithYou', {
|
|
21
|
+
defaultValue: '{{names}} and You',
|
|
22
|
+
names: otherNames,
|
|
23
|
+
})
|
|
24
|
+
: t('common.you', { defaultValue: 'You' });
|
|
25
|
+
return (_jsxs("article", { className: "flex w-full flex-col gap-x-1 border-b p-3 text-left sm:p-4", children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx("div", { className: "flex -space-x-2", children: participants.slice(0, 3).map((p) => (_jsx(Avatar, { profile: p, size: 2.5, borderless: true }, p.id))) }), _jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx("span", { className: "truncate font-bold", children: truncateText(title, 20) }), unreadCount > 0 ? (_jsx("span", { className: "bg-destructive text-destructive-foreground flex size-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1 text-xs font-semibold", "aria-label": `${unreadCount} unread messages`, children: unreadCount > 99 ? '99+' : unreadCount })) : null] })] }), _jsx("span", { className: "text-muted-foreground text-sm", children: _jsx(UpdatingDate, { date: lastMessage.createdAt }) }), _jsxs("div", { className: "mt-2 flex flex-row items-start gap-x-2 overflow-hidden text-sm", children: [_jsxs("div", { className: "flex flex-row items-center", children: [_jsx("span", { children: "~" }), me?.id === lastMessage.profile.id ? (_jsx("span", { className: "ml-1", children: "Me" })) : (_jsxs("span", { className: "ml-1", children: ["@", truncateText(lastMessage.profile.handle, 8)] })), _jsx("span", { className: "mx-1", children: ":" })] }), lastMessage.data?.type === 'event' ? (_jsxs(_Fragment, { children: [_jsx(Calendar, { className: "size-4" }), lastMessage.data.name] })) : (_jsx(PostMarkdown, { source: lastMessage.data.content || '' }))] })] }));
|
|
26
|
+
}
|
|
27
|
+
export function ConversationsIndex() {
|
|
28
|
+
const t = useT();
|
|
29
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
30
|
+
const { openCreateConversation } = useCreateNewConversation();
|
|
31
|
+
const authData = useAuthData();
|
|
32
|
+
const query = openpeepsApi.useConversations();
|
|
33
|
+
const unseenCountsQuery = openpeepsApi.useUnseenPostCounts();
|
|
34
|
+
const unseenByConversation = unseenCountsQuery.data?.direct ?? {};
|
|
35
|
+
const canCreate = canCreatePost(authData, 'note', 'direct');
|
|
36
|
+
const plusButton = useMemo(() => canCreate
|
|
37
|
+
? {
|
|
38
|
+
title: t('conversations.newMessage', {
|
|
39
|
+
defaultValue: 'New message',
|
|
40
|
+
}),
|
|
41
|
+
icon: MessageSquarePlus,
|
|
42
|
+
action: () => openCreateConversation(),
|
|
43
|
+
}
|
|
44
|
+
: undefined, [canCreate, t, openCreateConversation]);
|
|
45
|
+
useSetPlusButtonActions(plusButton);
|
|
46
|
+
useSetPageHeader(t('navigation.messages', { defaultValue: 'Messages' }), undefined, 'conversations-page-heading');
|
|
47
|
+
const conversations = query.data ?? [];
|
|
48
|
+
return (_jsx(AccessDeniedLoader, { queries: [query], children: conversations.length === 0 ? (_jsxs("div", { className: "flex h-[80vh] items-center justify-center gap-2", children: [_jsx(MessageCircleOff, { size: 40 }), _jsx("p", { className: "text-gray-500", children: t('conversations.empty', {
|
|
49
|
+
defaultValue: 'No direct messages here',
|
|
50
|
+
}) })] })) : (_jsx("div", { children: conversations.map((conversation) => {
|
|
51
|
+
const first = conversation[0];
|
|
52
|
+
if (!first)
|
|
53
|
+
return null;
|
|
54
|
+
return (_jsx("a", { href: `/conversations/${first.id}`, className: "hover:bg-surface block text-left transition-all", title: t('conversations.open', {
|
|
55
|
+
defaultValue: 'Open conversation',
|
|
56
|
+
}), children: _jsx(ChatPreview, { conversation: conversation, unreadCount: unseenByConversation[first.id] ?? 0 }) }, first.id));
|
|
57
|
+
}) })) }));
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ConversationInfo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useParams } from 'react-router-dom';
|
|
3
|
+
import { useT, useOpenpeeps } from '../../index.js';
|
|
4
|
+
import { Avatar, useCurrentProfile } from '../../components/index.js';
|
|
5
|
+
import { LoadingSpinner } from '@openpeepshq/react-ui';
|
|
6
|
+
export function ConversationInfo() {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const { id = '' } = useParams();
|
|
9
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
10
|
+
const me = useCurrentProfile();
|
|
11
|
+
const conversationQuery = openpeepsApi.useConversation(id);
|
|
12
|
+
const messages = conversationQuery.data ?? [];
|
|
13
|
+
const lastMessage = messages[messages.length - 1];
|
|
14
|
+
const participants = lastMessage?.audience?.filter((a) => a.id !== me?.id) ?? [];
|
|
15
|
+
if (conversationQuery.isLoading) {
|
|
16
|
+
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
17
|
+
}
|
|
18
|
+
return (_jsxs("div", { className: "relative", children: [_jsx("div", { className: "flex w-full items-center justify-between border-b p-5", children: _jsx("h1", { className: "text-lg font-medium", children: t('conversations.info.title', {
|
|
19
|
+
defaultValue: 'Conversation info',
|
|
20
|
+
}) }) }), _jsxs("section", { className: "border-b p-5", children: [_jsx("h2", { className: "mb-3 text-sm font-semibold", children: t('conversations.info.participants', {
|
|
21
|
+
defaultValue: 'Participants',
|
|
22
|
+
}) }), _jsx("ul", { className: "space-y-2", children: participants.map((profile) => (_jsxs("li", { className: "flex items-center gap-3", children: [_jsx(Avatar, { profile: profile, size: 2.25 }), _jsxs("a", { className: "hover:underline", href: `/@${profile.handle}`, children: [_jsx("p", { className: "font-medium", children: profile.displayName || `@${profile.handle}` }), _jsxs("p", { className: "text-muted-foreground text-xs", children: ["@", profile.handle] })] })] }, profile.id))) })] }), _jsx("section", { className: "text-muted-foreground border-b p-5 text-sm", children: _jsx("p", { children: t('conversations.info.messageCount', {
|
|
23
|
+
defaultValue: `${messages.length} messages in this conversation.`,
|
|
24
|
+
count: messages.length,
|
|
25
|
+
}) }) })] }));
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function NewConversation(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useNavigate, useSearchParams } from 'react-router-dom';
|
|
3
|
+
import { CreateNewConversation } from '../../components/index.js';
|
|
4
|
+
export function NewConversation() {
|
|
5
|
+
const navigate = useNavigate();
|
|
6
|
+
const [searchParams] = useSearchParams();
|
|
7
|
+
return (_jsx(CreateNewConversation, { message: searchParams.get('message') ?? '', onClose: () => navigate('/conversations') }));
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ConversationShow(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useParams } from 'react-router-dom';
|
|
4
|
+
import { useT, useOpenpeeps, useSetPageHeader, usePostViewFlush, adjustUnseenCounts, } from '../../index.js';
|
|
5
|
+
import { canCreatePost } from '@openpeepshq/common';
|
|
6
|
+
import { Avatar, MessageInThread, ProfileCard, useAuthData, useCurrentProfile, useToast, } from '../../components/index.js';
|
|
7
|
+
import { Button, Input, LoadingSpinner } from '@openpeepshq/react-ui';
|
|
8
|
+
const MAX_LENGTH = 500;
|
|
9
|
+
export function ConversationShow() {
|
|
10
|
+
const t = useT();
|
|
11
|
+
const { id = '' } = useParams();
|
|
12
|
+
const { openpeepsApi, queryClient, client } = useOpenpeeps();
|
|
13
|
+
const me = useCurrentProfile();
|
|
14
|
+
const authData = useAuthData();
|
|
15
|
+
const toast = useToast();
|
|
16
|
+
const canCreate = canCreatePost(authData, 'note', 'direct');
|
|
17
|
+
const endRef = useRef(null);
|
|
18
|
+
const conversationQuery = openpeepsApi.useConversation(id);
|
|
19
|
+
const createMessage = openpeepsApi.createConversationPostAction({ id });
|
|
20
|
+
const markPostsSeen = openpeepsApi.markPostsSeenAction();
|
|
21
|
+
const flushPostViews = usePostViewFlush();
|
|
22
|
+
const messages = conversationQuery.data ?? [];
|
|
23
|
+
const lastMessage = messages[messages.length - 1];
|
|
24
|
+
const participants = lastMessage?.audience?.filter((a) => a.id !== me?.id) ?? [];
|
|
25
|
+
const multipleParticipants = participants.length > 1;
|
|
26
|
+
const title = participants.length > 0
|
|
27
|
+
? participants.map((p) => p.displayName || `@${p.handle}`).join(', ')
|
|
28
|
+
: t('conversations.title', { defaultValue: 'Conversation' });
|
|
29
|
+
useSetPageHeader(title);
|
|
30
|
+
const [text, setText] = useState('');
|
|
31
|
+
const [sending, setSending] = useState(false);
|
|
32
|
+
const send = async () => {
|
|
33
|
+
if (!text.trim() || text.length > MAX_LENGTH)
|
|
34
|
+
return;
|
|
35
|
+
setSending(true);
|
|
36
|
+
try {
|
|
37
|
+
const payload = {
|
|
38
|
+
visibility: 'direct',
|
|
39
|
+
audience: lastMessage?.audience ?? participants,
|
|
40
|
+
type: 'note',
|
|
41
|
+
data: { type: 'note', content: text },
|
|
42
|
+
};
|
|
43
|
+
await createMessage(payload);
|
|
44
|
+
setText('');
|
|
45
|
+
await conversationQuery.refetch();
|
|
46
|
+
await queryClient.invalidateQueries({
|
|
47
|
+
queryKey: client.conversations.list.queryKey({}),
|
|
48
|
+
refetchType: 'all',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
toast.error(t('conversations.sendError', {
|
|
53
|
+
defaultValue: 'Failed to send message',
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
setSending(false);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
endRef.current?.scrollIntoView({ behavior: 'smooth' });
|
|
62
|
+
}, [messages.length]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!id)
|
|
65
|
+
return;
|
|
66
|
+
adjustUnseenCounts(queryClient, client, { clearConversation: id });
|
|
67
|
+
void flushPostViews();
|
|
68
|
+
return () => {
|
|
69
|
+
void flushPostViews();
|
|
70
|
+
};
|
|
71
|
+
}, [id, client, queryClient, flushPostViews]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!id || !me || conversationQuery.isLoading)
|
|
74
|
+
return;
|
|
75
|
+
const unseenIds = messages
|
|
76
|
+
.filter((m) => m.seen === false && m.profile.id !== me.id)
|
|
77
|
+
.map((m) => m.id);
|
|
78
|
+
if (unseenIds.length === 0)
|
|
79
|
+
return;
|
|
80
|
+
void markPostsSeen({ postIds: unseenIds });
|
|
81
|
+
}, [id, me, messages, conversationQuery.isLoading, markPostsSeen]);
|
|
82
|
+
if (conversationQuery.isLoading) {
|
|
83
|
+
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
84
|
+
}
|
|
85
|
+
const overLimit = text.length > MAX_LENGTH;
|
|
86
|
+
return (_jsxs("div", { className: "flex h-[calc(100vh-8rem)] flex-col", children: [_jsx("header", { className: "border-b", children: participants.length === 1 && participants[0] ? (_jsx(ProfileCard, { profile: participants[0], showAction: false })) : (_jsxs("div", { className: "flex items-center gap-2 p-3", children: [_jsx("div", { className: "flex -space-x-2", children: participants.slice(0, 4).map((p) => (_jsx(Avatar, { profile: p, size: 2.25, borderless: true }, p.id))) }), _jsx("div", { className: "text-sm font-medium", children: participants
|
|
87
|
+
.map((p) => p.displayName || `@${p.handle}`)
|
|
88
|
+
.join(', ') })] })) }), _jsxs("div", { role: "log", "aria-live": "polite", "aria-label": t('conversations.messageLog', {
|
|
89
|
+
defaultValue: 'Messages',
|
|
90
|
+
}), className: "flex-1 overflow-y-auto px-3", children: [messages.map((m, index) => (_jsx(MessageInThread, { previous: messages[index - 1], message: m, multipleParticipants: multipleParticipants, conversationRootId: id }, m.id))), _jsx("div", { ref: endRef })] }), canCreate && (_jsx("footer", { className: "space-y-2 border-t p-3", children: _jsxs("div", { className: "flex flex-col", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { className: "flex-1", placeholder: t('conversations.placeholder', {
|
|
91
|
+
defaultValue: 'Write a message…',
|
|
92
|
+
}), value: text, onChange: (e) => setText(e.target.value), onKeyDown: (e) => {
|
|
93
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
send();
|
|
96
|
+
}
|
|
97
|
+
} }), _jsx(Button, { title: "Send", variant: "default", action: send, disabled: sending || !text.trim() || overLimit, children: sending
|
|
98
|
+
? t('common.sending', { defaultValue: 'Sending…' })
|
|
99
|
+
: t('common.send', { defaultValue: 'Send' }) })] }), _jsxs("span", { className: `pt-1 text-right text-[10px] ${overLimit ? 'text-error' : 'text-muted-foreground'}`, children: [text.length, " / ", MAX_LENGTH] })] }) }))] }));
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function EditEvent(): import("react/jsx-runtime").JSX.Element;
|