@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,168 @@
|
|
|
1
|
+
import type { CommunityConfig } from '@openpeepshq/common/types';
|
|
2
|
+
/**
|
|
3
|
+
* Mirrors the Svelte community config pages: load the effective
|
|
4
|
+
* `openpeeps/community` config, edit a clone, and persist only the diff so we
|
|
5
|
+
* never pin current defaults into the stored overrides.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useCommunityConfig(): {
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
base: {
|
|
10
|
+
theme: {
|
|
11
|
+
base: string;
|
|
12
|
+
primaryHex: string;
|
|
13
|
+
light: {
|
|
14
|
+
primaryHex: string;
|
|
15
|
+
secondaryHex?: string | undefined;
|
|
16
|
+
fontFamily?: string | undefined;
|
|
17
|
+
buttonRadius?: string | undefined;
|
|
18
|
+
radius?: string | undefined;
|
|
19
|
+
logoSmall?: string | undefined;
|
|
20
|
+
defaultProfileAvatar?: string | undefined;
|
|
21
|
+
defaultGroupAvatar?: string | undefined;
|
|
22
|
+
backgroundAuth?: string | undefined;
|
|
23
|
+
background?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
dark: {
|
|
26
|
+
primaryHex: string;
|
|
27
|
+
secondaryHex?: string | undefined;
|
|
28
|
+
fontFamily?: string | undefined;
|
|
29
|
+
buttonRadius?: string | undefined;
|
|
30
|
+
radius?: string | undefined;
|
|
31
|
+
logoSmall?: string | undefined;
|
|
32
|
+
defaultProfileAvatar?: string | undefined;
|
|
33
|
+
defaultGroupAvatar?: string | undefined;
|
|
34
|
+
backgroundAuth?: string | undefined;
|
|
35
|
+
background?: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
icon?: string | undefined;
|
|
38
|
+
mobileIcon?: string | undefined;
|
|
39
|
+
logoFull?: string | undefined;
|
|
40
|
+
logoSmall?: string | undefined;
|
|
41
|
+
defaultProfileAvatar?: string | undefined;
|
|
42
|
+
defaultGroupAvatar?: string | undefined;
|
|
43
|
+
backgroundAuth?: string | undefined;
|
|
44
|
+
background?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
info: {
|
|
47
|
+
name: string;
|
|
48
|
+
tagLine: string;
|
|
49
|
+
contactEmail?: string | undefined;
|
|
50
|
+
privacyPolicy?: string | undefined;
|
|
51
|
+
termsAndConditions?: string | undefined;
|
|
52
|
+
};
|
|
53
|
+
content: {
|
|
54
|
+
aboutPage?: string | undefined;
|
|
55
|
+
welcomePage?: string | undefined;
|
|
56
|
+
codeOfConduct?: string | undefined;
|
|
57
|
+
welcomeEmail?: string | undefined;
|
|
58
|
+
pinnedPost?: string | undefined;
|
|
59
|
+
};
|
|
60
|
+
settings: {
|
|
61
|
+
openRegistrations: boolean;
|
|
62
|
+
defaultLanguage?: string | undefined;
|
|
63
|
+
};
|
|
64
|
+
roles: {
|
|
65
|
+
onRegistration: {
|
|
66
|
+
add: string[];
|
|
67
|
+
remove: string[];
|
|
68
|
+
};
|
|
69
|
+
onEmailValidation: {
|
|
70
|
+
add: string[];
|
|
71
|
+
remove: string[];
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
profiles?: {
|
|
75
|
+
additionalFields?: {
|
|
76
|
+
key: string;
|
|
77
|
+
label: string;
|
|
78
|
+
icon?: string | undefined;
|
|
79
|
+
linkPattern?: string | undefined;
|
|
80
|
+
}[] | undefined;
|
|
81
|
+
} | undefined;
|
|
82
|
+
} | undefined;
|
|
83
|
+
draft: {
|
|
84
|
+
theme: {
|
|
85
|
+
base: string;
|
|
86
|
+
primaryHex: string;
|
|
87
|
+
light: {
|
|
88
|
+
primaryHex: string;
|
|
89
|
+
secondaryHex?: string | undefined;
|
|
90
|
+
fontFamily?: string | undefined;
|
|
91
|
+
buttonRadius?: string | undefined;
|
|
92
|
+
radius?: string | undefined;
|
|
93
|
+
logoSmall?: string | undefined;
|
|
94
|
+
defaultProfileAvatar?: string | undefined;
|
|
95
|
+
defaultGroupAvatar?: string | undefined;
|
|
96
|
+
backgroundAuth?: string | undefined;
|
|
97
|
+
background?: string | undefined;
|
|
98
|
+
};
|
|
99
|
+
dark: {
|
|
100
|
+
primaryHex: string;
|
|
101
|
+
secondaryHex?: string | undefined;
|
|
102
|
+
fontFamily?: string | undefined;
|
|
103
|
+
buttonRadius?: string | undefined;
|
|
104
|
+
radius?: string | undefined;
|
|
105
|
+
logoSmall?: string | undefined;
|
|
106
|
+
defaultProfileAvatar?: string | undefined;
|
|
107
|
+
defaultGroupAvatar?: string | undefined;
|
|
108
|
+
backgroundAuth?: string | undefined;
|
|
109
|
+
background?: string | undefined;
|
|
110
|
+
};
|
|
111
|
+
icon?: string | undefined;
|
|
112
|
+
mobileIcon?: string | undefined;
|
|
113
|
+
logoFull?: string | undefined;
|
|
114
|
+
logoSmall?: string | undefined;
|
|
115
|
+
defaultProfileAvatar?: string | undefined;
|
|
116
|
+
defaultGroupAvatar?: string | undefined;
|
|
117
|
+
backgroundAuth?: string | undefined;
|
|
118
|
+
background?: string | undefined;
|
|
119
|
+
};
|
|
120
|
+
info: {
|
|
121
|
+
name: string;
|
|
122
|
+
tagLine: string;
|
|
123
|
+
contactEmail?: string | undefined;
|
|
124
|
+
privacyPolicy?: string | undefined;
|
|
125
|
+
termsAndConditions?: string | undefined;
|
|
126
|
+
};
|
|
127
|
+
content: {
|
|
128
|
+
aboutPage?: string | undefined;
|
|
129
|
+
welcomePage?: string | undefined;
|
|
130
|
+
codeOfConduct?: string | undefined;
|
|
131
|
+
welcomeEmail?: string | undefined;
|
|
132
|
+
pinnedPost?: string | undefined;
|
|
133
|
+
};
|
|
134
|
+
settings: {
|
|
135
|
+
openRegistrations: boolean;
|
|
136
|
+
defaultLanguage?: string | undefined;
|
|
137
|
+
};
|
|
138
|
+
roles: {
|
|
139
|
+
onRegistration: {
|
|
140
|
+
add: string[];
|
|
141
|
+
remove: string[];
|
|
142
|
+
};
|
|
143
|
+
onEmailValidation: {
|
|
144
|
+
add: string[];
|
|
145
|
+
remove: string[];
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
profiles?: {
|
|
149
|
+
additionalFields?: {
|
|
150
|
+
key: string;
|
|
151
|
+
label: string;
|
|
152
|
+
icon?: string | undefined;
|
|
153
|
+
linkPattern?: string | undefined;
|
|
154
|
+
}[] | undefined;
|
|
155
|
+
} | undefined;
|
|
156
|
+
} | null;
|
|
157
|
+
save: (next: CommunityConfig) => Promise<{
|
|
158
|
+
success: true;
|
|
159
|
+
}>;
|
|
160
|
+
updateConfig: (input: Partial<{
|
|
161
|
+
config: any;
|
|
162
|
+
}>, pathParams?: {
|
|
163
|
+
namespace: string;
|
|
164
|
+
name: string;
|
|
165
|
+
} | undefined, queryParams?: undefined, headers?: Record<string, string>) => Promise<{
|
|
166
|
+
success: true;
|
|
167
|
+
}>;
|
|
168
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useOpenpeeps, diffConfigTrees } from '../../../index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Mirrors the Svelte community config pages: load the effective
|
|
5
|
+
* `openpeeps/community` config, edit a clone, and persist only the diff so we
|
|
6
|
+
* never pin current defaults into the stored overrides.
|
|
7
|
+
*/
|
|
8
|
+
export function useCommunityConfig() {
|
|
9
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
10
|
+
const query = openpeepsApi.admin.useConfigRead('openpeeps', 'community');
|
|
11
|
+
const updateConfig = openpeepsApi.admin.updateConfigAction({
|
|
12
|
+
namespace: 'openpeeps',
|
|
13
|
+
name: 'community',
|
|
14
|
+
});
|
|
15
|
+
const base = query.data?.config;
|
|
16
|
+
// Clone resets when the stored config changes (e.g. after a successful save).
|
|
17
|
+
const draft = useMemo(() => (base ? structuredClone(base) : null), [base]);
|
|
18
|
+
const save = (next) => updateConfig({
|
|
19
|
+
config: diffConfigTrees(base, next),
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
isLoading: query.isLoading,
|
|
23
|
+
base,
|
|
24
|
+
draft,
|
|
25
|
+
save,
|
|
26
|
+
updateConfig,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AdminServerStats } from '@openpeepshq/common/types';
|
|
2
|
+
export declare function CommunityStatsCard({ title, current, previous, text, }: {
|
|
3
|
+
title: string;
|
|
4
|
+
current: number;
|
|
5
|
+
previous: number;
|
|
6
|
+
text: string;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export interface BarChartDatum {
|
|
9
|
+
name: string;
|
|
10
|
+
count: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Minimal dependency-free SVG bar chart. Replaces the Svelte LayerChart
|
|
14
|
+
* implementation which is unavailable in the React stack.
|
|
15
|
+
*/
|
|
16
|
+
export declare function BarChart({ data, height, }: {
|
|
17
|
+
data: BarChartDatum[];
|
|
18
|
+
height?: number;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function SignupChart({ stats }: {
|
|
21
|
+
stats: AdminServerStats;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { ChevronDown } from 'lucide-react';
|
|
4
|
+
import { useT } from '../../../index.js';
|
|
5
|
+
import { PopupMenu, PopupMenuButton } from '@openpeepshq/react-ui';
|
|
6
|
+
export function CommunityStatsCard({ title, current, previous, text, }) {
|
|
7
|
+
const change = current - previous;
|
|
8
|
+
return (_jsxs("div", { className: "flex h-36 w-full flex-col items-center justify-center rounded-md border p-4", children: [_jsx("h3", { className: "text-muted-foreground text-sm", children: title }), _jsxs("div", { className: "my-2 flex items-center gap-1", children: [_jsx("span", { className: "text-4xl font-semibold", children: current }), change < 0 ? (_jsxs("span", { className: "text-error flex items-center text-sm", children: ["\u25BC ", Math.abs(change)] })) : change > 0 ? (_jsxs("span", { className: "text-success flex items-center text-sm", children: ["\u25B2 ", change] })) : null] }), _jsxs("div", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [_jsx("p", { children: text }), _jsx("span", { children: "\u00B7" }), _jsx("p", { children: previous })] })] }));
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Minimal dependency-free SVG bar chart. Replaces the Svelte LayerChart
|
|
12
|
+
* implementation which is unavailable in the React stack.
|
|
13
|
+
*/
|
|
14
|
+
export function BarChart({ data, height = 280, }) {
|
|
15
|
+
const max = Math.max(1, ...data.map((d) => d.count));
|
|
16
|
+
const barGap = 8;
|
|
17
|
+
const count = Math.max(1, data.length);
|
|
18
|
+
return (_jsx("div", { className: "w-full", style: { height }, children: _jsx("div", { className: "flex h-full items-end gap-2", style: { gap: barGap }, children: data.map((datum, index) => {
|
|
19
|
+
const ratio = datum.count / max;
|
|
20
|
+
return (_jsxs("div", { className: "flex min-w-0 flex-1 flex-col items-center justify-end", style: { width: `${100 / count}%` }, title: `${datum.name}: ${datum.count}`, children: [_jsx("span", { className: "text-muted-foreground mb-1 text-[10px]", children: datum.count }), _jsx("div", { className: "bg-primary w-full rounded-t", style: { height: `${Math.max(2, ratio * (height - 40))}px` } }), _jsx("span", { className: "text-muted-foreground mt-1 w-full truncate text-center text-[10px]", children: datum.name })] }, `${datum.name}-${index}`));
|
|
21
|
+
}) }) }));
|
|
22
|
+
}
|
|
23
|
+
const SIGNUP_PERIODS = ['week', 'fourWeeks', 'fourMonths'];
|
|
24
|
+
export function SignupChart({ stats }) {
|
|
25
|
+
const t = useT();
|
|
26
|
+
const [period, setPeriod] = useState('week');
|
|
27
|
+
const data = stats.timelines.signups[period] ?? [];
|
|
28
|
+
return (_jsxs("div", { className: "rounded-md border p-4", children: [_jsx(BarChart, { data: data }), _jsxs("div", { className: "mt-2 flex items-center gap-2", children: [_jsx("h2", { className: "text-base capitalize", children: t(`admin.signupChart.${period}`, { defaultValue: 'Signups' }) }), _jsx(PopupMenu, { icon: ChevronDown, iconSize: 20, placement: "bottom-start", children: SIGNUP_PERIODS.map((item) => (_jsx(PopupMenuButton, { title: t(`admin.signupChart.${item}`, { defaultValue: item }), text: t(`admin.signupChart.${item}`, { defaultValue: item }), action: () => setPeriod(item) }, item))) })] })] }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AdminGroup } from '@openpeepshq/common/types';
|
|
2
|
+
export interface AdminGroupCardProps {
|
|
3
|
+
group: AdminGroup;
|
|
4
|
+
onDelete: (group: AdminGroup) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function AdminGroupCard({ group, onDelete }: AdminGroupCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Link, useNavigate } from 'react-router-dom';
|
|
3
|
+
import { Trash, Users } from 'lucide-react';
|
|
4
|
+
import { useT } from '../../../index.js';
|
|
5
|
+
import { Avatar, GroupCard } from '../../../components/index.js';
|
|
6
|
+
import { PopupMenu, PopupMenuButton } from '@openpeepshq/react-ui';
|
|
7
|
+
const formatDate = (value) => value ? new Date(value).toLocaleDateString() : '—';
|
|
8
|
+
const groupVisibility = (capabilities) => {
|
|
9
|
+
if (capabilities?.none?.add?.includes('core-groups-read'))
|
|
10
|
+
return 'public';
|
|
11
|
+
if (capabilities?.local?.add?.includes('core-groups-read'))
|
|
12
|
+
return 'local';
|
|
13
|
+
return 'private';
|
|
14
|
+
};
|
|
15
|
+
const postsVisibility = (capabilities) => {
|
|
16
|
+
if (capabilities?.none?.add?.includes('core-posts-read'))
|
|
17
|
+
return 'public';
|
|
18
|
+
if (capabilities?.local?.add?.includes('core-posts-read'))
|
|
19
|
+
return 'local';
|
|
20
|
+
return 'private';
|
|
21
|
+
};
|
|
22
|
+
const whoCanJoin = (capabilities) => capabilities?.local?.add?.includes('core-groups-join') ? 'open' : 'closed';
|
|
23
|
+
const whoCanPost = (capabilities) => capabilities?.member?.add?.includes('core-posts-create-*')
|
|
24
|
+
? 'members'
|
|
25
|
+
: 'admin';
|
|
26
|
+
export function AdminGroupCard({ group, onDelete }) {
|
|
27
|
+
const t = useT();
|
|
28
|
+
const navigate = useNavigate();
|
|
29
|
+
const visibility = groupVisibility(group.capabilities);
|
|
30
|
+
const contentVisibility = postsVisibility(group.capabilities);
|
|
31
|
+
const joinPolicy = whoCanJoin(group.capabilities);
|
|
32
|
+
const postPolicy = whoCanPost(group.capabilities);
|
|
33
|
+
return (_jsxs("div", { className: "rounded-md border", children: [_jsxs("div", { className: "flex items-center justify-between gap-2 p-2", children: [_jsx(GroupCard, { group: group, showAction: false }), _jsxs(PopupMenu, { placement: "bottom-end", width: "w-56", children: [_jsx(PopupMenuButton, { icon: Users, title: t('groups.viewMembers', { defaultValue: 'View members' }), text: t('groups.viewMembers', { defaultValue: 'View members' }), action: () => navigate(`/admin/groups/@${group.handle}/members`) }), _jsx(PopupMenuButton, { icon: Trash, title: t('admin.groups.delete', { defaultValue: 'Delete group' }), text: t('common.actions.delete', { defaultValue: 'Delete' }), action: () => onDelete(group), danger: true })] })] }), _jsxs("div", { className: "text-muted-foreground grid gap-1 px-3 pb-2 text-xs sm:grid-cols-2", children: [_jsxs("p", { children: [t('admin.groups.created', { defaultValue: 'Created' }), ":", ' ', formatDate(group.createdAt)] }), _jsxs("p", { children: [t('admin.groups.lastPost', { defaultValue: 'Last post' }), ":", ' ', formatDate(group.lastPostAt)] }), _jsxs("p", { children: [t('admin.groups.members', { defaultValue: 'Members' }), ":", ' ', group.membersCount] }), _jsxs("p", { children: [t('admin.groups.posts', { defaultValue: 'Posts' }), ":", ' ', group.postsCount] }), _jsxs("p", { className: "sm:col-span-2", children: [t('admin.groups.settings', { defaultValue: 'Settings' }), ":", ' ', t(`groups.visibility.${visibility}.title`, {
|
|
34
|
+
defaultValue: visibility,
|
|
35
|
+
}), ' · ', t(`groups.postsVisibility.${contentVisibility}.title`, {
|
|
36
|
+
defaultValue: contentVisibility,
|
|
37
|
+
}), ' · ', t(`groups.whoCanJoin.${joinPolicy}.title`, {
|
|
38
|
+
defaultValue: joinPolicy,
|
|
39
|
+
}), ' · ', t(`groups.whoCanPost.${postPolicy}.title`, {
|
|
40
|
+
defaultValue: postPolicy,
|
|
41
|
+
})] })] }), group.admins.length > 0 ? (_jsx("div", { className: "flex flex-wrap gap-2 p-2 pt-0", children: group.admins.map((admin) => (_jsxs(Link, { to: `/@${admin.handle}`, className: "bg-surface hover:bg-surface flex items-center gap-1.5 rounded-full py-0.5 pl-0.5 pr-2 text-xs", children: [_jsx(Avatar, { profile: admin, size: 1.5 }), _jsx("span", { children: admin.displayName || `@${admin.handle}` })] }, admin.id))) })) : null] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AdminInviteActions(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { LinkIcon, MailIcon, PlusIcon } from 'lucide-react';
|
|
4
|
+
import { useT } from '../../../index.js';
|
|
5
|
+
import { PopupMenu, PopupMenuButton } from '@openpeepshq/react-ui';
|
|
6
|
+
import { InviteWithEmailModal } from './InviteWithEmailModal.js';
|
|
7
|
+
import { InviteWithLinkModal } from './InviteWithLinkModal.js';
|
|
8
|
+
export function AdminInviteActions() {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const [activeModal, setActiveModal] = useState(null);
|
|
11
|
+
const newInviteLabel = t('admin.invites.newInvite', {
|
|
12
|
+
defaultValue: 'New Invite',
|
|
13
|
+
});
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { "data-testid": "admin-new-invite-button", children: _jsxs(PopupMenu, { placement: "bottom-end", variant: "default", className: "px-3 py-1.5", title: newInviteLabel, menuButton: _jsx(PlusIcon, { size: 16 }), text: newInviteLabel, children: [_jsx(PopupMenuButton, { icon: LinkIcon, title: t('admin.invites.inviteWithLinkTitle', {
|
|
15
|
+
defaultValue: 'Invite with link',
|
|
16
|
+
}), text: t('admin.invites.inviteWithLinkTitle', {
|
|
17
|
+
defaultValue: 'Invite with link',
|
|
18
|
+
}), action: () => setActiveModal('link') }), _jsx(PopupMenuButton, { icon: MailIcon, title: t('admin.members.inviteWithEmailTitle', {
|
|
19
|
+
defaultValue: 'Invite by email',
|
|
20
|
+
}), text: t('admin.members.inviteWithEmailTitle', {
|
|
21
|
+
defaultValue: 'Invite by email',
|
|
22
|
+
}), action: () => setActiveModal('email') })] }) }), activeModal === 'link' ? (_jsx(InviteWithLinkModal, { onClose: () => setActiveModal(null) })) : null, activeModal === 'email' ? (_jsx(InviteWithEmailModal, { onClose: () => setActiveModal(null) })) : null] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { randomString } from '@openpeepshq/common/lib';
|
|
4
|
+
import { useT, useOpenpeeps } from '../../../index.js';
|
|
5
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, Input, Label, } from '@openpeepshq/react-ui';
|
|
6
|
+
import { DAY_MS, EXPIRY_OPTIONS, UNLIMITED_USES } from './InviteWithLinkModal.js';
|
|
7
|
+
export function InviteWithEmailModal({ onClose }) {
|
|
8
|
+
const t = useT();
|
|
9
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
10
|
+
const createInvite = openpeepsApi.admin.createInviteAction();
|
|
11
|
+
const [emails, setEmails] = useState('');
|
|
12
|
+
const [maxUses, setMaxUses] = useState('1');
|
|
13
|
+
const [expiry, setExpiry] = useState('P1D');
|
|
14
|
+
const [message, setMessage] = useState(t('admin.inviteEmail.defaultMessage', {
|
|
15
|
+
defaultValue: 'You have been invited to join our community.',
|
|
16
|
+
}));
|
|
17
|
+
const [submitting, setSubmitting] = useState(false);
|
|
18
|
+
const [error, setError] = useState(null);
|
|
19
|
+
const [sent, setSent] = useState(false);
|
|
20
|
+
const emailList = emails
|
|
21
|
+
.split(',')
|
|
22
|
+
.map((e) => e.trim())
|
|
23
|
+
.filter(Boolean);
|
|
24
|
+
const submit = async () => {
|
|
25
|
+
setError(null);
|
|
26
|
+
if (emailList.length === 0) {
|
|
27
|
+
setError(t('admin.inviteEmail.emailRequired', {
|
|
28
|
+
defaultValue: 'Enter at least one email address.',
|
|
29
|
+
}));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setSubmitting(true);
|
|
33
|
+
const days = EXPIRY_OPTIONS.find((o) => o.value === expiry)?.days ?? 1;
|
|
34
|
+
const unlimited = maxUses === 'unlimited';
|
|
35
|
+
try {
|
|
36
|
+
await createInvite({
|
|
37
|
+
slug: randomString(8),
|
|
38
|
+
active: true,
|
|
39
|
+
maxUses: unlimited ? UNLIMITED_USES : Number(maxUses),
|
|
40
|
+
expiresAt: new Date(Date.now() + days * DAY_MS).toISOString(),
|
|
41
|
+
emailPatterns: emailList,
|
|
42
|
+
customInvitationMessage: message,
|
|
43
|
+
});
|
|
44
|
+
setSent(true);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
setError(err.message);
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
setSubmitting(false);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-md", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('admin.inviteEmail.title', {
|
|
54
|
+
defaultValue: 'Invite by Email',
|
|
55
|
+
}) }) }), sent ? (_jsx("p", { className: "text-success px-1 text-sm", children: t('admin.inviteEmail.success', {
|
|
56
|
+
defaultValue: 'Invitations sent.',
|
|
57
|
+
}) })) : (_jsxs("div", { className: "space-y-4 px-1", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "invite-emails", children: t('admin.inviteEmail.emailAddress', {
|
|
58
|
+
defaultValue: 'Email addresses',
|
|
59
|
+
}) }), _jsx(Input, { id: "invite-emails", value: emails, placeholder: t('admin.inviteEmail.emailPlaceholder', {
|
|
60
|
+
defaultValue: 'email1@example.com, email2@example.com',
|
|
61
|
+
}), onChange: (e) => setEmails(e.target.value) }), emailList.length > 0 ? (_jsx("div", { className: "flex flex-wrap gap-2", children: emailList.map((email) => (_jsx("span", { className: "bg-surface-2 rounded-md border px-2 py-0.5 text-xs", children: email }, email))) })) : null] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "invite-message", children: t('admin.inviteEmail.composeMessage', {
|
|
62
|
+
defaultValue: 'Compose a message',
|
|
63
|
+
}) }), _jsx("textarea", { id: "invite-message", className: "border-input bg-background min-h-32 w-full rounded-md border p-2 text-sm", value: message, onChange: (e) => setMessage(e.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "invite-email-uses", children: t('admin.inviteLink.numberOfUses', {
|
|
64
|
+
defaultValue: 'Number of Uses',
|
|
65
|
+
}) }), _jsxs("select", { id: "invite-email-uses", className: "border-input bg-background w-full rounded-md border p-2 text-sm", value: maxUses, onChange: (e) => setMaxUses(e.target.value), children: [['1', '5', '10', '15', '20'].map((n) => (_jsx("option", { value: n, children: n }, n))), _jsx("option", { value: "unlimited", children: t('admin.inviteLink.unlimited', {
|
|
66
|
+
defaultValue: 'Unlimited',
|
|
67
|
+
}) })] })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "invite-email-expiry", children: t('admin.inviteEmail.expiresAfter', {
|
|
68
|
+
defaultValue: 'Expires After',
|
|
69
|
+
}) }), _jsxs("select", { id: "invite-email-expiry", className: "border-input bg-background w-full rounded-md border p-2 text-sm", value: expiry, onChange: (e) => setExpiry(e.target.value), children: [_jsx("option", { value: "P1D", children: t('admin.inviteEmail.expires1Day', {
|
|
70
|
+
defaultValue: 'One Day',
|
|
71
|
+
}) }), _jsx("option", { value: "P2D", children: t('admin.inviteEmail.expires2Days', {
|
|
72
|
+
defaultValue: 'Two Days',
|
|
73
|
+
}) }), _jsx("option", { value: "P1W", children: t('admin.inviteEmail.expires1Week', {
|
|
74
|
+
defaultValue: 'One Week',
|
|
75
|
+
}) }), _jsx("option", { value: "P1M", children: t('admin.inviteEmail.expires1Month', {
|
|
76
|
+
defaultValue: 'One Month',
|
|
77
|
+
}) }), _jsx("option", { value: "P100Y", children: t('admin.inviteEmail.expiresNever', {
|
|
78
|
+
defaultValue: 'Never',
|
|
79
|
+
}) })] })] }), error ? (_jsx("p", { className: "border-error/40 text-error rounded-md border p-2 text-sm", children: error })) : null] })), _jsx(DialogFooter, { children: sent ? (_jsx(Button, { variant: "default", action: onClose, children: t('admin.inviteLink.done', { defaultValue: 'Done' }) })) : (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "default", action: submit, disabled: submitting, children: t('admin.inviteEmail.sendInvite', {
|
|
80
|
+
defaultValue: 'Send Invite',
|
|
81
|
+
}) })] })) })] }) }));
|
|
82
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const DAY_MS: number;
|
|
2
|
+
export declare const EXPIRY_OPTIONS: readonly [{
|
|
3
|
+
readonly value: "P1D";
|
|
4
|
+
readonly days: 1;
|
|
5
|
+
}, {
|
|
6
|
+
readonly value: "P2D";
|
|
7
|
+
readonly days: 2;
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "P1W";
|
|
10
|
+
readonly days: 7;
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "P1M";
|
|
13
|
+
readonly days: 30;
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "P100Y";
|
|
16
|
+
readonly days: number;
|
|
17
|
+
}];
|
|
18
|
+
export declare const UNLIMITED_USES = 1000;
|
|
19
|
+
export declare function inviteUrl(slug: string): string;
|
|
20
|
+
export declare function InviteWithLinkModal({ onClose }: {
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Copy } from 'lucide-react';
|
|
4
|
+
import { randomString } from '@openpeepshq/common/lib';
|
|
5
|
+
import { useT, useOpenpeeps } from '../../../index.js';
|
|
6
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, Input, Label, } from '@openpeepshq/react-ui';
|
|
7
|
+
export const DAY_MS = 24 * 60 * 60 * 1000;
|
|
8
|
+
export const EXPIRY_OPTIONS = [
|
|
9
|
+
{ value: 'P1D', days: 1 },
|
|
10
|
+
{ value: 'P2D', days: 2 },
|
|
11
|
+
{ value: 'P1W', days: 7 },
|
|
12
|
+
{ value: 'P1M', days: 30 },
|
|
13
|
+
{ value: 'P100Y', days: 365 * 100 },
|
|
14
|
+
];
|
|
15
|
+
export const UNLIMITED_USES = 1000;
|
|
16
|
+
export function inviteUrl(slug) {
|
|
17
|
+
const origin = typeof window !== 'undefined' ? window.location.origin : '';
|
|
18
|
+
return `${origin}/auth/register/invitation?inviteCode=${slug}`;
|
|
19
|
+
}
|
|
20
|
+
export function InviteWithLinkModal({ onClose }) {
|
|
21
|
+
const t = useT();
|
|
22
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
23
|
+
const createInvite = openpeepsApi.admin.createInviteAction();
|
|
24
|
+
const groupsQuery = openpeepsApi.useGroups();
|
|
25
|
+
const [slug, setSlug] = useState('');
|
|
26
|
+
const [maxUses, setMaxUses] = useState('1');
|
|
27
|
+
const [expiry, setExpiry] = useState('P1D');
|
|
28
|
+
const [selectedGroups, setSelectedGroups] = useState(() => new Set());
|
|
29
|
+
const [createdSlug, setCreatedSlug] = useState(null);
|
|
30
|
+
const [submitting, setSubmitting] = useState(false);
|
|
31
|
+
const [error, setError] = useState(null);
|
|
32
|
+
const [copied, setCopied] = useState(false);
|
|
33
|
+
const groups = groupsQuery.data ?? [];
|
|
34
|
+
const toggleGroup = (id, checked) => setSelectedGroups((prev) => {
|
|
35
|
+
const next = new Set(prev);
|
|
36
|
+
if (checked)
|
|
37
|
+
next.add(id);
|
|
38
|
+
else
|
|
39
|
+
next.delete(id);
|
|
40
|
+
return next;
|
|
41
|
+
});
|
|
42
|
+
const submit = async () => {
|
|
43
|
+
setError(null);
|
|
44
|
+
setSubmitting(true);
|
|
45
|
+
const finalSlug = slug || randomString(8);
|
|
46
|
+
const days = EXPIRY_OPTIONS.find((o) => o.value === expiry)?.days ?? 1;
|
|
47
|
+
const unlimited = maxUses === 'unlimited';
|
|
48
|
+
try {
|
|
49
|
+
const result = await createInvite({
|
|
50
|
+
slug: finalSlug,
|
|
51
|
+
active: true,
|
|
52
|
+
maxUses: unlimited ? UNLIMITED_USES : Number(maxUses),
|
|
53
|
+
expiresAt: new Date(Date.now() + days * DAY_MS).toISOString(),
|
|
54
|
+
...(selectedGroups.size
|
|
55
|
+
? { groupIds: Array.from(selectedGroups) }
|
|
56
|
+
: {}),
|
|
57
|
+
});
|
|
58
|
+
setCreatedSlug(result.slug ?? finalSlug);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
setError(err.message);
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
setSubmitting(false);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const copy = async () => {
|
|
68
|
+
if (!createdSlug)
|
|
69
|
+
return;
|
|
70
|
+
await navigator.clipboard.writeText(inviteUrl(createdSlug));
|
|
71
|
+
setCopied(true);
|
|
72
|
+
};
|
|
73
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-md", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('admin.inviteLink.title', {
|
|
74
|
+
defaultValue: 'Create Invite Link',
|
|
75
|
+
}) }) }), createdSlug ? (_jsxs("div", { className: "space-y-3 px-1", children: [_jsxs("div", { className: "bg-surface flex items-center gap-2 rounded-md border p-2", children: [_jsx("span", { className: "flex-1 break-all text-xs", children: inviteUrl(createdSlug) }), _jsx("button", { type: "button", title: t('admin.inviteLink.copyToClipboard', {
|
|
76
|
+
defaultValue: 'Copy to Clipboard',
|
|
77
|
+
}), onClick: copy, children: _jsx(Copy, { size: 18 }) })] }), copied ? (_jsx("p", { className: "text-success text-xs", children: t('admin.invites.copiedToClipboard', {
|
|
78
|
+
defaultValue: 'Copied to clipboard',
|
|
79
|
+
}) })) : null] })) : (_jsxs("div", { className: "space-y-4 px-1", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.inviteLink.description', {
|
|
80
|
+
defaultValue: 'Invite Links can be limited to a number of uses or by date',
|
|
81
|
+
}) }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "invite-slug", children: t('admin.invites.linkHeading', { defaultValue: 'Link' }) }), _jsx(Input, { id: "invite-slug", value: slug, placeholder: t('admin.inviteLink.generateButton', {
|
|
82
|
+
defaultValue: 'Create Link',
|
|
83
|
+
}), onChange: (e) => setSlug(e.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "invite-uses", children: t('admin.inviteLink.numberOfUses', {
|
|
84
|
+
defaultValue: 'Number of Uses',
|
|
85
|
+
}) }), _jsxs("select", { id: "invite-uses", className: "border-input bg-background w-full rounded-md border p-2 text-sm", value: maxUses, onChange: (e) => setMaxUses(e.target.value), children: [['1', '5', '10', '15', '20'].map((n) => (_jsx("option", { value: n, children: n }, n))), _jsx("option", { value: "unlimited", children: t('admin.inviteLink.unlimited', {
|
|
86
|
+
defaultValue: 'Unlimited',
|
|
87
|
+
}) })] })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "invite-expiry", children: t('admin.inviteLink.expiresAfter', {
|
|
88
|
+
defaultValue: 'Expires After',
|
|
89
|
+
}) }), _jsxs("select", { id: "invite-expiry", className: "border-input bg-background w-full rounded-md border p-2 text-sm", value: expiry, onChange: (e) => setExpiry(e.target.value), children: [_jsx("option", { value: "P1D", children: t('admin.inviteLink.oneDay', { defaultValue: 'One Day' }) }), _jsx("option", { value: "P2D", children: t('admin.inviteLink.twoDays', { defaultValue: 'Two Days' }) }), _jsx("option", { value: "P1W", children: t('admin.inviteLink.oneWeek', { defaultValue: 'One Week' }) }), _jsx("option", { value: "P1M", children: t('admin.inviteLink.oneMonth', {
|
|
90
|
+
defaultValue: 'One Month',
|
|
91
|
+
}) }), _jsx("option", { value: "P100Y", children: t('admin.inviteLink.never', { defaultValue: 'Never' }) })] })] }), groups.length > 0 ? (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "invite-groups", children: t('admin.inviteLink.autoJoinGroups', {
|
|
92
|
+
defaultValue: 'Auto-join groups',
|
|
93
|
+
}) }), _jsx("p", { className: "text-muted-foreground text-xs", children: t('admin.inviteLink.autoJoinGroupsHint', {
|
|
94
|
+
defaultValue: 'People who register with this link are added as members of the groups you select.',
|
|
95
|
+
}) }), _jsx("div", { id: "invite-groups", className: "max-h-40 space-y-1 overflow-y-auto rounded-md border p-2", children: groups.map((g) => (_jsxs("label", { className: "flex items-center justify-between gap-2 text-sm", children: [_jsx("span", { children: g.displayName || `@${g.handle}` }), _jsx("input", { type: "checkbox", className: "size-4", checked: selectedGroups.has(g.id), onChange: (e) => toggleGroup(g.id, e.target.checked) })] }, g.id))) })] })) : null, error ? (_jsx("p", { className: "border-error/40 text-error rounded-md border p-2 text-sm", children: error })) : null] })), _jsx(DialogFooter, { children: createdSlug ? (_jsx(Button, { variant: "default", action: onClose, children: t('admin.inviteLink.done', { defaultValue: 'Done' }) })) : (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", action: onClose, children: t('common.cancel', { defaultValue: 'Cancel' }) }), _jsx(Button, { variant: "default", action: submit, disabled: submitting, children: t('admin.inviteLink.generateButton', {
|
|
96
|
+
defaultValue: 'Create Link',
|
|
97
|
+
}) })] })) })] }) }));
|
|
98
|
+
}
|