@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,81 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
4
|
+
import { useCurrentAccount } from '../../components/index.js';
|
|
5
|
+
import { Button, Input, Label, Toast } from '@openpeepshq/react-ui';
|
|
6
|
+
export function AccountSettings() {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
9
|
+
const account = useCurrentAccount();
|
|
10
|
+
const updateAccount = openpeepsApi.updateCurrentAccountAction();
|
|
11
|
+
useSetPageHeader(t('settings.account.title', { defaultValue: 'Account' }));
|
|
12
|
+
const [email, setEmail] = useState(account?.email ?? '');
|
|
13
|
+
const [oldPassword, setOldPassword] = useState('');
|
|
14
|
+
const [newPassword, setNewPassword] = useState('');
|
|
15
|
+
const [confirmPassword, setConfirmPassword] = useState('');
|
|
16
|
+
const [submitting, setSubmitting] = useState(false);
|
|
17
|
+
const [status, setStatus] = useState(null);
|
|
18
|
+
const submit = async () => {
|
|
19
|
+
setStatus(null);
|
|
20
|
+
if (newPassword && newPassword !== confirmPassword) {
|
|
21
|
+
setStatus({ type: 'error', message: 'Passwords do not match' });
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!oldPassword) {
|
|
25
|
+
setStatus({
|
|
26
|
+
type: 'error',
|
|
27
|
+
message: 'You must provide your old password',
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
setSubmitting(true);
|
|
32
|
+
try {
|
|
33
|
+
await updateAccount({
|
|
34
|
+
email,
|
|
35
|
+
oldPassword,
|
|
36
|
+
newPassword: newPassword || undefined,
|
|
37
|
+
confirmPassword: confirmPassword || undefined,
|
|
38
|
+
});
|
|
39
|
+
setStatus({
|
|
40
|
+
type: 'success',
|
|
41
|
+
message: t('settings.account.updateSuccess', {
|
|
42
|
+
defaultValue: 'Account updated',
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
setOldPassword('');
|
|
46
|
+
setNewPassword('');
|
|
47
|
+
setConfirmPassword('');
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
setStatus({
|
|
51
|
+
type: 'error',
|
|
52
|
+
message: t('settings.account.updateFailed', {
|
|
53
|
+
defaultValue: `Failed: ${err.message}`,
|
|
54
|
+
error: err.message,
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
setSubmitting(false);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "oldPassword", children: t('settings.account.oldPassword', {
|
|
63
|
+
defaultValue: 'Current password',
|
|
64
|
+
}) }), _jsx(Input, { id: "oldPassword", type: "password", autoComplete: "current-password", value: oldPassword, placeholder: t('settings.account.oldPasswordPlaceholder', {
|
|
65
|
+
defaultValue: 'Enter your current password',
|
|
66
|
+
}), onChange: (e) => setOldPassword(e.target.value), "data-testid": "settings-current-password-input" }), _jsx("p", { className: "text-muted-foreground text-xs", children: t('settings.account.oldPasswordDescription', {
|
|
67
|
+
defaultValue: 'Required to change your email or password.',
|
|
68
|
+
}) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "email", children: t('settings.account.email', { defaultValue: 'Email' }) }), _jsx(Input, { id: "email", type: "email", value: email, placeholder: t('settings.account.emailPlaceholder', {
|
|
69
|
+
defaultValue: 'Enter your email',
|
|
70
|
+
}), onChange: (e) => setEmail(e.target.value), "data-testid": "settings-email-input" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "newPassword", children: t('settings.account.newPassword', {
|
|
71
|
+
defaultValue: 'New password',
|
|
72
|
+
}) }), _jsx(Input, { id: "newPassword", type: "password", autoComplete: "new-password", value: newPassword, placeholder: t('settings.account.newPasswordPlaceholder', {
|
|
73
|
+
defaultValue: 'Enter your new password',
|
|
74
|
+
}), onChange: (e) => setNewPassword(e.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "confirmPassword", children: t('settings.account.confirmPassword', {
|
|
75
|
+
defaultValue: 'Confirm new password',
|
|
76
|
+
}) }), _jsx(Input, { id: "confirmPassword", type: "password", autoComplete: "new-password", value: confirmPassword, placeholder: t('settings.account.confirmPasswordPlaceholder', {
|
|
77
|
+
defaultValue: 'Confirm your new password',
|
|
78
|
+
}), onChange: (e) => setConfirmPassword(e.target.value) })] }), status && (_jsx(Toast, { variant: status.type, onDismiss: () => setStatus(null), children: status.message })), _jsx(Button, { title: "Save", variant: "default", action: submit, disabled: submitting, "data-testid": "settings-save-button", children: submitting
|
|
79
|
+
? t('common.submitting', { defaultValue: 'Submitting…' })
|
|
80
|
+
: t('common.submit', { defaultValue: 'Submit' }) })] }));
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function BillingSettings(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { AlertCircle, Calendar, CheckCircle, CreditCard } from 'lucide-react';
|
|
5
|
+
import { formatTimeStamp, isOwnerProfile } from '@openpeepshq/common';
|
|
6
|
+
import { useT, useOpenpeeps } from '../../index.js';
|
|
7
|
+
import { useCurrentProfile, useServerInfo } from '../../components/index.js';
|
|
8
|
+
import { Button, LoadingSpinner } from '@openpeepshq/react-ui';
|
|
9
|
+
function statusInfo(status) {
|
|
10
|
+
switch (status) {
|
|
11
|
+
case 'active':
|
|
12
|
+
return { color: 'text-green-600', Icon: CheckCircle, label: 'Active' };
|
|
13
|
+
case 'trialing':
|
|
14
|
+
return { color: 'text-blue-600', Icon: CheckCircle, label: 'Trial' };
|
|
15
|
+
case 'past_due':
|
|
16
|
+
return { color: 'text-yellow-600', Icon: AlertCircle, label: 'Past Due' };
|
|
17
|
+
case 'canceled':
|
|
18
|
+
return { color: 'text-red-600', Icon: AlertCircle, label: 'Canceled' };
|
|
19
|
+
case 'unpaid':
|
|
20
|
+
return { color: 'text-red-600', Icon: AlertCircle, label: 'Unpaid' };
|
|
21
|
+
case 'none':
|
|
22
|
+
return {
|
|
23
|
+
color: 'text-gray-600',
|
|
24
|
+
Icon: AlertCircle,
|
|
25
|
+
label: 'No Subscription',
|
|
26
|
+
};
|
|
27
|
+
default:
|
|
28
|
+
return { color: 'text-gray-600', Icon: AlertCircle, label: status };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function BillingSettings() {
|
|
32
|
+
const t = useT();
|
|
33
|
+
const navigate = useNavigate();
|
|
34
|
+
const serverInfo = useServerInfo();
|
|
35
|
+
const profile = useCurrentProfile();
|
|
36
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
37
|
+
const paymentStatusQuery = openpeepsApi.usePaymentStatus();
|
|
38
|
+
const createPortal = openpeepsApi.createCustomerPortalAction();
|
|
39
|
+
const stripeMembershipEnabled = !!serverInfo.payments?.stripe?.paidMembership?.enabled &&
|
|
40
|
+
!(profile && isOwnerProfile(profile));
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!stripeMembershipEnabled)
|
|
43
|
+
navigate(-1);
|
|
44
|
+
}, [stripeMembershipEnabled, navigate]);
|
|
45
|
+
if (!stripeMembershipEnabled)
|
|
46
|
+
return null;
|
|
47
|
+
const onCreatePortal = async () => {
|
|
48
|
+
const result = await createPortal();
|
|
49
|
+
if (result.success && result.url) {
|
|
50
|
+
window.open(result.url, '_self', 'noopener,noreferrer');
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
if (paymentStatusQuery.isLoading) {
|
|
54
|
+
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
|
|
55
|
+
}
|
|
56
|
+
const data = paymentStatusQuery.data;
|
|
57
|
+
const subscription = data && data.status !== 'none' ? data : null;
|
|
58
|
+
return (_jsx("section", { className: "relative", children: _jsxs("div", { className: "p-6", children: [_jsxs("div", { className: "mb-4 flex items-center justify-between", children: [_jsxs("h2", { className: "flex items-center gap-2 text-xl font-semibold", "data-testid": "settings-billing-heading", children: [_jsx(CreditCard, { size: 24 }), t('settings.billing.title', { defaultValue: 'Billing' })] }), subscription &&
|
|
59
|
+
(() => {
|
|
60
|
+
const info = statusInfo(subscription.status);
|
|
61
|
+
const Icon = info.Icon;
|
|
62
|
+
return (_jsxs("div", { className: `flex items-center gap-2 ${info.color}`, children: [_jsx(Icon, { size: 16 }), _jsx("span", { className: "text-sm font-medium", children: info.label })] }));
|
|
63
|
+
})()] }), subscription && (_jsxs("div", { className: "space-y-4", children: [subscription.paymentMethod && (_jsxs("div", { className: "border-border flex items-center justify-between border-b py-3", children: [_jsx("span", { className: "text-muted-foreground text-sm", children: t('settings.billing.paymentMethod', {
|
|
64
|
+
defaultValue: 'Payment method',
|
|
65
|
+
}) }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CreditCard, { size: 16, className: "text-muted-foreground" }), _jsxs("span", { className: "text-sm font-medium", children: [subscription.paymentMethod.brand
|
|
66
|
+
? subscription.paymentMethod.brand.toUpperCase()
|
|
67
|
+
: 'Card', ' ', "\u2022\u2022\u2022\u2022", subscription.paymentMethod.last4 || '****'] })] })] })), _jsxs("div", { className: "border-border flex items-center justify-between border-b py-3", children: [_jsx("span", { className: "text-muted-foreground text-sm", children: t('settings.billing.currentPeriod', {
|
|
68
|
+
defaultValue: 'Current period',
|
|
69
|
+
}) }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { size: 16, className: "text-muted-foreground" }), _jsxs("span", { className: "text-sm font-medium", children: [formatTimeStamp(subscription.currentPeriodStart), " -", ' ', formatTimeStamp(subscription.currentPeriodEnd, subscription.currentPeriodStart)] })] })] }), _jsxs("div", { className: "flex items-center justify-between py-3", children: [_jsx("span", { className: "text-muted-foreground text-sm", children: t('settings.billing.autoRenewal', {
|
|
70
|
+
defaultValue: 'Auto-renewal',
|
|
71
|
+
}) }), _jsx("span", { className: `text-sm font-medium ${subscription.cancelAtPeriodEnd ? 'text-yellow-600' : 'text-green-600'}`, children: subscription.cancelAtPeriodEnd
|
|
72
|
+
? t('settings.billing.autoRenewalCanceled', {
|
|
73
|
+
defaultValue: 'Canceled at end of period',
|
|
74
|
+
})
|
|
75
|
+
: t('settings.billing.autoRenewalActive', {
|
|
76
|
+
defaultValue: 'Active',
|
|
77
|
+
}) })] }), _jsx("div", { className: "flex gap-3 pt-4", children: _jsx(Button, { title: "Manage", variant: "default", action: onCreatePortal, children: t('settings.billing.createPortal', {
|
|
78
|
+
defaultValue: 'Manage subscription',
|
|
79
|
+
}) }) })] })), !subscription && (_jsx("div", { className: "space-y-3", children: _jsx("p", { className: "text-muted-foreground text-sm", children: t('settings.billing.noSubscription', {
|
|
80
|
+
defaultValue: 'No active subscription. Subscribe to support your community.',
|
|
81
|
+
}) }) }))] }) }));
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Settings(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isOwnerProfile } from '@openpeepshq/common';
|
|
3
|
+
import { useT, useSetPageHeader } from '../../index.js';
|
|
4
|
+
import { ConfigMenuButton, useCurrentProfile, useServerInfo, } from '../../components/index.js';
|
|
5
|
+
export function Settings() {
|
|
6
|
+
const t = useT();
|
|
7
|
+
const profile = useCurrentProfile();
|
|
8
|
+
const serverInfo = useServerInfo();
|
|
9
|
+
useSetPageHeader('Settings', undefined, 'settings-page-heading');
|
|
10
|
+
const stripeMembershipEnabled = !!serverInfo.payments?.stripe?.paidMembership?.enabled &&
|
|
11
|
+
!(profile && isOwnerProfile(profile));
|
|
12
|
+
return (_jsxs("nav", { "aria-label": t('settings.menu', { defaultValue: 'Settings' }), className: "p-4", children: [_jsx(ConfigMenuButton, { translationPrefix: "settings.publicProfile", action: "/settings/public-profile", testId: "settings-link-public-profile" }), _jsx(ConfigMenuButton, { translationPrefix: "settings.account", action: "/settings/account", testId: "settings-link-account" }), _jsx(ConfigMenuButton, { translationPrefix: "settings.notifications", action: "/settings/notifications", testId: "settings-link-notifications" }), _jsx(ConfigMenuButton, { translationPrefix: "settings.accessTokens", action: "/settings/access-tokens" }), _jsx(ConfigMenuButton, { translationPrefix: "settings.theme", action: "/settings/theme", testId: "settings-link-theme" }), _jsx(ConfigMenuButton, { translationPrefix: "settings.language", action: "/settings/language" }), stripeMembershipEnabled && (_jsx(ConfigMenuButton, { translationPrefix: "settings.billing", action: "/settings/billing", testId: "settings-link-billing" }))] }));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LanguageSettings(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useT, useOpenpeeps } from '../../index.js';
|
|
4
|
+
import { useCurrentProfile, useServerInfo } from '../../components/index.js';
|
|
5
|
+
import { Button, Toast } from '@openpeepshq/react-ui';
|
|
6
|
+
const AVAILABLE_LANGUAGES = [
|
|
7
|
+
{ code: 'en', name: 'English' },
|
|
8
|
+
{ code: 'de', name: 'Deutsch' },
|
|
9
|
+
];
|
|
10
|
+
export function LanguageSettings() {
|
|
11
|
+
const t = useT();
|
|
12
|
+
const profile = useCurrentProfile();
|
|
13
|
+
const serverInfo = useServerInfo();
|
|
14
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
15
|
+
const settingsQuery = openpeepsApi.useCurrentProfileSettings();
|
|
16
|
+
const updateSettings = openpeepsApi.updateCurrentProfileSettingsAction();
|
|
17
|
+
const communityDefaultLanguage = serverInfo.communityConfig?.settings?.defaultLanguage ?? 'en';
|
|
18
|
+
const [language, setLanguage] = useState(communityDefaultLanguage);
|
|
19
|
+
const [saving, setSaving] = useState(false);
|
|
20
|
+
const [status, setStatus] = useState(null);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (settingsQuery.data?.language) {
|
|
23
|
+
setLanguage(settingsQuery.data.language);
|
|
24
|
+
}
|
|
25
|
+
}, [settingsQuery.data?.language]);
|
|
26
|
+
if (!profile)
|
|
27
|
+
return null;
|
|
28
|
+
const save = async () => {
|
|
29
|
+
setStatus(null);
|
|
30
|
+
setSaving(true);
|
|
31
|
+
try {
|
|
32
|
+
await updateSettings({ id: profile.id, language });
|
|
33
|
+
localStorage.setItem('openpeeps-language', language);
|
|
34
|
+
setStatus({
|
|
35
|
+
type: 'success',
|
|
36
|
+
message: t('settings.language.updateSuccess', {
|
|
37
|
+
defaultValue: 'Language updated. Reloading…',
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
window.setTimeout(() => window.location.reload(), 500);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
setStatus({ type: 'error', message: err.message });
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
setSaving(false);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return (_jsxs("div", { className: "flex flex-col gap-4 p-3", children: [_jsxs("div", { className: "border p-4", children: [_jsx("h4", { className: "my-4 text-lg font-semibold", children: t('settings.language.title', { defaultValue: 'Language' }) }), _jsx("span", { children: t('settings.language.languageDescription', {
|
|
50
|
+
defaultValue: 'Choose your preferred language.',
|
|
51
|
+
}) }), _jsx("div", { className: "mt-4 flex flex-wrap items-center gap-x-4 gap-y-2", children: AVAILABLE_LANGUAGES.map((lang) => (_jsxs("label", { className: "flex items-center gap-2", children: [_jsx("input", { type: "radio", className: "h-4 w-4", checked: language === lang.code, onChange: () => setLanguage(lang.code) }), _jsxs("span", { children: [lang.name, lang.code === communityDefaultLanguage ? (_jsx("span", { className: "ml-1 text-sm opacity-60", children: t('settings.language.default', {
|
|
52
|
+
defaultValue: '(community default)',
|
|
53
|
+
}) })) : null] })] }, lang.code))) })] }), status ? (_jsx(Toast, { variant: status.type, onDismiss: () => setStatus(null), children: status.message })) : null, _jsx(Button, { variant: "default", action: save, disabled: saving, children: t('common.form.save', { defaultValue: 'Save' }) })] }));
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function NotificationPreferences(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { deepSet, notificationDefaults, } from '@openpeepshq/common';
|
|
4
|
+
import { getPushSubscription, isBraveBrowser, subscribePushNotifications, usePushSubscription, useT, useOpenpeeps, useSetPageHeader, } from '../../index.js';
|
|
5
|
+
import { useCurrentProfile, useServerInfo } from '../../components/index.js';
|
|
6
|
+
import { Button, Toast } from '@openpeepshq/react-ui';
|
|
7
|
+
function NotificationSettingRow({ notificationType, settings, onChange, }) {
|
|
8
|
+
const t = useT();
|
|
9
|
+
const effective = settings ?? notificationType.defaultSettings ?? notificationDefaults;
|
|
10
|
+
const handleChange = (action, value) => {
|
|
11
|
+
const next = { ...effective };
|
|
12
|
+
if (!value && action === 'create') {
|
|
13
|
+
next.create = false;
|
|
14
|
+
next.push = false;
|
|
15
|
+
next.email = false;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
next[action] = value;
|
|
19
|
+
}
|
|
20
|
+
onChange(next);
|
|
21
|
+
};
|
|
22
|
+
return (_jsxs("div", { className: "bg-surface mb-3 mt-4 w-full rounded-md p-3", children: [_jsxs("p", { className: "mb-2 font-bold", children: [t(`settings.notifications.types.${notificationType.type}.label`, {
|
|
23
|
+
defaultValue: notificationType.type,
|
|
24
|
+
}), ":"] }), ['create', 'push', 'email'].map((action) => (_jsx("div", { className: "mb-3", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-sm font-medium", children: t(`settings.notifications.${action}`, {
|
|
25
|
+
defaultValue: action,
|
|
26
|
+
}) }), _jsxs("label", { className: "relative inline-flex cursor-pointer items-center", children: [_jsx("input", { type: "checkbox", className: "peer sr-only", checked: effective[action] ?? false, onChange: (e) => handleChange(action, e.target.checked) }), _jsx("div", { className: "bg-input peer-checked:bg-primary h-5 w-9 rounded-full" }), _jsx("div", { className: "absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-white transition-transform peer-checked:translate-x-4" })] })] }) }, action)))] }));
|
|
27
|
+
}
|
|
28
|
+
function PushSettingsPanel() {
|
|
29
|
+
const t = useT();
|
|
30
|
+
const { client, openpeepsApi } = useOpenpeeps();
|
|
31
|
+
const serverInfo = useServerInfo();
|
|
32
|
+
const vapidKey = serverInfo.vapid.publicKey;
|
|
33
|
+
const push = usePushSubscription({
|
|
34
|
+
client,
|
|
35
|
+
applicationServerKey: vapidKey,
|
|
36
|
+
});
|
|
37
|
+
const testPush = openpeepsApi.testPushSubscriptionAction();
|
|
38
|
+
const [actionError, setActionError] = useState(null);
|
|
39
|
+
if (!vapidKey) {
|
|
40
|
+
return (_jsx("p", { className: "text-muted-foreground text-sm", children: t('settings.notifications.serverPushDisabled', {
|
|
41
|
+
defaultValue: 'Push notifications are not configured on this server.',
|
|
42
|
+
}) }));
|
|
43
|
+
}
|
|
44
|
+
const errorMessage = (code) => {
|
|
45
|
+
switch (code) {
|
|
46
|
+
case 'unsupported':
|
|
47
|
+
return t('settings.notifications.pushUnsupported', {
|
|
48
|
+
defaultValue: 'Push notifications are not supported in this browser.',
|
|
49
|
+
});
|
|
50
|
+
case 'no-service-worker':
|
|
51
|
+
return t('settings.notifications.pushServiceWorkerRequired', {
|
|
52
|
+
defaultValue: 'Push notifications require the app service worker. They are unavailable in this environment.',
|
|
53
|
+
});
|
|
54
|
+
case 'permission-denied':
|
|
55
|
+
return t('settings.notifications.pushPermissionDenied', {
|
|
56
|
+
defaultValue: 'Notification permission was denied. Enable it in your browser settings and try again.',
|
|
57
|
+
});
|
|
58
|
+
default:
|
|
59
|
+
return t('settings.notifications.pushSubscribeFailed', {
|
|
60
|
+
defaultValue: 'Could not enable push notifications. Please try again.',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const handleToggle = async (enabled) => {
|
|
65
|
+
setActionError(null);
|
|
66
|
+
if (!enabled) {
|
|
67
|
+
await push.unsubscribe();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const error = await push.subscribe();
|
|
71
|
+
if (error)
|
|
72
|
+
setActionError(errorMessage(error));
|
|
73
|
+
};
|
|
74
|
+
const sendTest = async () => {
|
|
75
|
+
const subscription = await getPushSubscription();
|
|
76
|
+
const auth = subscription?.toJSON().keys?.auth;
|
|
77
|
+
if (auth) {
|
|
78
|
+
await testPush({ subscriptionKey: auth });
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const unavailable = !push.isSupported || (!push.isLoading && !push.hasServiceWorker);
|
|
82
|
+
const unavailableMessage = unavailable
|
|
83
|
+
? errorMessage(push.isSupported ? 'no-service-worker' : 'unsupported')
|
|
84
|
+
: null;
|
|
85
|
+
const showBraveWarning = isBraveBrowser();
|
|
86
|
+
return (_jsxs("div", { className: "mb-6 rounded-md border p-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-lg font-medium", children: t('settings.notifications.pushEnabled', {
|
|
87
|
+
defaultValue: 'Push notifications on this device',
|
|
88
|
+
}) }), _jsxs("label", { className: "relative inline-flex cursor-pointer items-center", children: [_jsx("input", { type: "checkbox", className: "peer sr-only", checked: push.isSubscribed, disabled: push.isLoading || unavailable, onChange: (e) => void handleToggle(e.target.checked) }), _jsx("div", { className: "bg-input peer-checked:bg-primary h-5 w-9 rounded-full" }), _jsx("div", { className: "absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-white transition-transform peer-checked:translate-x-4" })] })] }), showBraveWarning ? (_jsxs("div", { className: "border-warning bg-surface-warning mt-3 rounded border p-3 text-sm", children: [_jsx("p", { className: "font-medium", children: t('settings.notifications.bravePushWarning.title', {
|
|
89
|
+
defaultValue: 'Brave browser setting required',
|
|
90
|
+
}) }), _jsx("p", { className: "mt-1", children: t('settings.notifications.bravePushWarning.body', {
|
|
91
|
+
defaultValue: 'Brave disables Google push messaging by default. Open {{settingsPath}} and enable "{{settingName}}", then try again.',
|
|
92
|
+
settingsPath: 'brave://settings/privacy',
|
|
93
|
+
settingName: 'Use Google services for push messaging',
|
|
94
|
+
}) }), _jsx("a", { className: "op-anchor mt-2 inline-block", href: "https://intercom.help/progressier/en/articles/6885624-i-can-t-receive-push-notifications-with-the-brave-browser", target: "_blank", rel: "noopener noreferrer", children: t('settings.notifications.bravePushWarning.learnMore', {
|
|
95
|
+
defaultValue: 'Learn more about Brave push notifications',
|
|
96
|
+
}) })] })) : null, unavailableMessage ? (_jsx("p", { className: "text-muted-foreground mt-2 text-sm", children: unavailableMessage })) : null, actionError && !unavailableMessage ? (_jsx("p", { className: "text-error mt-2 text-sm", children: actionError })) : null, push.isSubscribed ? (_jsx("div", { className: "pt-3", children: _jsx(Button, { variant: "default", action: sendTest, children: t('settings.notifications.testPush', {
|
|
97
|
+
defaultValue: 'Send test push',
|
|
98
|
+
}) }) })) : null] }));
|
|
99
|
+
}
|
|
100
|
+
export function NotificationPreferences() {
|
|
101
|
+
const t = useT();
|
|
102
|
+
const { client, openpeepsApi } = useOpenpeeps();
|
|
103
|
+
const serverInfo = useServerInfo();
|
|
104
|
+
const me = useCurrentProfile();
|
|
105
|
+
const notificationTypesQuery = openpeepsApi.useCurrentProfileNotificationTypes();
|
|
106
|
+
const settingsQuery = openpeepsApi.useCurrentProfileSettings();
|
|
107
|
+
const updateSettings = openpeepsApi.updateCurrentProfileSettingsAction();
|
|
108
|
+
const vapidKey = serverInfo.vapid.publicKey;
|
|
109
|
+
useSetPageHeader(t('settings.notifications.preferences.title', {
|
|
110
|
+
defaultValue: 'Notification preferences',
|
|
111
|
+
}));
|
|
112
|
+
const [settings, setSettings] = useState(() => ({
|
|
113
|
+
id: me?.id ?? '',
|
|
114
|
+
notifications: {},
|
|
115
|
+
}));
|
|
116
|
+
const [saving, setSaving] = useState(false);
|
|
117
|
+
const [status, setStatus] = useState(null);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (settingsQuery.data) {
|
|
120
|
+
setSettings(settingsQuery.data);
|
|
121
|
+
}
|
|
122
|
+
}, [settingsQuery.data]);
|
|
123
|
+
if (!me)
|
|
124
|
+
return null;
|
|
125
|
+
const save = async () => {
|
|
126
|
+
setStatus(null);
|
|
127
|
+
setSaving(true);
|
|
128
|
+
try {
|
|
129
|
+
const wantsPush = Object.values(settings.notifications ?? {}).some((entry) => entry?.push);
|
|
130
|
+
// Push device registration is best-effort — preference saves must not
|
|
131
|
+
// fail when the browser already has a push subscription for another key.
|
|
132
|
+
let pushWarning;
|
|
133
|
+
if (wantsPush && vapidKey) {
|
|
134
|
+
try {
|
|
135
|
+
await subscribePushNotifications({
|
|
136
|
+
client,
|
|
137
|
+
applicationServerKey: vapidKey,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
pushWarning =
|
|
142
|
+
err instanceof Error
|
|
143
|
+
? err.message
|
|
144
|
+
: t('settings.notifications.pushSubscribeFailed', {
|
|
145
|
+
defaultValue: 'Could not enable push notifications on this device.',
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
await updateSettings(settings);
|
|
150
|
+
setStatus({
|
|
151
|
+
type: 'success',
|
|
152
|
+
message: pushWarning
|
|
153
|
+
? t('settings.notifications.updateSuccessPushFailed', {
|
|
154
|
+
defaultValue: 'Notification settings updated, but push on this device failed: {{detail}}',
|
|
155
|
+
detail: pushWarning,
|
|
156
|
+
})
|
|
157
|
+
: t('settings.notifications.updateSuccess', {
|
|
158
|
+
defaultValue: 'Notification settings updated.',
|
|
159
|
+
}),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
setStatus({ type: 'error', message: err.message });
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
setSaving(false);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
return (_jsxs("section", { className: "mr-4 mt-5 p-4", children: [_jsx("h2", { className: "mb-2 text-lg font-medium", children: t('settings.notifications.pushSettings', {
|
|
170
|
+
defaultValue: 'Push settings',
|
|
171
|
+
}) }), _jsx(PushSettingsPanel, {}), _jsx("h2", { className: "mb-2 text-lg font-medium", children: t('settings.notifications.description', {
|
|
172
|
+
defaultValue: 'Choose how you want to be notified about activity.',
|
|
173
|
+
}) }), (notificationTypesQuery.data ?? []).map((nt) => (_jsx(NotificationSettingRow, { notificationType: nt, settings: settings.notifications?.[nt.type], onChange: (s) => {
|
|
174
|
+
const next = { ...settings };
|
|
175
|
+
deepSet(next, `notifications.${nt.type}`, s);
|
|
176
|
+
setSettings(next);
|
|
177
|
+
} }, nt.type))), status ? (_jsx(Toast, { variant: status.type, onDismiss: () => setStatus(null), children: status.message })) : null, _jsx("div", { className: "pt-3", children: _jsx(Button, { variant: "default", className: "w-full", action: save, disabled: saving, "data-testid": "settings-save-button", children: saving
|
|
178
|
+
? t('common.submitting', { defaultValue: 'Submitting…' })
|
|
179
|
+
: t('common.submit', { defaultValue: 'Submit' }) }) })] }));
|
|
180
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function NotificationSettings(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT, useSetPageHeader } from '../../index.js';
|
|
3
|
+
import { ConfigMenuButton } from '../../components/index.js';
|
|
4
|
+
export function NotificationSettings() {
|
|
5
|
+
const t = useT();
|
|
6
|
+
useSetPageHeader(t('settings.notifications.title', { defaultValue: 'Notifications' }), undefined, 'notifications-page-heading');
|
|
7
|
+
return (_jsxs("nav", { "aria-label": t('settings.notifications.title', {
|
|
8
|
+
defaultValue: 'Notifications',
|
|
9
|
+
}), className: "p-4", children: [_jsx(ConfigMenuButton, { translationPrefix: "settings.notifications.preferences", action: "/settings/notifications/preferences", testId: "settings-notifications-preferences-link" }), _jsx(ConfigMenuButton, { translationPrefix: "settings.notifications.pushEnabledDevices", action: "/settings/notifications/push-enabled-devices", testId: "settings-notifications-push-devices-link" })] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PublicProfileSettings(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { accountNameSchema, profileDataSchema, } from '@openpeepshq/common/types';
|
|
4
|
+
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
5
|
+
import { HeaderAvatarInput, LocationInput, useCurrentProfile, useServerInfo, useToast, } from '../../components/index.js';
|
|
6
|
+
import { Button, Input, Label, Textarea } from '@openpeepshq/react-ui';
|
|
7
|
+
import { ZodError } from 'zod';
|
|
8
|
+
const firstZodMessage = (err) => err.issues[0]?.message;
|
|
9
|
+
export function PublicProfileSettings() {
|
|
10
|
+
const t = useT();
|
|
11
|
+
const { success, error: toastError } = useToast();
|
|
12
|
+
const serverInfo = useServerInfo();
|
|
13
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
14
|
+
const me = useCurrentProfile();
|
|
15
|
+
const updateProfile = openpeepsApi.updateCurrentProfileAction();
|
|
16
|
+
const submittingRef = useRef(false);
|
|
17
|
+
useSetPageHeader(t('settings.publicProfile.title', { defaultValue: 'Public profile' }));
|
|
18
|
+
const additionalFieldDefs = useMemo(() => serverInfo.communityConfig?.profiles?.additionalFields ?? [], [serverInfo.communityConfig?.profiles?.additionalFields]);
|
|
19
|
+
const [draft, setDraft] = useState({});
|
|
20
|
+
const [submitting, setSubmitting] = useState(false);
|
|
21
|
+
const [handleError, setHandleError] = useState(null);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!me)
|
|
24
|
+
return;
|
|
25
|
+
const existingFields = me.fields ?? [];
|
|
26
|
+
const fields = additionalFieldDefs.map((field) => {
|
|
27
|
+
const match = existingFields.find((f) => f.name === field.label);
|
|
28
|
+
return { name: field.label, value: match?.value ?? '' };
|
|
29
|
+
});
|
|
30
|
+
setDraft({
|
|
31
|
+
displayName: me.displayName ?? '',
|
|
32
|
+
handle: me.handle ?? '',
|
|
33
|
+
bio: me.bio ?? '',
|
|
34
|
+
avatar: me.avatar ?? undefined,
|
|
35
|
+
header: me.header ?? undefined,
|
|
36
|
+
location: me.location,
|
|
37
|
+
fields: fields.length ? fields : undefined,
|
|
38
|
+
});
|
|
39
|
+
setHandleError(null);
|
|
40
|
+
}, [me?.id, additionalFieldDefs]);
|
|
41
|
+
if (!me)
|
|
42
|
+
return null;
|
|
43
|
+
const validateHandle = (value) => {
|
|
44
|
+
const result = accountNameSchema.safeParse(value);
|
|
45
|
+
if (result.success)
|
|
46
|
+
return null;
|
|
47
|
+
const message = firstZodMessage(result.error);
|
|
48
|
+
if (message === 'Handle is reserved') {
|
|
49
|
+
return t('profile.form.handleReserved', {
|
|
50
|
+
defaultValue: 'That handle is reserved. Please choose another.',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return t('profile.form.handleInvalid', {
|
|
54
|
+
defaultValue: 'Handle must be 1–16 characters: letters, numbers, underscores, or hyphens (no spaces or punctuation)',
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const submit = async () => {
|
|
58
|
+
if (submittingRef.current)
|
|
59
|
+
return;
|
|
60
|
+
submittingRef.current = true;
|
|
61
|
+
setSubmitting(true);
|
|
62
|
+
const nextHandle = (draft.handle ?? me.handle ?? '').replace(/^@/, '');
|
|
63
|
+
const localHandleError = validateHandle(nextHandle);
|
|
64
|
+
if (localHandleError) {
|
|
65
|
+
setHandleError(localHandleError);
|
|
66
|
+
submittingRef.current = false;
|
|
67
|
+
setSubmitting(false);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
setHandleError(null);
|
|
71
|
+
try {
|
|
72
|
+
await updateProfile(profileDataSchema.parse({
|
|
73
|
+
handle: nextHandle,
|
|
74
|
+
type: me.type,
|
|
75
|
+
displayName: draft.displayName,
|
|
76
|
+
bio: draft.bio,
|
|
77
|
+
avatar: draft.avatar || null,
|
|
78
|
+
header: draft.header || null,
|
|
79
|
+
location: draft.location?.text ? draft.location : undefined,
|
|
80
|
+
fields: draft.fields?.filter((f) => f.value.trim()) ?? undefined,
|
|
81
|
+
}));
|
|
82
|
+
success(t('settings.profile.updateSuccess', {
|
|
83
|
+
defaultValue: 'Your profile has been updated',
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
if (err instanceof ZodError) {
|
|
88
|
+
const message = firstZodMessage(err);
|
|
89
|
+
if (message?.toLowerCase().includes('handle')) {
|
|
90
|
+
setHandleError(message === 'Handle is reserved'
|
|
91
|
+
? t('profile.form.handleReserved', {
|
|
92
|
+
defaultValue: 'That handle is reserved. Please choose another.',
|
|
93
|
+
})
|
|
94
|
+
: t('profile.form.handleInvalid', {
|
|
95
|
+
defaultValue: 'Handle must be 1–16 characters: letters, numbers, underscores, or hyphens (no spaces or punctuation)',
|
|
96
|
+
}));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
toastError(t('settings.profile.updateError', {
|
|
101
|
+
defaultValue: `There was an error updating your profile: ${err.message}`,
|
|
102
|
+
error: err.message,
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
submittingRef.current = false;
|
|
107
|
+
setSubmitting(false);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const patchField = (index, value) => {
|
|
111
|
+
setDraft((d) => {
|
|
112
|
+
const fields = [...(d.fields ?? [])];
|
|
113
|
+
const def = additionalFieldDefs[index];
|
|
114
|
+
if (!def)
|
|
115
|
+
return d;
|
|
116
|
+
fields[index] = { name: def.label, value };
|
|
117
|
+
return { ...d, fields };
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsx(HeaderAvatarInput, { header: draft.header ?? undefined, avatar: draft.avatar ?? undefined, onHeaderChange: (header) => setDraft((d) => ({ ...d, header })), onAvatarChange: (avatar) => setDraft((d) => ({ ...d, avatar })) }), _jsxs("div", { className: "space-y-2 pt-4", children: [_jsx(Label, { htmlFor: "displayName", children: t('profile.form.displayName', { defaultValue: 'Display name' }) }), _jsx(Input, { id: "displayName", value: draft.displayName ?? '', onChange: (e) => setDraft((d) => ({ ...d, displayName: e.target.value })), "data-testid": "settings-display-name-input" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "handle", children: t('profile.form.handle', { defaultValue: 'Handle' }) }), _jsx(Input, { id: "handle", value: draft.handle ?? '', maxLength: 16, "aria-invalid": Boolean(handleError), "aria-describedby": "handle-hint", onChange: (e) => {
|
|
121
|
+
const handle = e.target.value.replace(/^@/, '');
|
|
122
|
+
setDraft((d) => ({ ...d, handle }));
|
|
123
|
+
if (handleError)
|
|
124
|
+
setHandleError(validateHandle(handle));
|
|
125
|
+
}, placeholder: t('profile.form.handlePlaceholder', {
|
|
126
|
+
defaultValue: 'your-handle',
|
|
127
|
+
}), "data-testid": "settings-handle-input" }), _jsx("p", { id: "handle-hint", className: handleError
|
|
128
|
+
? 'text-destructive text-sm'
|
|
129
|
+
: 'text-muted-foreground text-sm', "data-testid": "settings-handle-hint", children: handleError ??
|
|
130
|
+
t('profile.form.handleHint', {
|
|
131
|
+
defaultValue: '1–16 characters. Letters, numbers, underscores, and hyphens only — no spaces or punctuation.',
|
|
132
|
+
}) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "bio", children: t('profile.form.bio', { defaultValue: 'Bio' }) }), _jsx(Textarea, { id: "bio", rows: 4, value: draft.bio ?? '', onChange: (e) => setDraft((d) => ({ ...d, bio: e.target.value })), "data-testid": "settings-bio-input" })] }), _jsx(LocationInput, { title: t('profile.form.location', { defaultValue: 'Location' }), value: draft.location, onChange: (location) => setDraft((d) => ({ ...d, location })) }), additionalFieldDefs.map((field, index) => (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `field-${index}`, children: field.label }), _jsx(Input, { id: `field-${index}`, value: draft.fields?.[index]?.value ?? '', placeholder: field.label, onChange: (e) => patchField(index, e.target.value) })] }, field.label))), _jsx(Button, { title: t('common.save', { defaultValue: 'Save' }), variant: "default", action: submit, disabled: submitting, "data-testid": "settings-save-button", children: submitting
|
|
133
|
+
? t('common.saving', { defaultValue: 'Saving…' })
|
|
134
|
+
: t('common.save', { defaultValue: 'Save' }) })] }));
|
|
135
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PushEnabledDevices(): import("react/jsx-runtime").JSX.Element;
|