@openpeepshq/react 0.2.5 → 0.2.6
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/CapabilityMatrix.d.ts +24 -0
- package/dist/components/CapabilityMatrix.js +51 -0
- package/dist/components/RelationCapabilitiesEditor.d.ts +1 -0
- package/dist/components/RelationCapabilitiesEditor.js +138 -0
- package/dist/components/RoleCapabilityMatrix.d.ts +10 -0
- package/dist/components/RoleCapabilityMatrix.js +100 -0
- package/dist/components/accounts/SignUpLoginModal.js +7 -5
- package/dist/components/configuration/ConfigMenuButton.d.ts +3 -1
- package/dist/components/configuration/ConfigMenuButton.js +2 -2
- package/dist/components/configuration/ConfigurationList.js +7 -4
- package/dist/components/configuration/ConfigurationValueEditor.js +2 -2
- package/dist/components/conversations/ConversationParticipantsModal.d.ts +7 -0
- package/dist/components/conversations/ConversationParticipantsModal.js +10 -0
- package/dist/components/conversations/CreateNewConversation.js +9 -7
- package/dist/components/conversations/MessageInThread.js +4 -1
- package/dist/components/conversations/index.d.ts +2 -0
- package/dist/components/conversations/index.js +1 -0
- package/dist/components/form/ImageEditModal.js +4 -4
- package/dist/components/form/LocationInput.js +2 -2
- package/dist/components/form/TimeZoneSelect.d.ts +7 -0
- package/dist/components/form/TimeZoneSelect.js +7 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/groups/ChangeGroupRolesModal.js +15 -4
- package/dist/components/groups/ConfirmGroupExitModal.js +4 -2
- package/dist/components/groups/ConfirmMemberRemovalModal.js +4 -2
- package/dist/components/groups/DeleteGroupModal.js +4 -2
- package/dist/components/groups/GroupAvatar.d.ts +2 -1
- package/dist/components/groups/GroupAvatar.js +9 -12
- package/dist/components/groups/GroupCapabilityMatrix.d.ts +6 -0
- package/dist/components/groups/GroupCapabilityMatrix.js +12 -0
- package/dist/components/groups/GroupCard.js +2 -2
- package/dist/components/groups/GroupFeed.js +2 -1
- package/dist/components/groups/GroupForm.d.ts +11 -1
- package/dist/components/groups/GroupForm.js +14 -67
- package/dist/components/groups/GroupMembersList.js +25 -17
- package/dist/components/groups/GroupOptionsMenu.js +13 -10
- package/dist/components/groups/index.d.ts +3 -1
- package/dist/components/groups/index.js +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +3 -0
- package/dist/components/jams/CreateNewJam.js +5 -127
- package/dist/components/jams/JamCallParticipant.d.ts +7 -1
- package/dist/components/jams/JamCallParticipant.js +28 -38
- package/dist/components/jams/JamCapacityGate.d.ts +2 -1
- package/dist/components/jams/JamCapacityGate.js +2 -2
- package/dist/components/jams/JamChatDrawer.js +12 -47
- package/dist/components/jams/JamChatMessage.d.ts +3 -2
- package/dist/components/jams/JamChatMessage.js +13 -4
- package/dist/components/jams/JamConference.js +4 -3
- package/dist/components/jams/JamContext.d.ts +8 -3
- package/dist/components/jams/JamContext.js +4 -7
- package/dist/components/jams/JamDetailsDrawer.js +11 -8
- package/dist/components/jams/JamEventsContext.d.ts +3 -1
- package/dist/components/jams/JamEventsContext.js +1 -3
- package/dist/components/jams/JamFooter.js +12 -78
- package/dist/components/jams/JamGuestForm.js +0 -1
- package/dist/components/jams/JamLobby.d.ts +2 -6
- package/dist/components/jams/JamLobby.js +11 -57
- package/dist/components/jams/JamObserverShell.js +1 -1
- package/dist/components/jams/JamParticipantConference.js +5 -2
- package/dist/components/jams/JamPeopleDrawer.js +5 -41
- package/dist/components/jams/JamRequestJoin.d.ts +2 -6
- package/dist/components/jams/JamRequestJoin.js +3 -21
- package/dist/components/jams/JamRoom.d.ts +2 -1
- package/dist/components/jams/JamRoom.js +13 -175
- package/dist/components/jams/JamToolbarButton.js +2 -2
- package/dist/components/jams/JamVideoCall.d.ts +3 -2
- package/dist/components/jams/JamVideoCall.js +1 -1
- package/dist/components/jams/JamVideoLayout.d.ts +2 -2
- package/dist/components/jams/JamVideoLayout.js +81 -26
- package/dist/components/jams/LeaveCloseButton.js +2 -1
- package/dist/components/jams/LiveJamsSection.js +1 -1
- package/dist/components/jams/disconnectReason.d.ts +6 -0
- package/dist/components/jams/disconnectReason.js +19 -0
- package/dist/components/jams/jamEventActions.d.ts +3 -0
- package/dist/components/jams/jamEventActions.js +10 -0
- package/dist/components/jams/jamRecordingState.d.ts +6 -0
- package/dist/components/jams/jamRecordingState.js +15 -1
- package/dist/components/jams/reactionEmojis.d.ts +1 -28
- package/dist/components/jams/reactionEmojis.js +1 -55
- package/dist/components/jams/speakerLayout.d.ts +19 -0
- package/dist/components/jams/speakerLayout.js +33 -0
- package/dist/components/jams/useJamSpotlight.d.ts +14 -0
- package/dist/components/jams/useJamSpotlight.js +72 -0
- package/dist/components/layout/Auth.js +20 -3
- package/dist/components/layout/IdentityContext.js +7 -1
- package/dist/components/layout/OpenpeepsThemeProvider.d.ts +15 -0
- package/dist/components/layout/OpenpeepsThemeProvider.js +13 -3
- package/dist/components/layout/ProfileProvider.d.ts +2 -2
- package/dist/components/layout/ProfileProvider.js +15 -32
- package/dist/components/layout/Root.js +1 -1
- package/dist/components/layout/useProfileIdentity.d.ts +59 -0
- package/dist/components/layout/useProfileIdentity.js +38 -0
- package/dist/components/markdown/OpenpeepsMarkdown.js +2 -9
- package/dist/components/markdown/classes.d.ts +2 -2
- package/dist/components/markdown/classes.js +2 -2
- package/dist/components/markdown/staticRender.d.ts +2 -0
- package/dist/components/navigation/ContentHeader.js +1 -1
- package/dist/components/navigation/FooterMobile.js +4 -1
- package/dist/components/navigation/HeaderMobile.js +6 -2
- package/dist/components/navigation/MobileMenuItem.d.ts +3 -1
- package/dist/components/navigation/MobileMenuItem.js +6 -4
- package/dist/components/navigation/PlusButton.js +1 -1
- package/dist/components/navigation/SideBar.js +5 -1
- package/dist/components/notifications/NotificationHeaderActions.js +3 -1
- package/dist/components/notifications/NotificationsList.js +28 -16
- package/dist/components/notifications/TypedNotification.js +50 -6
- package/dist/components/post/CompactReplyParent.d.ts +7 -0
- package/dist/components/post/CompactReplyParent.js +121 -0
- package/dist/components/post/EventViewSwitch.d.ts +1 -0
- package/dist/components/post/EventViewSwitch.js +15 -0
- package/dist/components/post/Feed.d.ts +3 -1
- package/dist/components/post/Feed.js +11 -5
- package/dist/components/post/FeedFormatSwitch.d.ts +1 -0
- package/dist/components/post/FeedFormatSwitch.js +16 -0
- package/dist/components/post/FeedPost.js +9 -19
- package/dist/components/post/FeedPostContent.js +8 -1
- package/dist/components/post/FullPostLayout.js +8 -11
- package/dist/components/post/PinnedPost.js +1 -1
- package/dist/components/post/feed/events/EventsCalendar.d.ts +7 -0
- package/dist/components/post/feed/events/EventsCalendar.js +54 -0
- package/dist/components/post/feed/events/EventsView.d.ts +10 -0
- package/dist/components/post/feed/events/EventsView.js +9 -0
- package/dist/components/post/feed/events/eventCalendar.d.ts +36 -0
- package/dist/components/post/feed/events/eventCalendar.js +145 -0
- package/dist/components/post/feed/threaded/ThreadedFeed.d.ts +1 -4
- package/dist/components/post/feed/threaded/ThreadedFeed.js +5 -2
- package/dist/components/post/helpers.js +3 -1
- package/dist/components/post/index.d.ts +11 -0
- package/dist/components/post/index.js +6 -0
- package/dist/components/post/pieces/Attachments.js +19 -13
- package/dist/components/post/pieces/AudioAttachment.d.ts +13 -0
- package/dist/components/post/pieces/AudioAttachment.js +93 -0
- package/dist/components/post/pieces/EventLocation.d.ts +2 -1
- package/dist/components/post/pieces/EventLocation.js +13 -9
- package/dist/components/post/pieces/EventMenu.d.ts +2 -1
- package/dist/components/post/pieces/EventMenu.js +26 -26
- package/dist/components/post/pieces/EventOccurrenceList.d.ts +10 -0
- package/dist/components/post/pieces/EventOccurrenceList.js +49 -0
- package/dist/components/post/pieces/EventRsvpButton.d.ts +3 -1
- package/dist/components/post/pieces/EventRsvpButton.js +15 -37
- package/dist/components/post/pieces/EventRsvpList.d.ts +12 -0
- package/dist/components/post/pieces/EventRsvpList.js +108 -0
- package/dist/components/post/pieces/EventRsvpScopeDialog.d.ts +16 -0
- package/dist/components/post/pieces/EventRsvpScopeDialog.js +92 -0
- package/dist/components/post/pieces/FeedPostStats.js +5 -4
- package/dist/components/post/pieces/FeedThreadPreview.d.ts +9 -0
- package/dist/components/post/pieces/FeedThreadPreview.js +37 -0
- package/dist/components/post/pieces/GalleryModal.js +8 -5
- package/dist/components/post/pieces/PollContent.js +8 -4
- package/dist/components/post/pieces/PostActions.js +2 -2
- package/dist/components/post/pieces/PostMenu.js +17 -1
- package/dist/components/post/pieces/ShareMenu.js +11 -16
- package/dist/components/post/pieces/VideoPlayer.js +1 -1
- package/dist/components/post/pieces/modals/DeletePostModal.js +6 -2
- package/dist/components/post/pieces/modals/ReactionsModal.js +2 -3
- package/dist/components/post/post-form/ArticleForm.js +2 -14
- package/dist/components/post/post-form/AttachmentCard.js +18 -7
- package/dist/components/post/post-form/ComposeAttachments.d.ts +1 -0
- package/dist/components/post/post-form/ComposeAttachments.js +30 -7
- package/dist/components/post/post-form/DescriptionEditModal.js +2 -2
- package/dist/components/post/post-form/EditPostModal.js +9 -7
- package/dist/components/post/post-form/EventForm.d.ts +2 -1
- package/dist/components/post/post-form/EventForm.js +41 -61
- package/dist/components/post/post-form/EventTypeSwitcher.d.ts +1 -1
- package/dist/components/post/post-form/EventTypeSwitcher.js +15 -134
- package/dist/components/post/post-form/NewPostModal.js +14 -9
- package/dist/components/post/post-form/NewPostModalContext.js +6 -2
- package/dist/components/post/post-form/OpenpeepsMarkdownInput.js +1 -1
- package/dist/components/post/post-form/PollComposerFields.js +7 -5
- package/dist/components/post/post-form/PostAudienceSelector.js +4 -2
- package/dist/components/post/post-form/PostTypeSwitcher.d.ts +5 -2
- package/dist/components/post/post-form/PostTypeSwitcher.js +19 -1
- package/dist/components/post/post-form/ReplyModal.js +13 -9
- package/dist/components/post/post-form/ReplyModalContext.d.ts +5 -8
- package/dist/components/post/post-form/ReplyModalContext.js +9 -12
- package/dist/components/post/post-form/audienceChoices.d.ts +4 -6
- package/dist/components/post/post-form/audienceChoices.js +12 -63
- package/dist/components/post/types/Article.js +3 -1
- package/dist/components/post/types/Event.js +13 -2
- package/dist/components/post/types/article/FullArticle.js +5 -1
- package/dist/components/post/types/event/CardEvent.d.ts +2 -1
- package/dist/components/post/types/event/CardEvent.js +16 -10
- package/dist/components/post/types/event/FullEvent.js +78 -44
- package/dist/components/preview-link/local/PostPreview.js +3 -2
- package/dist/components/profile/Avatar.d.ts +3 -3
- package/dist/components/profile/Avatar.js +15 -15
- package/dist/components/profile/FollowUnfollowButton.d.ts +2 -1
- package/dist/components/profile/FollowUnfollowButton.js +8 -15
- package/dist/components/profile/ProfileActivitySummary.d.ts +5 -0
- package/dist/components/profile/ProfileActivitySummary.js +41 -0
- package/dist/components/profile/ProfileCard.js +3 -1
- package/dist/components/profile/ProfileHeader.js +7 -1
- package/dist/components/profile/ProfilePageAction.js +46 -4
- package/dist/components/profile/ProfilePostsAndReplies.d.ts +4 -3
- package/dist/components/profile/ProfilePostsAndReplies.js +8 -5
- package/dist/components/profile/ProfileSelector.js +2 -2
- package/dist/components/profile/ProfileWithActionCard.d.ts +3 -1
- package/dist/components/profile/ProfileWithActionCard.js +2 -2
- package/dist/components/profile/ReportProfileOrPostModal.js +7 -7
- package/dist/components/profile/index.d.ts +2 -0
- package/dist/components/profile/index.js +1 -0
- package/dist/components/profile/profileFieldDisplay.d.ts +8 -0
- package/dist/components/profile/profileFieldDisplay.js +36 -0
- package/dist/components/registry/PluginRegistryProvider.d.ts +1 -0
- package/dist/components/registry/PluginRegistryProvider.js +6 -1
- package/dist/components/registry/PluginSlot.js +1 -1
- package/dist/components/server-data/context.d.ts +18 -1
- package/dist/contexts/openpeeps/helpers.js +12 -1
- package/dist/contexts/openpeeps/hooks/accounts.js +42 -1
- package/dist/contexts/openpeeps/hooks/admin.d.ts +10065 -4
- package/dist/contexts/openpeeps/hooks/admin.js +17 -0
- package/dist/contexts/openpeeps/hooks/auth.d.ts +2 -1
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +12 -10140
- package/dist/contexts/openpeeps/hooks/conversations.js +8 -2
- package/dist/contexts/openpeeps/hooks/groups.d.ts +15 -3
- package/dist/contexts/openpeeps/hooks/jams.d.ts +7273 -606
- package/dist/contexts/openpeeps/hooks/jams.js +20 -5
- package/dist/contexts/openpeeps/hooks/other.d.ts +18 -1
- package/dist/contexts/openpeeps/hooks/posts.d.ts +64999 -11998
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +49 -7101
- package/dist/contexts/openpeeps/hooks/profiles.js +24 -4
- package/dist/contexts/openpeeps/hooks/search.d.ts +13 -9948
- package/dist/contexts/openpeeps/index.js +18 -9
- package/dist/hooks/auth/useAuthForms.d.ts +25 -0
- package/dist/hooks/auth/useAuthForms.js +101 -0
- package/dist/hooks/community/useCommunityInfoPages.d.ts +10 -0
- package/dist/hooks/community/useCommunityInfoPages.js +18 -0
- package/dist/hooks/conversations/useCreateConversation.d.ts +14 -2
- package/dist/hooks/events/useEventComposer.d.ts +10965 -0
- package/dist/hooks/events/useEventComposer.js +164 -0
- package/dist/hooks/events/useEventForm.d.ts +108 -0
- package/dist/hooks/events/useEventForm.js +154 -0
- package/dist/hooks/events/useEventMenu.d.ts +9 -0
- package/dist/hooks/events/useEventMenu.js +47 -0
- package/dist/hooks/events/useEventRsvp.d.ts +99 -0
- package/dist/hooks/events/useEventRsvp.js +111 -0
- package/dist/hooks/events/useEventTypeSwitcher.d.ts +102 -0
- package/dist/hooks/events/useEventTypeSwitcher.js +160 -0
- package/dist/hooks/events/useEventsCalendar.d.ts +19822 -0
- package/dist/hooks/events/useEventsCalendar.js +89 -0
- package/dist/hooks/groups/useEditGroup.d.ts +87 -0
- package/dist/hooks/groups/useEditGroup.js +80 -0
- package/dist/hooks/groups/useGroupTemplateSelection.d.ts +22 -0
- package/dist/hooks/groups/useGroupTemplateSelection.js +67 -0
- package/dist/hooks/groups/useNewGroup.d.ts +152 -0
- package/dist/hooks/groups/useNewGroup.js +75 -0
- package/dist/hooks/index.d.ts +58 -0
- package/dist/hooks/index.js +36 -0
- package/dist/hooks/jams/useCreateNewJamForm.d.ts +543 -0
- package/dist/hooks/jams/useCreateNewJamForm.js +140 -0
- package/dist/hooks/jams/useJamChat.d.ts +78 -0
- package/dist/hooks/jams/useJamChat.js +64 -0
- package/dist/hooks/jams/useJamDetails.d.ts +9921 -0
- package/dist/hooks/jams/useJamDetails.js +74 -0
- package/dist/hooks/jams/useJamFooterControls.d.ts +27 -0
- package/dist/hooks/jams/useJamFooterControls.js +92 -0
- package/dist/hooks/jams/useJamLobby.d.ts +105 -0
- package/dist/hooks/jams/useJamLobby.js +61 -0
- package/dist/hooks/jams/useJamParticipant.d.ts +11 -0
- package/dist/hooks/jams/useJamParticipant.js +49 -0
- package/dist/hooks/jams/useJamPeople.d.ts +79 -0
- package/dist/hooks/jams/useJamPeople.js +63 -0
- package/dist/hooks/jams/useJamRoom.d.ts +19934 -0
- package/dist/hooks/jams/useJamRoom.js +216 -0
- package/dist/hooks/jams/useJamStage.d.ts +21 -0
- package/dist/hooks/jams/useJamStage.js +48 -0
- package/dist/hooks/jams/useLeaveCloseJam.d.ts +2 -1
- package/dist/hooks/jams/useLeaveCloseJam.js +3 -3
- package/dist/hooks/posts/replyOpener.d.ts +9 -0
- package/dist/hooks/posts/replyOpener.js +12 -0
- package/dist/hooks/posts/useArticleComposer.d.ts +10879 -0
- package/dist/hooks/posts/useArticleComposer.js +112 -0
- package/dist/hooks/posts/useFeedPostActions.d.ts +3 -1
- package/dist/hooks/posts/useFeedPostActions.js +21 -10
- package/dist/hooks/posts/useFeedPostPresentation.d.ts +19827 -0
- package/dist/hooks/posts/useFeedPostPresentation.js +39 -0
- package/dist/hooks/posts/usePostDetailTitle.d.ts +9906 -0
- package/dist/hooks/posts/usePostDetailTitle.js +32 -0
- package/dist/hooks/posts/usePostThreads.d.ts +6 -0
- package/dist/hooks/posts/usePostThreads.js +17 -0
- package/dist/hooks/posts/useShareMenu.d.ts +14 -0
- package/dist/hooks/posts/useShareMenu.js +24 -0
- package/dist/hooks/profile/useFollowProfile.d.ts +8 -0
- package/dist/hooks/profile/useFollowProfile.js +21 -0
- package/dist/hooks/settings/useAccessTokens.d.ts +61 -0
- package/dist/hooks/settings/useAccessTokens.js +128 -0
- package/dist/hooks/settings/useFeedFormatPreference.d.ts +8 -0
- package/dist/hooks/settings/useFeedFormatPreference.js +35 -0
- package/dist/hooks/settings/useLanguagePreference.d.ts +11 -0
- package/dist/hooks/settings/useLanguagePreference.js +55 -0
- package/dist/hooks/settings/useNotificationPreferences.d.ts +26 -0
- package/dist/hooks/settings/useNotificationPreferences.js +79 -0
- package/dist/hooks/settings/usePushEnabledDevices.d.ts +111 -0
- package/dist/hooks/settings/usePushEnabledDevices.js +63 -0
- package/dist/hooks/settings/useThemePreference.d.ts +7 -0
- package/dist/hooks/settings/useThemePreference.js +27 -0
- package/dist/hooks/settings/useTimezonePreference.d.ts +14 -0
- package/dist/hooks/settings/useTimezonePreference.js +52 -0
- package/dist/hooks/useResolvedFeedFormat.d.ts +16 -0
- package/dist/hooks/useResolvedFeedFormat.js +20 -0
- package/dist/i18n/I18nProvider.js +21 -15
- package/dist/i18n/index.d.ts +14 -0
- package/dist/i18n/index.js +26 -0
- package/dist/lib/analyticsClicks.d.ts +1 -1
- package/dist/lib/analyticsClicks.js +4 -10
- package/dist/lib/audienceChoices.d.ts +14 -0
- package/dist/lib/audienceChoices.js +50 -0
- package/dist/lib/audienceSetting.d.ts +6 -0
- package/dist/lib/audienceSetting.js +18 -0
- package/dist/lib/capabilityMatrix.d.ts +76 -0
- package/dist/lib/capabilityMatrix.js +274 -0
- package/dist/lib/configuration/helpers.d.ts +12 -0
- package/dist/lib/configuration/helpers.js +38 -2
- package/dist/lib/groupCapabilityMatrix.d.ts +12 -0
- package/dist/lib/groupCapabilityMatrix.js +17 -0
- package/dist/lib/groupFormErrors.d.ts +15 -0
- package/dist/lib/groupFormErrors.js +61 -0
- package/dist/lib/initialsAvatar.d.ts +7 -0
- package/dist/lib/initialsAvatar.js +23 -0
- package/dist/lib/notificationBadge.d.ts +6 -2
- package/dist/lib/notificationBadge.js +17 -0
- package/dist/lib/reactionEmojis.d.ts +28 -0
- package/dist/lib/reactionEmojis.js +55 -0
- package/dist/navigation/targets.d.ts +2 -1
- package/dist/pages/About.js +4 -7
- package/dist/pages/CodeOfConduct.js +4 -5
- package/dist/pages/Explore.js +2 -2
- package/dist/pages/PostDetail.js +11 -20
- package/dist/pages/Profile.js +9 -2
- package/dist/pages/Tags.d.ts +1 -1
- package/dist/pages/Tags.js +48 -6
- package/dist/pages/Tags.test.d.ts +1 -0
- package/dist/pages/Tags.test.js +75 -0
- package/dist/pages/Welcome.js +1 -1
- package/dist/pages/admin/Analytics.d.ts +1 -0
- package/dist/pages/admin/Analytics.js +1 -0
- package/dist/pages/admin/ConfigEditor.js +4 -8
- package/dist/pages/admin/Configuration.js +18 -2
- package/dist/pages/admin/ConfigurationCommunity.js +1 -1
- package/dist/pages/admin/ConfigurationCommunityFeed.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunityFeed.js +69 -0
- package/dist/pages/admin/ConfigurationCommunityTimezone.d.ts +1 -0
- package/dist/pages/admin/ConfigurationCommunityTimezone.js +69 -0
- package/dist/pages/admin/ConfigurationPluginPage.d.ts +1 -0
- package/dist/pages/admin/ConfigurationPluginPage.js +21 -0
- package/dist/pages/admin/ConfigurationSso.d.ts +1 -0
- package/dist/pages/admin/ConfigurationSso.js +104 -0
- package/dist/pages/admin/ConfigurationSsoNew.d.ts +1 -0
- package/dist/pages/admin/ConfigurationSsoNew.js +44 -0
- package/dist/pages/admin/Dashboard.js +65 -20
- package/dist/pages/admin/Db.js +2 -2
- package/dist/pages/admin/GroupMembers.js +6 -39
- package/dist/pages/admin/Groups.js +4 -2
- package/dist/pages/admin/Invites.js +9 -4
- package/dist/pages/admin/MemberDetail.d.ts +1 -0
- package/dist/pages/admin/MemberDetail.js +66 -0
- package/dist/pages/admin/Members.js +39 -10
- package/dist/pages/admin/Plugins.d.ts +1 -0
- package/dist/pages/admin/Plugins.js +208 -0
- package/dist/pages/admin/Reports.js +17 -17
- package/dist/pages/admin/analytics/AnalyticsLayout.js +30 -5
- package/dist/pages/admin/analytics/Content.js +6 -6
- package/dist/pages/admin/analytics/Engagement.js +10 -10
- package/dist/pages/admin/analytics/Groups.js +5 -13
- package/dist/pages/admin/analytics/Members.js +10 -2
- package/dist/pages/admin/analytics/Overview.js +10 -10
- package/dist/pages/admin/analytics/PluginPage.d.ts +1 -0
- package/dist/pages/admin/analytics/PluginPage.js +26 -0
- package/dist/pages/admin/analytics/analyticsPluginTabs.d.ts +4 -0
- package/dist/pages/admin/analytics/analyticsPluginTabs.js +25 -0
- package/dist/pages/admin/community/CommunityRoles.js +107 -58
- package/dist/pages/admin/community/CommunityTheme.js +1 -1
- package/dist/pages/admin/community/useCommunityConfig.d.ts +6 -2
- package/dist/pages/admin/components/AdminGroupCard.js +1 -1
- package/dist/pages/admin/components/InviteWithEmailModal.js +5 -5
- package/dist/pages/admin/components/InviteWithLinkModal.d.ts +0 -1
- package/dist/pages/admin/components/InviteWithLinkModal.js +45 -14
- package/dist/pages/admin/components/ProfileRowActions.js +19 -13
- package/dist/pages/admin/components/RestoreBackupModal.js +6 -2
- package/dist/pages/admin/components/RestoreTestBackupModal.js +6 -4
- package/dist/pages/admin/components/ServerStatusSection.d.ts +5 -0
- package/dist/pages/admin/components/ServerStatusSection.js +62 -0
- package/dist/pages/admin/components/inviteQr.d.ts +8 -0
- package/dist/pages/admin/components/inviteQr.js +72 -0
- package/dist/pages/admin/components/serverStatusFormat.d.ts +3 -0
- package/dist/pages/admin/components/serverStatusFormat.js +32 -0
- package/dist/pages/admin/configurationPluginPages.d.ts +4 -0
- package/dist/pages/admin/configurationPluginPages.js +26 -0
- package/dist/pages/admin/configurationSsoShared.d.ts +307 -0
- package/dist/pages/admin/configurationSsoShared.js +192 -0
- package/dist/pages/articles/Edit.js +6 -40
- package/dist/pages/articles/Index.js +2 -1
- package/dist/pages/articles/New.js +6 -39
- package/dist/pages/auth/Closed.js +4 -2
- package/dist/pages/auth/Login.js +55 -21
- package/dist/pages/auth/Register.js +25 -9
- package/dist/pages/auth/RequestResetPassword.js +4 -4
- package/dist/pages/auth/ResetPassword.js +4 -4
- package/dist/pages/conversations/Index.js +19 -6
- package/dist/pages/conversations/Info.js +40 -3
- package/dist/pages/conversations/Show.js +29 -20
- package/dist/pages/events/Edit.js +11 -52
- package/dist/pages/events/Index.js +7 -4
- package/dist/pages/events/My.js +2 -2
- package/dist/pages/events/New.js +6 -57
- package/dist/pages/feeds/Bookmarks.js +4 -2
- package/dist/pages/feeds/Local.js +2 -1
- package/dist/pages/feeds/My.js +2 -1
- package/dist/pages/groups/Edit.js +11 -41
- package/dist/pages/groups/EditInfo.d.ts +1 -0
- package/dist/pages/groups/EditInfo.js +22 -0
- package/dist/pages/groups/EditRoles.d.ts +1 -0
- package/dist/pages/groups/EditRoles.js +29 -0
- package/dist/pages/groups/New.js +6 -58
- package/dist/pages/groups/Show.js +2 -2
- package/dist/pages/index.d.ts +13 -0
- package/dist/pages/index.js +13 -0
- package/dist/pages/jams/Event.js +3 -1
- package/dist/pages/jams/Index.js +3 -1
- package/dist/pages/payment/Success.js +2 -2
- package/dist/pages/settings/AccessTokens.js +10 -104
- package/dist/pages/settings/Account.js +43 -2
- package/dist/pages/settings/Billing.js +11 -7
- package/dist/pages/settings/Blocked.d.ts +1 -0
- package/dist/pages/settings/Blocked.js +29 -0
- package/dist/pages/settings/Feed.d.ts +1 -0
- package/dist/pages/settings/Feed.js +36 -0
- package/dist/pages/settings/Index.js +1 -1
- package/dist/pages/settings/Language.js +9 -44
- package/dist/pages/settings/NotificationPreferences.js +16 -68
- package/dist/pages/settings/PublicProfile.js +9 -0
- package/dist/pages/settings/PushEnabledDevices.js +10 -43
- package/dist/pages/settings/Theme.js +5 -21
- package/dist/pages/settings/Timezone.d.ts +1 -0
- package/dist/pages/settings/Timezone.js +19 -0
- package/dist/pwa/PwaProvider.d.ts +3 -2
- package/dist/pwa/PwaProvider.js +19 -2
- package/dist/pwa/pageReload.d.ts +12 -0
- package/dist/pwa/pageReload.js +30 -0
- package/dist/pwa/registration.js +3 -0
- package/dist/pwa/staleAppReload.d.ts +33 -0
- package/dist/pwa/staleAppReload.js +123 -0
- package/dist/pwa/useServiceWorker.d.ts +1 -1
- package/dist/pwa/useServiceWorker.js +15 -1
- package/dist/react-native.d.ts +46 -0
- package/dist/react-native.js +33 -0
- package/dist/stores/eventView.d.ts +10 -0
- package/dist/stores/eventView.js +14 -0
- package/dist/stores/feedFormat.d.ts +7 -0
- package/dist/stores/feedFormat.js +14 -0
- package/dist/stores/index.d.ts +3 -0
- package/dist/stores/index.js +2 -0
- package/dist/stores/newPosts.d.ts +78 -12
- package/package.json +10 -6
- package/dist/lib/groupCapabilityHelpers.d.ts +0 -24
- package/dist/lib/groupCapabilityHelpers.js +0 -119
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { endOfMonth, eventStartIso, groupPostsByDay, localDateKey, monthCells, shouldFetchMoreAgenda, startOfMonth, uniquePosts, } from '../../components/post/feed/events/eventCalendar.js';
|
|
3
|
+
const WEEKDAY_START = new Date(2026, 0, 4);
|
|
4
|
+
export const eventName = (post) => post.data.type === 'event' ? post.data.name?.trim() || '-' : '-';
|
|
5
|
+
export const dayNumber = (key) => String(Number(key.slice(8, 10)));
|
|
6
|
+
export const dateFromDayKey = (key) => new Date(Number(key.slice(0, 4)), Number(key.slice(5, 7)) - 1, Number(key.slice(8, 10)));
|
|
7
|
+
/**
|
|
8
|
+
* Month cursor, selected day and agenda paging for the events calendar. Pulls
|
|
9
|
+
* further pages while the visible month is not yet covered by loaded events.
|
|
10
|
+
*/
|
|
11
|
+
export const useEventsCalendar = (query, agenda) => {
|
|
12
|
+
const initial = new Date();
|
|
13
|
+
const [cursor, setCursor] = useState({
|
|
14
|
+
year: initial.getFullYear(),
|
|
15
|
+
month: initial.getMonth(),
|
|
16
|
+
});
|
|
17
|
+
const [selectedKey, setSelectedKey] = useState(localDateKey(initial));
|
|
18
|
+
const posts = useMemo(() => uniquePosts(query.data?.pages), [query.data?.pages]);
|
|
19
|
+
const byDay = useMemo(() => groupPostsByDay(posts), [posts]);
|
|
20
|
+
const cells = useMemo(() => monthCells(cursor.year, cursor.month), [cursor.year, cursor.month]);
|
|
21
|
+
const inMonthKeys = cells
|
|
22
|
+
.filter((cell) => cell.inMonth)
|
|
23
|
+
.map((cell) => cell.key);
|
|
24
|
+
const todayKey = localDateKey(new Date());
|
|
25
|
+
const visible = cells.some((cell) => cell.key === selectedKey);
|
|
26
|
+
const selected = visible
|
|
27
|
+
? selectedKey
|
|
28
|
+
: inMonthKeys.includes(todayKey)
|
|
29
|
+
? todayKey
|
|
30
|
+
: (inMonthKeys[0] ?? todayKey);
|
|
31
|
+
const selectedEvents = byDay.get(selected) ?? [];
|
|
32
|
+
const monthLabel = new Date(cursor.year, cursor.month, 1).toLocaleDateString(undefined, { month: 'long', year: 'numeric' });
|
|
33
|
+
const weekdayLabels = Array.from({ length: 7 }, (_, index) => new Date(WEEKDAY_START.getFullYear(), WEEKDAY_START.getMonth(), WEEKDAY_START.getDate() + index).toLocaleDateString(undefined, { weekday: 'short' }));
|
|
34
|
+
const selectedLabel = dateFromDayKey(selected).toLocaleDateString(undefined, {
|
|
35
|
+
weekday: 'long',
|
|
36
|
+
month: 'long',
|
|
37
|
+
day: 'numeric',
|
|
38
|
+
});
|
|
39
|
+
const { hasNextPage, isLoading, isFetchingNextPage, isError, fetchNextPage, data, } = query;
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (isLoading || isFetchingNextPage || isError)
|
|
42
|
+
return;
|
|
43
|
+
const fetchMore = shouldFetchMoreAgenda({
|
|
44
|
+
window: agenda,
|
|
45
|
+
starts: posts.map(eventStartIso),
|
|
46
|
+
rangeStart: startOfMonth(cursor.year, cursor.month),
|
|
47
|
+
rangeEnd: endOfMonth(cursor.year, cursor.month),
|
|
48
|
+
hasNextPage: !!hasNextPage,
|
|
49
|
+
pagesLoaded: data?.pages.length ?? 0,
|
|
50
|
+
});
|
|
51
|
+
if (fetchMore)
|
|
52
|
+
void fetchNextPage();
|
|
53
|
+
}, [
|
|
54
|
+
cursor.month,
|
|
55
|
+
cursor.year,
|
|
56
|
+
data?.pages.length,
|
|
57
|
+
fetchNextPage,
|
|
58
|
+
hasNextPage,
|
|
59
|
+
isError,
|
|
60
|
+
isFetchingNextPage,
|
|
61
|
+
isLoading,
|
|
62
|
+
agenda,
|
|
63
|
+
posts,
|
|
64
|
+
]);
|
|
65
|
+
const shiftMonth = (delta) => {
|
|
66
|
+
const next = new Date(cursor.year, cursor.month + delta, 1);
|
|
67
|
+
setCursor({ year: next.getFullYear(), month: next.getMonth() });
|
|
68
|
+
};
|
|
69
|
+
const goToday = () => {
|
|
70
|
+
const now = new Date();
|
|
71
|
+
setCursor({ year: now.getFullYear(), month: now.getMonth() });
|
|
72
|
+
setSelectedKey(localDateKey(now));
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
cells,
|
|
76
|
+
byDay,
|
|
77
|
+
todayKey,
|
|
78
|
+
selected,
|
|
79
|
+
selectedEvents,
|
|
80
|
+
selectedLabel,
|
|
81
|
+
setSelectedKey,
|
|
82
|
+
monthLabel,
|
|
83
|
+
weekdayLabels,
|
|
84
|
+
isLoading,
|
|
85
|
+
isFetchingNextPage,
|
|
86
|
+
shiftMonth,
|
|
87
|
+
goToday,
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type GroupFormFieldErrors } from '../../lib/groupFormErrors';
|
|
2
|
+
export type UseEditGroupOptions = {
|
|
3
|
+
/** `info` validates display name before saving; `roles` saves as-is. */
|
|
4
|
+
section: 'info' | 'roles';
|
|
5
|
+
};
|
|
6
|
+
/** Loads a group by handle and saves edits, navigating back to the group. */
|
|
7
|
+
export declare const useEditGroup: (handle: string, { section }: UseEditGroupOptions) => {
|
|
8
|
+
groupQuery: import("@tanstack/react-query").UseQueryResult<{
|
|
9
|
+
handle: string;
|
|
10
|
+
capabilities: Record<string, {
|
|
11
|
+
add?: string[] | undefined;
|
|
12
|
+
remove?: string[] | undefined;
|
|
13
|
+
} | undefined>;
|
|
14
|
+
membersCount: number;
|
|
15
|
+
id: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
avatar?: string | null | undefined;
|
|
19
|
+
header?: string | null | undefined;
|
|
20
|
+
displayName?: string | undefined;
|
|
21
|
+
description?: string | undefined;
|
|
22
|
+
rules?: string | undefined;
|
|
23
|
+
pinnedPostId?: string | undefined;
|
|
24
|
+
discoverable?: boolean | undefined;
|
|
25
|
+
lastPostAt?: string | null | undefined;
|
|
26
|
+
deletedAt?: string | null | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
success: boolean;
|
|
29
|
+
message?: string | undefined;
|
|
30
|
+
key?: string | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
group: {
|
|
33
|
+
handle: string;
|
|
34
|
+
capabilities: Record<string, {
|
|
35
|
+
add?: string[] | undefined;
|
|
36
|
+
remove?: string[] | undefined;
|
|
37
|
+
} | undefined>;
|
|
38
|
+
membersCount: number;
|
|
39
|
+
id: string;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
avatar?: string | null | undefined;
|
|
43
|
+
header?: string | null | undefined;
|
|
44
|
+
displayName?: string | undefined;
|
|
45
|
+
description?: string | undefined;
|
|
46
|
+
rules?: string | undefined;
|
|
47
|
+
pinnedPostId?: string | undefined;
|
|
48
|
+
discoverable?: boolean | undefined;
|
|
49
|
+
lastPostAt?: string | null | undefined;
|
|
50
|
+
deletedAt?: string | null | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
groupData: {
|
|
53
|
+
handle: string;
|
|
54
|
+
capabilities: Record<string, {
|
|
55
|
+
add?: string[] | undefined;
|
|
56
|
+
remove?: string[] | undefined;
|
|
57
|
+
} | undefined>;
|
|
58
|
+
avatar?: string | null | undefined;
|
|
59
|
+
header?: string | null | undefined;
|
|
60
|
+
displayName?: string | undefined;
|
|
61
|
+
description?: string | undefined;
|
|
62
|
+
rules?: string | undefined;
|
|
63
|
+
pinnedPostId?: string | undefined;
|
|
64
|
+
discoverable?: boolean | undefined;
|
|
65
|
+
} | null;
|
|
66
|
+
setGroupData: import("react").Dispatch<import("react").SetStateAction<{
|
|
67
|
+
handle: string;
|
|
68
|
+
capabilities: Record<string, {
|
|
69
|
+
add?: string[] | undefined;
|
|
70
|
+
remove?: string[] | undefined;
|
|
71
|
+
} | undefined>;
|
|
72
|
+
avatar?: string | null | undefined;
|
|
73
|
+
header?: string | null | undefined;
|
|
74
|
+
displayName?: string | undefined;
|
|
75
|
+
description?: string | undefined;
|
|
76
|
+
rules?: string | undefined;
|
|
77
|
+
pinnedPostId?: string | undefined;
|
|
78
|
+
discoverable?: boolean | undefined;
|
|
79
|
+
} | null>>;
|
|
80
|
+
submitting: boolean;
|
|
81
|
+
error: string | null;
|
|
82
|
+
clearError: () => void;
|
|
83
|
+
fieldErrors: GroupFormFieldErrors;
|
|
84
|
+
canEdit: boolean;
|
|
85
|
+
canEditCapabilities: boolean;
|
|
86
|
+
submit: () => Promise<void>;
|
|
87
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { checkGroupCapabilities } from '@openpeepshq/common/lib';
|
|
3
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
4
|
+
import { useNavigate } from '../../contexts/router/index.js';
|
|
5
|
+
import { useT } from '../../i18n/context.js';
|
|
6
|
+
import { useAuthData } from '../../components/layout/IdentityContext.js';
|
|
7
|
+
import { apiErrorMessage } from '../../lib/apiErrorMessage.js';
|
|
8
|
+
import { groupFormFieldErrors, hasGroupFormFieldErrors, } from '../../lib/groupFormErrors.js';
|
|
9
|
+
/** Loads a group by handle and saves edits, navigating back to the group. */
|
|
10
|
+
export const useEditGroup = (handle, { section }) => {
|
|
11
|
+
const t = useT();
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
14
|
+
const authData = useAuthData();
|
|
15
|
+
const groupQuery = openpeepsApi.useGroupByHandle(handle);
|
|
16
|
+
const updateGroup = openpeepsApi.updateGroupAction();
|
|
17
|
+
const [groupData, setGroupData] = useState(null);
|
|
18
|
+
const [submitting, setSubmitting] = useState(false);
|
|
19
|
+
const [error, setError] = useState(null);
|
|
20
|
+
const [fieldErrors, setFieldErrors] = useState({});
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (groupQuery.data) {
|
|
23
|
+
const { handle: groupHandle, avatar, header, displayName, description, rules, capabilities, } = groupQuery.data;
|
|
24
|
+
setGroupData({
|
|
25
|
+
handle: groupHandle,
|
|
26
|
+
avatar,
|
|
27
|
+
header,
|
|
28
|
+
displayName,
|
|
29
|
+
description,
|
|
30
|
+
rules,
|
|
31
|
+
capabilities,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}, [groupQuery.data]);
|
|
35
|
+
const group = groupQuery.data;
|
|
36
|
+
const canEdit = !!group &&
|
|
37
|
+
checkGroupCapabilities(authData, ['core-groups-update'], group).success;
|
|
38
|
+
const canEditCapabilities = !!group &&
|
|
39
|
+
checkGroupCapabilities(authData, ['core-groups-updateCapabilities'], group)
|
|
40
|
+
.success;
|
|
41
|
+
const submit = async () => {
|
|
42
|
+
if (!group || !groupData)
|
|
43
|
+
return;
|
|
44
|
+
setError(null);
|
|
45
|
+
if (section === 'info') {
|
|
46
|
+
const nextFieldErrors = groupFormFieldErrors(groupData, t, {
|
|
47
|
+
skipHandle: true,
|
|
48
|
+
});
|
|
49
|
+
if (hasGroupFormFieldErrors(nextFieldErrors)) {
|
|
50
|
+
setFieldErrors(nextFieldErrors);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
setFieldErrors({});
|
|
54
|
+
}
|
|
55
|
+
setSubmitting(true);
|
|
56
|
+
try {
|
|
57
|
+
const updated = (await updateGroup({ ...group, ...groupData }, { id: group.id }));
|
|
58
|
+
navigate({ type: 'group', handle: updated.handle });
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
setError(apiErrorMessage(err, t));
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
setSubmitting(false);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
groupQuery,
|
|
69
|
+
group,
|
|
70
|
+
groupData,
|
|
71
|
+
setGroupData,
|
|
72
|
+
submitting,
|
|
73
|
+
error,
|
|
74
|
+
clearError: () => setError(null),
|
|
75
|
+
fieldErrors,
|
|
76
|
+
canEdit,
|
|
77
|
+
canEditCapabilities,
|
|
78
|
+
submit,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GroupData } from '@openpeepshq/common/types';
|
|
2
|
+
export type UseGroupTemplateSelectionArgs = {
|
|
3
|
+
groupData: GroupData;
|
|
4
|
+
onChange: (data: GroupData) => void;
|
|
5
|
+
isEdit: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Group-type radio ↔ capability-matrix sync: custom when caps diverge from
|
|
9
|
+
* every preset, otherwise the matching template. On create, custom is also
|
|
10
|
+
* selected when the user explicitly opens the matrix.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useGroupTemplateSelection: ({ groupData, onChange, isEdit, }: UseGroupTemplateSelectionArgs) => {
|
|
13
|
+
showCapabilityMatrix: boolean;
|
|
14
|
+
templateSelection: import("@openpeepshq/common").GroupTemplateSelection;
|
|
15
|
+
templateOptions: {
|
|
16
|
+
value: string;
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}[];
|
|
20
|
+
templateDescription: string;
|
|
21
|
+
onTemplateChange: (value: string) => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { applySimpleGroupTemplate, matchSimpleGroupTemplate, simpleGroupTemplateOptions, } from '@openpeepshq/common/lib';
|
|
3
|
+
import { useT } from '../../i18n/context.js';
|
|
4
|
+
import { useServerInfo } from '../../components/server-data/context.js';
|
|
5
|
+
/**
|
|
6
|
+
* Group-type radio ↔ capability-matrix sync: custom when caps diverge from
|
|
7
|
+
* every preset, otherwise the matching template. On create, custom is also
|
|
8
|
+
* selected when the user explicitly opens the matrix.
|
|
9
|
+
*/
|
|
10
|
+
export const useGroupTemplateSelection = ({ groupData, onChange, isEdit, }) => {
|
|
11
|
+
const t = useT();
|
|
12
|
+
const { publicContent } = useServerInfo();
|
|
13
|
+
const [customMatrixOpen, setCustomMatrixOpen] = useState(false);
|
|
14
|
+
const showCapabilityMatrix = isEdit || customMatrixOpen;
|
|
15
|
+
const templateSelection = !isEdit && customMatrixOpen
|
|
16
|
+
? 'custom'
|
|
17
|
+
: matchSimpleGroupTemplate(groupData.capabilities);
|
|
18
|
+
const templateOptions = [
|
|
19
|
+
...simpleGroupTemplateOptions(publicContent).map((templateId) => ({
|
|
20
|
+
value: templateId,
|
|
21
|
+
title: t(`groups.templates.${templateId}.title`, {
|
|
22
|
+
defaultValue: templateId,
|
|
23
|
+
}),
|
|
24
|
+
description: t(`groups.templates.${templateId}.description`, {
|
|
25
|
+
defaultValue: '',
|
|
26
|
+
}),
|
|
27
|
+
})),
|
|
28
|
+
{
|
|
29
|
+
value: 'custom',
|
|
30
|
+
title: t('groups.templates.custom.title', {
|
|
31
|
+
defaultValue: 'Custom group',
|
|
32
|
+
}),
|
|
33
|
+
description: t('groups.templates.custom.description', {
|
|
34
|
+
defaultValue: 'Capabilities do not match a standard template',
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
const onTemplateChange = (value) => {
|
|
39
|
+
if (value === 'custom') {
|
|
40
|
+
if (!isEdit) {
|
|
41
|
+
setCustomMatrixOpen(true);
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!isEdit) {
|
|
46
|
+
setCustomMatrixOpen(false);
|
|
47
|
+
}
|
|
48
|
+
onChange({
|
|
49
|
+
...groupData,
|
|
50
|
+
capabilities: applySimpleGroupTemplate(value),
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const templateDescription = showCapabilityMatrix
|
|
54
|
+
? t('groups.templates.description', {
|
|
55
|
+
defaultValue: 'Pick a preset, or edit the capability matrix below. The type switches to Custom when the matrix no longer matches a preset.',
|
|
56
|
+
})
|
|
57
|
+
: t('groups.templates.descriptionCreate', {
|
|
58
|
+
defaultValue: 'Pick a preset for your group, or choose Custom to fine-tune capabilities.',
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
showCapabilityMatrix,
|
|
62
|
+
templateSelection,
|
|
63
|
+
templateOptions,
|
|
64
|
+
templateDescription,
|
|
65
|
+
onTemplateChange,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { type GroupFormFieldErrors } from '../../lib/groupFormErrors';
|
|
2
|
+
export declare const useNewGroup: () => {
|
|
3
|
+
groupData: {
|
|
4
|
+
handle: string;
|
|
5
|
+
capabilities: Record<string, {
|
|
6
|
+
add?: string[] | undefined;
|
|
7
|
+
remove?: string[] | undefined;
|
|
8
|
+
} | undefined>;
|
|
9
|
+
avatar?: string | null | undefined;
|
|
10
|
+
header?: string | null | undefined;
|
|
11
|
+
displayName?: string | undefined;
|
|
12
|
+
description?: string | undefined;
|
|
13
|
+
rules?: string | undefined;
|
|
14
|
+
pinnedPostId?: string | undefined;
|
|
15
|
+
discoverable?: boolean | undefined;
|
|
16
|
+
};
|
|
17
|
+
setGroupData: import("react").Dispatch<import("react").SetStateAction<{
|
|
18
|
+
handle: string;
|
|
19
|
+
capabilities: Record<string, {
|
|
20
|
+
add?: string[] | undefined;
|
|
21
|
+
remove?: string[] | undefined;
|
|
22
|
+
} | undefined>;
|
|
23
|
+
avatar?: string | null | undefined;
|
|
24
|
+
header?: string | null | undefined;
|
|
25
|
+
displayName?: string | undefined;
|
|
26
|
+
description?: string | undefined;
|
|
27
|
+
rules?: string | undefined;
|
|
28
|
+
pinnedPostId?: string | undefined;
|
|
29
|
+
discoverable?: boolean | undefined;
|
|
30
|
+
}>>;
|
|
31
|
+
members: {
|
|
32
|
+
id: string;
|
|
33
|
+
type: "local" | "guest" | "federated";
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
handle: string;
|
|
37
|
+
memberships: {
|
|
38
|
+
group: {
|
|
39
|
+
handle: string;
|
|
40
|
+
capabilities: Record<string, {
|
|
41
|
+
add?: string[] | undefined;
|
|
42
|
+
remove?: string[] | undefined;
|
|
43
|
+
} | undefined>;
|
|
44
|
+
id: string;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
avatar?: string | null | undefined;
|
|
48
|
+
header?: string | null | undefined;
|
|
49
|
+
displayName?: string | undefined;
|
|
50
|
+
description?: string | undefined;
|
|
51
|
+
rules?: string | undefined;
|
|
52
|
+
pinnedPostId?: string | undefined;
|
|
53
|
+
discoverable?: boolean | undefined;
|
|
54
|
+
deletedAt?: string | null | undefined;
|
|
55
|
+
};
|
|
56
|
+
roles?: ("none" | "local" | "member" | "moderator" | "admin" | "owner" | "invited")[] | null | undefined;
|
|
57
|
+
}[] | undefined;
|
|
58
|
+
deletedAt?: string | null | undefined;
|
|
59
|
+
avatar?: string | null | undefined;
|
|
60
|
+
header?: string | null | undefined;
|
|
61
|
+
displayName?: string | undefined;
|
|
62
|
+
bio?: string | undefined;
|
|
63
|
+
location?: {
|
|
64
|
+
text: string;
|
|
65
|
+
coordinates?: {
|
|
66
|
+
lat: number;
|
|
67
|
+
lng: number;
|
|
68
|
+
alt?: number | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
} | undefined;
|
|
71
|
+
locked?: boolean | undefined;
|
|
72
|
+
bot?: boolean | undefined;
|
|
73
|
+
discoverable?: boolean | undefined;
|
|
74
|
+
roles?: {
|
|
75
|
+
key: string;
|
|
76
|
+
displayName: string;
|
|
77
|
+
}[] | undefined;
|
|
78
|
+
fields?: {
|
|
79
|
+
name: string;
|
|
80
|
+
value: string;
|
|
81
|
+
}[] | undefined;
|
|
82
|
+
profileStats?: {
|
|
83
|
+
followersCount: number;
|
|
84
|
+
followingCount: number;
|
|
85
|
+
} | undefined;
|
|
86
|
+
pinnedPostId?: string | undefined;
|
|
87
|
+
blockedByMe?: boolean | undefined;
|
|
88
|
+
}[];
|
|
89
|
+
setMembers: import("react").Dispatch<import("react").SetStateAction<{
|
|
90
|
+
id: string;
|
|
91
|
+
type: "local" | "guest" | "federated";
|
|
92
|
+
createdAt: string;
|
|
93
|
+
updatedAt: string;
|
|
94
|
+
handle: string;
|
|
95
|
+
memberships: {
|
|
96
|
+
group: {
|
|
97
|
+
handle: string;
|
|
98
|
+
capabilities: Record<string, {
|
|
99
|
+
add?: string[] | undefined;
|
|
100
|
+
remove?: string[] | undefined;
|
|
101
|
+
} | undefined>;
|
|
102
|
+
id: string;
|
|
103
|
+
createdAt: string;
|
|
104
|
+
updatedAt: string;
|
|
105
|
+
avatar?: string | null | undefined;
|
|
106
|
+
header?: string | null | undefined;
|
|
107
|
+
displayName?: string | undefined;
|
|
108
|
+
description?: string | undefined;
|
|
109
|
+
rules?: string | undefined;
|
|
110
|
+
pinnedPostId?: string | undefined;
|
|
111
|
+
discoverable?: boolean | undefined;
|
|
112
|
+
deletedAt?: string | null | undefined;
|
|
113
|
+
};
|
|
114
|
+
roles?: ("none" | "local" | "member" | "moderator" | "admin" | "owner" | "invited")[] | null | undefined;
|
|
115
|
+
}[] | undefined;
|
|
116
|
+
deletedAt?: string | null | undefined;
|
|
117
|
+
avatar?: string | null | undefined;
|
|
118
|
+
header?: string | null | undefined;
|
|
119
|
+
displayName?: string | undefined;
|
|
120
|
+
bio?: string | undefined;
|
|
121
|
+
location?: {
|
|
122
|
+
text: string;
|
|
123
|
+
coordinates?: {
|
|
124
|
+
lat: number;
|
|
125
|
+
lng: number;
|
|
126
|
+
alt?: number | undefined;
|
|
127
|
+
} | undefined;
|
|
128
|
+
} | undefined;
|
|
129
|
+
locked?: boolean | undefined;
|
|
130
|
+
bot?: boolean | undefined;
|
|
131
|
+
discoverable?: boolean | undefined;
|
|
132
|
+
roles?: {
|
|
133
|
+
key: string;
|
|
134
|
+
displayName: string;
|
|
135
|
+
}[] | undefined;
|
|
136
|
+
fields?: {
|
|
137
|
+
name: string;
|
|
138
|
+
value: string;
|
|
139
|
+
}[] | undefined;
|
|
140
|
+
profileStats?: {
|
|
141
|
+
followersCount: number;
|
|
142
|
+
followingCount: number;
|
|
143
|
+
} | undefined;
|
|
144
|
+
pinnedPostId?: string | undefined;
|
|
145
|
+
blockedByMe?: boolean | undefined;
|
|
146
|
+
}[]>>;
|
|
147
|
+
submitting: boolean;
|
|
148
|
+
error: string | null;
|
|
149
|
+
clearError: () => void;
|
|
150
|
+
fieldErrors: GroupFormFieldErrors;
|
|
151
|
+
submit: () => Promise<void>;
|
|
152
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { applySimpleGroupTemplate, defaultSimpleGroupTemplate, } from '@openpeepshq/common/lib';
|
|
3
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
4
|
+
import { useNavigate } from '../../contexts/router/index.js';
|
|
5
|
+
import { useT } from '../../i18n/context.js';
|
|
6
|
+
import { useServerInfo } from '../../components/server-data/context.js';
|
|
7
|
+
import { apiErrorMessage } from '../../lib/apiErrorMessage.js';
|
|
8
|
+
import { duplicateHandleMessage, groupFormFieldErrors, hasGroupFormFieldErrors, isDuplicateHandleError, } from '../../lib/groupFormErrors.js';
|
|
9
|
+
const handleFromDisplayName = (displayName) => displayName
|
|
10
|
+
.toLowerCase()
|
|
11
|
+
.replaceAll(' ', '_')
|
|
12
|
+
.replace(/[^a-zA-Z0-9_]/g, '')
|
|
13
|
+
.trim()
|
|
14
|
+
.slice(0, 16);
|
|
15
|
+
export const useNewGroup = () => {
|
|
16
|
+
const t = useT();
|
|
17
|
+
const navigate = useNavigate();
|
|
18
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
19
|
+
const createGroup = openpeepsApi.createGroupAction();
|
|
20
|
+
const { publicContent } = useServerInfo();
|
|
21
|
+
const [members, setMembers] = useState([]);
|
|
22
|
+
const [groupData, setGroupData] = useState(() => ({
|
|
23
|
+
displayName: '',
|
|
24
|
+
handle: '',
|
|
25
|
+
description: '',
|
|
26
|
+
rules: '',
|
|
27
|
+
capabilities: applySimpleGroupTemplate(defaultSimpleGroupTemplate(publicContent)),
|
|
28
|
+
}));
|
|
29
|
+
const [submitting, setSubmitting] = useState(false);
|
|
30
|
+
const [error, setError] = useState(null);
|
|
31
|
+
const [fieldErrors, setFieldErrors] = useState({});
|
|
32
|
+
const submit = async () => {
|
|
33
|
+
setError(null);
|
|
34
|
+
const nextFieldErrors = groupFormFieldErrors(groupData, t);
|
|
35
|
+
if (hasGroupFormFieldErrors(nextFieldErrors)) {
|
|
36
|
+
setFieldErrors(nextFieldErrors);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
setFieldErrors({});
|
|
40
|
+
const data = groupData.handle.length === 0
|
|
41
|
+
? {
|
|
42
|
+
...groupData,
|
|
43
|
+
handle: handleFromDisplayName(groupData.displayName),
|
|
44
|
+
}
|
|
45
|
+
: groupData;
|
|
46
|
+
setSubmitting(true);
|
|
47
|
+
try {
|
|
48
|
+
const group = (await createGroup({ ...data, members }));
|
|
49
|
+
navigate({ type: 'group', handle: group.handle });
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
if (isDuplicateHandleError(err)) {
|
|
53
|
+
const msg = duplicateHandleMessage(t);
|
|
54
|
+
setFieldErrors({ handle: msg });
|
|
55
|
+
setError(msg);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
setError(apiErrorMessage(err, t, t('groups.create.error', { defaultValue: 'Failed to create group' })));
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
setSubmitting(false);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
groupData,
|
|
66
|
+
setGroupData,
|
|
67
|
+
members,
|
|
68
|
+
setMembers,
|
|
69
|
+
submitting,
|
|
70
|
+
error,
|
|
71
|
+
clearError: () => setError(null),
|
|
72
|
+
fieldErrors,
|
|
73
|
+
submit,
|
|
74
|
+
};
|
|
75
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,4 +3,62 @@ export { useCreateConversation } from './conversations/useCreateConversation';
|
|
|
3
3
|
export type { UseCreateConversationArgs } from './conversations/useCreateConversation';
|
|
4
4
|
export { useLeaveCloseJam } from './jams/useLeaveCloseJam';
|
|
5
5
|
export type { UseLeaveCloseJamArgs } from './jams/useLeaveCloseJam';
|
|
6
|
+
export { useCreateNewJamForm } from './jams/useCreateNewJamForm';
|
|
7
|
+
export type { UseCreateNewJamFormArgs } from './jams/useCreateNewJamForm';
|
|
8
|
+
export { useJamRoom } from './jams/useJamRoom';
|
|
9
|
+
export type { JamConnection, JamJoinChoices, JamJoinParams, JamReconnectPrefs, } from './jams/useJamRoom';
|
|
10
|
+
export { canAccessJamLobby, useJamLobby } from './jams/useJamLobby';
|
|
11
|
+
export type { UseJamLobbyArgs } from './jams/useJamLobby';
|
|
12
|
+
export { useJamChatUnread, useJamFooterControls, } from './jams/useJamFooterControls';
|
|
13
|
+
export type { UseJamFooterControlsArgs } from './jams/useJamFooterControls';
|
|
14
|
+
export { mergeJamEvents, useJamChat } from './jams/useJamChat';
|
|
15
|
+
export type { UseJamChatArgs } from './jams/useJamChat';
|
|
16
|
+
export { useJamPeople } from './jams/useJamPeople';
|
|
17
|
+
export type { UseJamPeopleArgs } from './jams/useJamPeople';
|
|
18
|
+
export { useJamStage } from './jams/useJamStage';
|
|
19
|
+
export type { UseJamStageArgs } from './jams/useJamStage';
|
|
20
|
+
export { useJamDetails, useJamRtmpStream } from './jams/useJamDetails';
|
|
21
|
+
export type { UseJamRtmpStreamArgs } from './jams/useJamDetails';
|
|
22
|
+
export { useJamParticipantMute, useJoinWaitingRoomToken, } from './jams/useJamParticipant';
|
|
23
|
+
export type { UseJamParticipantMuteArgs } from './jams/useJamParticipant';
|
|
6
24
|
export { useFeedPostActions } from './posts/useFeedPostActions';
|
|
25
|
+
export { feedPostPresentation, useFeedPostPresentation, } from './posts/useFeedPostPresentation';
|
|
26
|
+
export type { FeedPostPresentationOptions } from './posts/useFeedPostPresentation';
|
|
27
|
+
export { ReplyOpenerProvider, useReplyOpener } from './posts/replyOpener';
|
|
28
|
+
export type { ReplyOpener } from './posts/replyOpener';
|
|
29
|
+
export { useEventRsvp } from './events/useEventRsvp';
|
|
30
|
+
export type { RsvpChoice, RsvpScopeChoice, UseEventRsvpArgs, } from './events/useEventRsvp';
|
|
31
|
+
export { useFollowProfile } from './profile/useFollowProfile';
|
|
32
|
+
export { useFeedFormatPreference } from './settings/useFeedFormatPreference';
|
|
33
|
+
export { useThemePreference } from './settings/useThemePreference';
|
|
34
|
+
export { useNotificationPreferences } from './settings/useNotificationPreferences';
|
|
35
|
+
export type { UseNotificationPreferencesArgs } from './settings/useNotificationPreferences';
|
|
36
|
+
export { usePasswordLogin, useRegisterAccount, useRequestPasswordReset, useResetPassword, } from './auth/useAuthForms';
|
|
37
|
+
export { useResolvedFeedFormat, useFeedListParams, } from './useResolvedFeedFormat';
|
|
38
|
+
export { useTimezonePreference } from './settings/useTimezonePreference';
|
|
39
|
+
export type { SettingsStatus } from './settings/useTimezonePreference';
|
|
40
|
+
export { useLanguagePreference } from './settings/useLanguagePreference';
|
|
41
|
+
export { usePushEnabledDevices } from './settings/usePushEnabledDevices';
|
|
42
|
+
export { ACCESS_TOKEN_EXPIRATION_OPTIONS, ACCESS_TOKEN_RESOURCE_TYPES, ACCESS_TOKEN_SCOPE_LEVELS, accessTokenScopeLabel, useAccessTokens, } from './settings/useAccessTokens';
|
|
43
|
+
export type { AccessTokenResourceType } from './settings/useAccessTokens';
|
|
44
|
+
export type { UsePushEnabledDevicesArgs } from './settings/usePushEnabledDevices';
|
|
45
|
+
export { useEditGroup } from './groups/useEditGroup';
|
|
46
|
+
export type { UseEditGroupOptions } from './groups/useEditGroup';
|
|
47
|
+
export { useNewGroup } from './groups/useNewGroup';
|
|
48
|
+
export { useGroupTemplateSelection } from './groups/useGroupTemplateSelection';
|
|
49
|
+
export type { UseGroupTemplateSelectionArgs } from './groups/useGroupTemplateSelection';
|
|
50
|
+
export { useNewArticle, useEditArticle } from './posts/useArticleComposer';
|
|
51
|
+
export { useEventsCalendar, eventName as calendarEventName, dayNumber as calendarDayNumber, } from './events/useEventsCalendar';
|
|
52
|
+
export type { EventsCalendarQuery } from './events/useEventsCalendar';
|
|
53
|
+
export * from '../components/post/feed/events/eventCalendar';
|
|
54
|
+
export { useCommunityInfoPages } from './community/useCommunityInfoPages';
|
|
55
|
+
export { usePostThreads } from './posts/usePostThreads';
|
|
56
|
+
export { usePostDetailTitle } from './posts/usePostDetailTitle';
|
|
57
|
+
export { useEventMenu } from './events/useEventMenu';
|
|
58
|
+
export { useShareMenu } from './posts/useShareMenu';
|
|
59
|
+
export type { EventIcsFile } from './posts/useShareMenu';
|
|
60
|
+
export { useNewEvent, useEditEvent } from './events/useEventComposer';
|
|
61
|
+
export { EVENT_WEEKDAYS, useEventForm } from './events/useEventForm';
|
|
62
|
+
export type { RepeatEnd, RepeatFreq } from './events/useEventForm';
|
|
63
|
+
export { useEventTypeSwitcher, useLocationSearch, } from './events/useEventTypeSwitcher';
|
|
64
|
+
export type { EventFormat, UseEventTypeSwitcherArgs, } from './events/useEventTypeSwitcher';
|