@openpeepshq/react 0.2.4 → 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 +7 -6
- 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 +36 -13
- package/dist/components/post/pieces/PostActions.js +2 -2
- package/dist/components/post/pieces/PostMenu.js +18 -2
- 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/pieces/modals/RepostModal.d.ts +5 -3
- package/dist/components/post/pieces/modals/RepostModal.js +8 -7
- 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 +5759 -12462
- package/dist/contexts/openpeeps/hooks/admin.js +51 -15
- package/dist/contexts/openpeeps/hooks/auth.d.ts +2 -1
- package/dist/contexts/openpeeps/hooks/conversations.d.ts +12 -9810
- 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 +7511 -734
- 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 +66236 -12355
- package/dist/contexts/openpeeps/hooks/profiles.d.ts +49 -6881
- package/dist/contexts/openpeeps/hooks/profiles.js +24 -4
- package/dist/contexts/openpeeps/hooks/search.d.ts +13 -9618
- package/dist/contexts/openpeeps/index.d.ts +1 -1
- 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/postUnread.d.ts +7 -0
- package/dist/lib/postUnread.js +7 -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 +70 -4
- package/package.json +12 -8
- package/dist/lib/groupCapabilityHelpers.d.ts +0 -24
- package/dist/lib/groupCapabilityHelpers.js +0 -119
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { groupName, profileName } from '@openpeepshq/common';
|
|
2
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
3
|
+
import { useT } from '../../i18n/index.js';
|
|
4
|
+
/** Header copy for the post detail page; `group*` are set when the post belongs to a group. */
|
|
5
|
+
export const usePostDetailTitle = (postId) => {
|
|
6
|
+
const t = useT();
|
|
7
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
8
|
+
// Shares the react-query cache with the detail component, so this does not
|
|
9
|
+
// trigger an extra request.
|
|
10
|
+
const post = openpeepsApi.usePost(postId).data;
|
|
11
|
+
const author = post?.profile ? profileName(post.profile) : undefined;
|
|
12
|
+
const groupHandle = post?.group?.handle;
|
|
13
|
+
const groupLabel = post?.group ? groupName(post.group) : '';
|
|
14
|
+
const kindTitle = !author
|
|
15
|
+
? t('post.detail.fallbackTitle', { defaultValue: 'Post' })
|
|
16
|
+
: post?.repost
|
|
17
|
+
? t('post.detail.repostTitle', {
|
|
18
|
+
defaultValue: '{{author}} reposted a post',
|
|
19
|
+
author,
|
|
20
|
+
})
|
|
21
|
+
: post?.type === 'event'
|
|
22
|
+
? t('post.detail.eventTitle', {
|
|
23
|
+
defaultValue: "{{author}}'s event",
|
|
24
|
+
author,
|
|
25
|
+
})
|
|
26
|
+
: t('post.detail.title', {
|
|
27
|
+
defaultValue: "{{author}}'s post",
|
|
28
|
+
author,
|
|
29
|
+
});
|
|
30
|
+
const inGroup = !!author && !!groupHandle && !!groupLabel;
|
|
31
|
+
return { post, kindTitle, groupHandle, groupLabel, inGroup };
|
|
32
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Ancestor thread and reply threads around a post, for the detail view. */
|
|
2
|
+
export declare const usePostThreads: (postId: string) => {
|
|
3
|
+
ancestryThread: import("@openpeepshq/common").Thread | undefined;
|
|
4
|
+
descendentThreads: import("@openpeepshq/common").Thread[];
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { buildThreads } from '@openpeepshq/common/lib';
|
|
3
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
4
|
+
/** Ancestor thread and reply threads around a post, for the detail view. */
|
|
5
|
+
export const usePostThreads = (postId) => {
|
|
6
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
7
|
+
const contextQuery = openpeepsApi.usePostContext(postId);
|
|
8
|
+
const ancestryThread = useMemo(() => contextQuery.data
|
|
9
|
+
? buildThreads(contextQuery.data.ancestors)[0]
|
|
10
|
+
: undefined, [contextQuery.data]);
|
|
11
|
+
const descendentThreads = useMemo(() => (contextQuery.data && buildThreads(contextQuery.data.descendants)) || [], [contextQuery.data]);
|
|
12
|
+
return {
|
|
13
|
+
ancestryThread,
|
|
14
|
+
descendentThreads,
|
|
15
|
+
isLoading: contextQuery.isLoading,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PublicPost } from '@openpeepshq/common/types';
|
|
2
|
+
export type EventIcsFile = {
|
|
3
|
+
filename: string;
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
6
|
+
/** Share actions for a post; `postUrl` is the platform's canonical public link. */
|
|
7
|
+
export declare const useShareMenu: (post: PublicPost, postUrl: string) => {
|
|
8
|
+
signedIn: boolean;
|
|
9
|
+
isEvent: boolean;
|
|
10
|
+
repost: () => Promise<{
|
|
11
|
+
success: true;
|
|
12
|
+
}>;
|
|
13
|
+
eventIcsFile: () => EventIcsFile | null;
|
|
14
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { buildEventIcs } from '@openpeepshq/common/lib';
|
|
2
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
3
|
+
import { useCurrentProfile } from '../../components/layout/IdentityContext.js';
|
|
4
|
+
/** Share actions for a post; `postUrl` is the platform's canonical public link. */
|
|
5
|
+
export const useShareMenu = (post, postUrl) => {
|
|
6
|
+
const me = useCurrentProfile();
|
|
7
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
8
|
+
const repostPost = openpeepsApi.repostPostAction({ id: post.id });
|
|
9
|
+
const eventIcsFile = () => {
|
|
10
|
+
const ics = buildEventIcs(post, { postUrl });
|
|
11
|
+
if (!ics)
|
|
12
|
+
return null;
|
|
13
|
+
const event = post.data;
|
|
14
|
+
const raw = event.name?.trim() || `event-${post.id}`;
|
|
15
|
+
const safe = raw.replace(/[/\\?%*:|"<>]/g, '-').slice(0, 100);
|
|
16
|
+
return { filename: `${safe}.ics`, content: ics };
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
signedIn: !!me,
|
|
20
|
+
isEvent: post.type === 'event',
|
|
21
|
+
repost: () => repostPost(undefined),
|
|
22
|
+
eventIcsFile,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PublicProfile } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const useFollowProfile: (profile: PublicProfile, onSuccess?: () => void) => {
|
|
3
|
+
me: import("@openpeepshq/common").ProfileWithMeta | undefined;
|
|
4
|
+
isSelf: boolean;
|
|
5
|
+
isFollowing: boolean;
|
|
6
|
+
follow: () => Promise<void>;
|
|
7
|
+
unfollow: () => Promise<void>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
2
|
+
import { useCurrentProfile } from '../../components/layout/IdentityContext.js';
|
|
3
|
+
export const useFollowProfile = (profile, onSuccess) => {
|
|
4
|
+
const me = useCurrentProfile();
|
|
5
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
6
|
+
const followProfile = openpeepsApi.followProfileAction({ id: profile.id });
|
|
7
|
+
const unfollowProfile = openpeepsApi.unfollowProfileAction({
|
|
8
|
+
id: profile.id,
|
|
9
|
+
});
|
|
10
|
+
const isSelf = !me || me.id === profile.id;
|
|
11
|
+
const isFollowing = !!me?.following?.some((followed) => followed.id === profile.id);
|
|
12
|
+
const follow = async () => {
|
|
13
|
+
await followProfile({ reblogs: true, notify: true });
|
|
14
|
+
onSuccess?.();
|
|
15
|
+
};
|
|
16
|
+
const unfollow = async () => {
|
|
17
|
+
await unfollowProfile(undefined);
|
|
18
|
+
onSuccess?.();
|
|
19
|
+
};
|
|
20
|
+
return { me, isSelf, isFollowing, follow, unfollow };
|
|
21
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { PublicAccessToken, Scope, ScopeLevel } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const ACCESS_TOKEN_RESOURCE_TYPES: readonly ["*", "posts", "profiles", "groups", "jams", "notifications", "reports", "webhooks"];
|
|
3
|
+
export type AccessTokenResourceType = (typeof ACCESS_TOKEN_RESOURCE_TYPES)[number];
|
|
4
|
+
export declare const ACCESS_TOKEN_SCOPE_LEVELS: ScopeLevel[];
|
|
5
|
+
export declare const ACCESS_TOKEN_EXPIRATION_OPTIONS: readonly [{
|
|
6
|
+
readonly value: "7d";
|
|
7
|
+
readonly labelKey: "settings.accessTokens.expirationOptions.sevenDays";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "30d";
|
|
10
|
+
readonly labelKey: "settings.accessTokens.expirationOptions.thirtyDays";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "90d";
|
|
13
|
+
readonly labelKey: "settings.accessTokens.expirationOptions.ninetyDays";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "1y";
|
|
16
|
+
readonly labelKey: "settings.accessTokens.expirationOptions.oneYear";
|
|
17
|
+
}];
|
|
18
|
+
export declare const accessTokenScopeLabel: (scope: Scope) => string;
|
|
19
|
+
export type AccessTokenScopePatch = {
|
|
20
|
+
scopeLevel?: ScopeLevel;
|
|
21
|
+
resourceType?: AccessTokenResourceType;
|
|
22
|
+
};
|
|
23
|
+
export declare const updateScopeAt: (scopes: Scope[], index: number, patch: AccessTokenScopePatch) => Scope[];
|
|
24
|
+
export declare const useAccessTokens: () => {
|
|
25
|
+
tokens: PublicAccessToken[];
|
|
26
|
+
form: {
|
|
27
|
+
name: string;
|
|
28
|
+
expirationTime: string;
|
|
29
|
+
description?: string | undefined;
|
|
30
|
+
scopes?: {
|
|
31
|
+
resource: {
|
|
32
|
+
type: "groups" | "posts" | "self" | "*" | "db" | "jams" | "profiles" | "notifications" | "reports" | "webhooks" | "analytics" | "render";
|
|
33
|
+
id?: string | undefined;
|
|
34
|
+
};
|
|
35
|
+
scopeLevel?: "admin" | "write" | "read" | undefined;
|
|
36
|
+
}[] | undefined;
|
|
37
|
+
};
|
|
38
|
+
setForm: import("react").Dispatch<import("react").SetStateAction<{
|
|
39
|
+
name: string;
|
|
40
|
+
expirationTime: string;
|
|
41
|
+
description?: string | undefined;
|
|
42
|
+
scopes?: {
|
|
43
|
+
resource: {
|
|
44
|
+
type: "groups" | "posts" | "self" | "*" | "db" | "jams" | "profiles" | "notifications" | "reports" | "webhooks" | "analytics" | "render";
|
|
45
|
+
id?: string | undefined;
|
|
46
|
+
};
|
|
47
|
+
scopeLevel?: "admin" | "write" | "read" | undefined;
|
|
48
|
+
}[] | undefined;
|
|
49
|
+
}>>;
|
|
50
|
+
creating: boolean;
|
|
51
|
+
createdToken: string | undefined;
|
|
52
|
+
error: string | undefined;
|
|
53
|
+
clearError: () => void;
|
|
54
|
+
updateScope: (index: number, patch: AccessTokenScopePatch) => void;
|
|
55
|
+
addScope: () => void;
|
|
56
|
+
removeScope: (index: number) => void;
|
|
57
|
+
create: () => Promise<void>;
|
|
58
|
+
revoke: (accessTokenId: string) => Promise<{
|
|
59
|
+
success: true;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
3
|
+
import { useT } from '../../i18n/context.js';
|
|
4
|
+
export const ACCESS_TOKEN_RESOURCE_TYPES = [
|
|
5
|
+
'*',
|
|
6
|
+
'posts',
|
|
7
|
+
'profiles',
|
|
8
|
+
'groups',
|
|
9
|
+
'jams',
|
|
10
|
+
'notifications',
|
|
11
|
+
'reports',
|
|
12
|
+
'webhooks',
|
|
13
|
+
];
|
|
14
|
+
export const ACCESS_TOKEN_SCOPE_LEVELS = [
|
|
15
|
+
'read',
|
|
16
|
+
'write',
|
|
17
|
+
'admin',
|
|
18
|
+
];
|
|
19
|
+
export const ACCESS_TOKEN_EXPIRATION_OPTIONS = [
|
|
20
|
+
{
|
|
21
|
+
value: '7d',
|
|
22
|
+
labelKey: 'settings.accessTokens.expirationOptions.sevenDays',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: '30d',
|
|
26
|
+
labelKey: 'settings.accessTokens.expirationOptions.thirtyDays',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: '90d',
|
|
30
|
+
labelKey: 'settings.accessTokens.expirationOptions.ninetyDays',
|
|
31
|
+
},
|
|
32
|
+
{ value: '1y', labelKey: 'settings.accessTokens.expirationOptions.oneYear' },
|
|
33
|
+
];
|
|
34
|
+
export const accessTokenScopeLabel = (scope) => `${scope.scopeLevel ?? 'read'}:${scope.resource.type}:${scope.resource.id ?? '*'}`;
|
|
35
|
+
export const updateScopeAt = (scopes, index, patch) => scopes.map((s, i) => i === index
|
|
36
|
+
? {
|
|
37
|
+
...s,
|
|
38
|
+
scopeLevel: patch.scopeLevel ?? s.scopeLevel,
|
|
39
|
+
resource: {
|
|
40
|
+
...s.resource,
|
|
41
|
+
type: patch.resourceType ?? s.resource.type,
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
: s);
|
|
45
|
+
const defaultScope = {
|
|
46
|
+
scopeLevel: 'read',
|
|
47
|
+
resource: { type: 'posts', id: '*' },
|
|
48
|
+
};
|
|
49
|
+
const defaultForm = {
|
|
50
|
+
name: '',
|
|
51
|
+
description: '',
|
|
52
|
+
expirationTime: '30d',
|
|
53
|
+
scopes: [defaultScope],
|
|
54
|
+
};
|
|
55
|
+
export const useAccessTokens = () => {
|
|
56
|
+
const t = useT();
|
|
57
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
58
|
+
const tokensQuery = openpeepsApi.useCurrentProfileAccessTokens();
|
|
59
|
+
const createToken = openpeepsApi.createCurrentProfileAccessTokenAction();
|
|
60
|
+
const revokeToken = openpeepsApi.revokeCurrentProfileAccessTokenAction();
|
|
61
|
+
const [form, setForm] = useState(defaultForm);
|
|
62
|
+
const [creating, setCreating] = useState(false);
|
|
63
|
+
const [createdToken, setCreatedToken] = useState();
|
|
64
|
+
const [error, setError] = useState();
|
|
65
|
+
const tokens = (tokensQuery.data ?? []);
|
|
66
|
+
const updateScope = (index, patch) => setForm((f) => ({
|
|
67
|
+
...f,
|
|
68
|
+
scopes: updateScopeAt(f.scopes ?? [], index, patch),
|
|
69
|
+
}));
|
|
70
|
+
const addScope = () => setForm((f) => ({ ...f, scopes: [...(f.scopes ?? []), defaultScope] }));
|
|
71
|
+
const removeScope = (index) => setForm((f) => ({
|
|
72
|
+
...f,
|
|
73
|
+
scopes: (f.scopes ?? []).filter((_, i) => i !== index),
|
|
74
|
+
}));
|
|
75
|
+
const create = async () => {
|
|
76
|
+
setError(undefined);
|
|
77
|
+
if (!form.name?.trim()) {
|
|
78
|
+
setError(t('settings.accessTokens.nameRequired', {
|
|
79
|
+
defaultValue: 'Name is required',
|
|
80
|
+
}));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!(form.scopes?.length ?? 0)) {
|
|
84
|
+
setError(t('settings.accessTokens.scopeRequired', {
|
|
85
|
+
defaultValue: 'At least one scope is required',
|
|
86
|
+
}));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
setCreating(true);
|
|
90
|
+
setCreatedToken(undefined);
|
|
91
|
+
try {
|
|
92
|
+
const created = (await createToken({
|
|
93
|
+
name: form.name.trim(),
|
|
94
|
+
description: form.description?.trim() || undefined,
|
|
95
|
+
expirationTime: form.expirationTime,
|
|
96
|
+
scopes: (form.scopes ?? []).map((scope) => ({
|
|
97
|
+
...scope,
|
|
98
|
+
resource: { ...scope.resource, id: '*' },
|
|
99
|
+
})),
|
|
100
|
+
}));
|
|
101
|
+
setCreatedToken(created.signedToken);
|
|
102
|
+
setForm(defaultForm);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
setError(t('settings.accessTokens.createError', {
|
|
106
|
+
defaultValue: 'Failed to create token',
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
setCreating(false);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const revoke = (accessTokenId) => revokeToken({ accessTokenId });
|
|
114
|
+
return {
|
|
115
|
+
tokens,
|
|
116
|
+
form,
|
|
117
|
+
setForm,
|
|
118
|
+
creating,
|
|
119
|
+
createdToken,
|
|
120
|
+
error,
|
|
121
|
+
clearError: () => setError(undefined),
|
|
122
|
+
updateScope,
|
|
123
|
+
addScope,
|
|
124
|
+
removeScope,
|
|
125
|
+
create,
|
|
126
|
+
revoke,
|
|
127
|
+
};
|
|
128
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const useFeedFormatPreference: () => {
|
|
2
|
+
me: import("@openpeepshq/common").ProfileWithMeta | undefined;
|
|
3
|
+
format: "threaded" | "linear";
|
|
4
|
+
setFormat: import("react").Dispatch<import("react").SetStateAction<"threaded" | "linear">>;
|
|
5
|
+
submitting: boolean;
|
|
6
|
+
save: () => Promise<void>;
|
|
7
|
+
persisted: "threaded" | "linear";
|
|
8
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
3
|
+
import { useCurrentProfile } from '../../components/layout/IdentityContext.js';
|
|
4
|
+
import { useResolvedFeedFormat } from '../useResolvedFeedFormat.js';
|
|
5
|
+
export const useFeedFormatPreference = () => {
|
|
6
|
+
const me = useCurrentProfile();
|
|
7
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
8
|
+
const settingsQuery = openpeepsApi.useCurrentProfileSettings();
|
|
9
|
+
const updateSettings = openpeepsApi.updateCurrentProfileSettingsAction();
|
|
10
|
+
const { persisted, clearSessionFormat } = useResolvedFeedFormat();
|
|
11
|
+
const [format, setFormat] = useState(persisted);
|
|
12
|
+
const [submitting, setSubmitting] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setFormat(persisted);
|
|
15
|
+
}, [persisted]);
|
|
16
|
+
const save = async () => {
|
|
17
|
+
if (!me)
|
|
18
|
+
return;
|
|
19
|
+
setSubmitting(true);
|
|
20
|
+
try {
|
|
21
|
+
await updateSettings({
|
|
22
|
+
id: me.id,
|
|
23
|
+
feedSettings: {
|
|
24
|
+
...settingsQuery.data?.feedSettings,
|
|
25
|
+
format,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
clearSessionFormat();
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
setSubmitting(false);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return { me, format, setFormat, submitting, save, persisted };
|
|
35
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SettingsStatus } from './useTimezonePreference';
|
|
2
|
+
export declare const useLanguagePreference: () => {
|
|
3
|
+
profile: import("@openpeepshq/common").ProfileWithMeta | undefined;
|
|
4
|
+
language: string;
|
|
5
|
+
setLanguage: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
6
|
+
communityDefaultLanguage: string;
|
|
7
|
+
saving: boolean;
|
|
8
|
+
status: SettingsStatus;
|
|
9
|
+
clearStatus: () => void;
|
|
10
|
+
save: () => Promise<void>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
3
|
+
import { useI18n, useT } from '../../i18n/context.js';
|
|
4
|
+
import { useCurrentProfile } from '../../components/layout/IdentityContext.js';
|
|
5
|
+
import { useServerInfo } from '../../components/server-data/index.js';
|
|
6
|
+
export const useLanguagePreference = () => {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const { i18n } = useI18n();
|
|
9
|
+
const profile = useCurrentProfile();
|
|
10
|
+
const serverInfo = useServerInfo();
|
|
11
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
12
|
+
const settingsQuery = openpeepsApi.useCurrentProfileSettings();
|
|
13
|
+
const updateSettings = openpeepsApi.updateCurrentProfileSettingsAction();
|
|
14
|
+
const communityDefaultLanguage = serverInfo.communityConfig?.settings?.defaultLanguage ?? 'en';
|
|
15
|
+
const [language, setLanguage] = useState(communityDefaultLanguage);
|
|
16
|
+
const [saving, setSaving] = useState(false);
|
|
17
|
+
const [status, setStatus] = useState(null);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (settingsQuery.data?.language) {
|
|
20
|
+
setLanguage(settingsQuery.data.language);
|
|
21
|
+
}
|
|
22
|
+
}, [settingsQuery.data?.language]);
|
|
23
|
+
const save = async () => {
|
|
24
|
+
if (!profile)
|
|
25
|
+
return;
|
|
26
|
+
setStatus(null);
|
|
27
|
+
setSaving(true);
|
|
28
|
+
try {
|
|
29
|
+
await updateSettings({ id: profile.id, language });
|
|
30
|
+
await i18n.changeLanguage(language);
|
|
31
|
+
setStatus({
|
|
32
|
+
type: 'success',
|
|
33
|
+
message: t('settings.language.updateSuccess', {
|
|
34
|
+
defaultValue: 'Language updated.',
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
setStatus({ type: 'error', message: err.message });
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
setSaving(false);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
profile,
|
|
47
|
+
language,
|
|
48
|
+
setLanguage,
|
|
49
|
+
communityDefaultLanguage,
|
|
50
|
+
saving,
|
|
51
|
+
status,
|
|
52
|
+
clearStatus: () => setStatus(null),
|
|
53
|
+
save,
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ProfileNotificationSettings, type ProfileSettings } from '@openpeepshq/common';
|
|
2
|
+
export type UseNotificationPreferencesArgs = {
|
|
3
|
+
/** Host registers this device for push when any type wants it. */
|
|
4
|
+
ensurePush?: () => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
export declare const useNotificationPreferences: ({ ensurePush, }?: UseNotificationPreferencesArgs) => {
|
|
7
|
+
me: import("@openpeepshq/common").ProfileWithMeta | undefined;
|
|
8
|
+
types: {
|
|
9
|
+
type: string;
|
|
10
|
+
requiredCapabilities?: ("core-posts-delete" | "core-groups-read" | "core-groups-delete" | "core-groups-addMember" | "core-groups-removeMember" | "core-groups-changeMemberRole" | "core-profiles-read" | "core-profiles-update" | "core-profiles-delete" | "core-reports-create" | "core-serviceTokens-create" | "core-serviceTokens-read" | "core-serviceTokens-delete" | "core-local" | "core-accounts-read" | "core-accounts-create" | "core-accounts-update" | "core-accounts-delete" | "core-reports-update" | "core-groups-create" | "core-posts-create-note-local" | "core-posts-create-note-public" | "core-posts-create-note-direct" | "core-posts-create-note-private" | "core-posts-create-event-local" | "core-posts-create-event-public" | "core-posts-create-event-direct" | "core-posts-create-event-private" | "core-posts-create-poll-local" | "core-posts-create-poll-public" | "core-posts-create-poll-direct" | "core-posts-create-poll-private" | "core-posts-create-article-local" | "core-posts-create-article-public" | "core-posts-create-article-direct" | "core-posts-create-article-private" | "core-posts-read-local" | "core-posts-announce" | "core-profiles-roles-update" | "core-profiles-suspend" | "core-profiles-impersonate" | "core-analytics-read" | "core-config-update" | "core-config-read" | "core-customization-read" | "core-customization-update" | "core-capabilities-read" | "core-capabilities-update" | "core-backups-create" | "core-backups-read" | "core-backups-download" | "core-backups-restore" | "core-db-access" | "core-i18n-update" | "core-logs-read" | "core-roles-read" | "core-roles-update" | "core-maintenance-restart" | "core-inviteLinks-create" | "core-inviteLinks-read" | "core-inviteLinks-update" | "core-inviteLinks-delete" | "core-serviceTokens-update" | "core-plugins-manage")[] | undefined;
|
|
11
|
+
defaultSettings?: {
|
|
12
|
+
create: boolean;
|
|
13
|
+
push: boolean;
|
|
14
|
+
email: boolean;
|
|
15
|
+
} | undefined;
|
|
16
|
+
}[];
|
|
17
|
+
settings: ProfileSettings;
|
|
18
|
+
setTypeSettings: (type: string, next: ProfileNotificationSettings) => void;
|
|
19
|
+
save: () => Promise<void>;
|
|
20
|
+
saving: boolean;
|
|
21
|
+
status: {
|
|
22
|
+
type: "success" | "error";
|
|
23
|
+
message: string;
|
|
24
|
+
} | null;
|
|
25
|
+
clearStatus: () => void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { deepSet, } from '@openpeepshq/common';
|
|
3
|
+
import { useOpenpeeps } from '../../contexts/openpeeps/index.js';
|
|
4
|
+
import { useT } from '../../i18n/context.js';
|
|
5
|
+
import { useCurrentProfile } from '../../components/layout/IdentityContext.js';
|
|
6
|
+
export const useNotificationPreferences = ({ ensurePush, } = {}) => {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
9
|
+
const me = useCurrentProfile();
|
|
10
|
+
const notificationTypesQuery = openpeepsApi.useCurrentProfileNotificationTypes();
|
|
11
|
+
const settingsQuery = openpeepsApi.useCurrentProfileSettings();
|
|
12
|
+
const updateSettings = openpeepsApi.updateCurrentProfileSettingsAction();
|
|
13
|
+
const [settings, setSettings] = useState(() => ({
|
|
14
|
+
id: me?.id ?? '',
|
|
15
|
+
notifications: {},
|
|
16
|
+
}));
|
|
17
|
+
const [saving, setSaving] = useState(false);
|
|
18
|
+
const [status, setStatus] = useState(null);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (settingsQuery.data)
|
|
21
|
+
setSettings(settingsQuery.data);
|
|
22
|
+
}, [settingsQuery.data]);
|
|
23
|
+
const setTypeSettings = (type, next) => {
|
|
24
|
+
setSettings((current) => {
|
|
25
|
+
const copy = { ...current };
|
|
26
|
+
deepSet(copy, `notifications.${type}`, next);
|
|
27
|
+
return copy;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const save = async () => {
|
|
31
|
+
setStatus(null);
|
|
32
|
+
setSaving(true);
|
|
33
|
+
try {
|
|
34
|
+
const wantsPush = Object.values(settings.notifications ?? {}).some((entry) => entry?.push);
|
|
35
|
+
let pushWarning;
|
|
36
|
+
if (wantsPush && ensurePush) {
|
|
37
|
+
try {
|
|
38
|
+
await ensurePush();
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
pushWarning =
|
|
42
|
+
err instanceof Error
|
|
43
|
+
? err.message
|
|
44
|
+
: t('settings.notifications.pushSubscribeFailed', {
|
|
45
|
+
defaultValue: 'Could not enable push notifications on this device.',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
await updateSettings(settings);
|
|
50
|
+
setStatus({
|
|
51
|
+
type: 'success',
|
|
52
|
+
message: pushWarning
|
|
53
|
+
? t('settings.notifications.updateSuccessPushFailed', {
|
|
54
|
+
defaultValue: 'Notification settings updated, but push on this device failed: {{detail}}',
|
|
55
|
+
detail: pushWarning,
|
|
56
|
+
})
|
|
57
|
+
: t('settings.notifications.updateSuccess', {
|
|
58
|
+
defaultValue: 'Notification settings updated.',
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
setStatus({ type: 'error', message: err.message });
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
setSaving(false);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
me,
|
|
71
|
+
types: notificationTypesQuery.data ?? [],
|
|
72
|
+
settings,
|
|
73
|
+
setTypeSettings,
|
|
74
|
+
save,
|
|
75
|
+
saving,
|
|
76
|
+
status,
|
|
77
|
+
clearStatus: () => setStatus(null),
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { PushSubscription } from '@openpeepshq/common/types';
|
|
2
|
+
import type { SettingsStatus } from './useTimezonePreference';
|
|
3
|
+
export type UsePushEnabledDevicesArgs = {
|
|
4
|
+
/** Endpoint (web push) or FCM token of this device's subscription, if any. */
|
|
5
|
+
getCurrentEndpoint: () => Promise<string | null | undefined>;
|
|
6
|
+
/** Drop this device's local push registration after its row is deleted. */
|
|
7
|
+
unsubscribeCurrent: () => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare const usePushEnabledDevices: ({ getCurrentEndpoint, unsubscribeCurrent, }: UsePushEnabledDevicesArgs) => {
|
|
10
|
+
subscriptions: ({
|
|
11
|
+
type: "web";
|
|
12
|
+
endpoint: string;
|
|
13
|
+
keys: {
|
|
14
|
+
auth: string;
|
|
15
|
+
p256dh: string;
|
|
16
|
+
};
|
|
17
|
+
id: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
deviceName?: string | undefined;
|
|
21
|
+
alerts?: {
|
|
22
|
+
poll: boolean;
|
|
23
|
+
followRequest: boolean;
|
|
24
|
+
status: boolean;
|
|
25
|
+
favorite: boolean;
|
|
26
|
+
follow: boolean;
|
|
27
|
+
repost: boolean;
|
|
28
|
+
mention: boolean;
|
|
29
|
+
update: boolean;
|
|
30
|
+
admin: {
|
|
31
|
+
signUp: boolean;
|
|
32
|
+
report: boolean;
|
|
33
|
+
};
|
|
34
|
+
} | undefined;
|
|
35
|
+
deletedAt?: string | null | undefined;
|
|
36
|
+
} | {
|
|
37
|
+
type: "apn";
|
|
38
|
+
apnToken: string;
|
|
39
|
+
id: string;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
deviceName?: string | undefined;
|
|
43
|
+
alerts?: {
|
|
44
|
+
poll: boolean;
|
|
45
|
+
followRequest: boolean;
|
|
46
|
+
status: boolean;
|
|
47
|
+
favorite: boolean;
|
|
48
|
+
follow: boolean;
|
|
49
|
+
repost: boolean;
|
|
50
|
+
mention: boolean;
|
|
51
|
+
update: boolean;
|
|
52
|
+
admin: {
|
|
53
|
+
signUp: boolean;
|
|
54
|
+
report: boolean;
|
|
55
|
+
};
|
|
56
|
+
} | undefined;
|
|
57
|
+
deletedAt?: string | null | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
type: "fcm";
|
|
60
|
+
fcmToken: string;
|
|
61
|
+
id: string;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
deviceName?: string | undefined;
|
|
65
|
+
alerts?: {
|
|
66
|
+
poll: boolean;
|
|
67
|
+
followRequest: boolean;
|
|
68
|
+
status: boolean;
|
|
69
|
+
favorite: boolean;
|
|
70
|
+
follow: boolean;
|
|
71
|
+
repost: boolean;
|
|
72
|
+
mention: boolean;
|
|
73
|
+
update: boolean;
|
|
74
|
+
admin: {
|
|
75
|
+
signUp: boolean;
|
|
76
|
+
report: boolean;
|
|
77
|
+
};
|
|
78
|
+
} | undefined;
|
|
79
|
+
deletedAt?: string | null | undefined;
|
|
80
|
+
} | {
|
|
81
|
+
type: "webhook";
|
|
82
|
+
url: string;
|
|
83
|
+
publicKey: string;
|
|
84
|
+
id: string;
|
|
85
|
+
createdAt: string;
|
|
86
|
+
updatedAt: string;
|
|
87
|
+
alerts?: {
|
|
88
|
+
poll: boolean;
|
|
89
|
+
followRequest: boolean;
|
|
90
|
+
status: boolean;
|
|
91
|
+
favorite: boolean;
|
|
92
|
+
follow: boolean;
|
|
93
|
+
repost: boolean;
|
|
94
|
+
mention: boolean;
|
|
95
|
+
update: boolean;
|
|
96
|
+
admin: {
|
|
97
|
+
signUp: boolean;
|
|
98
|
+
report: boolean;
|
|
99
|
+
};
|
|
100
|
+
} | undefined;
|
|
101
|
+
deletedAt?: string | null | undefined;
|
|
102
|
+
})[];
|
|
103
|
+
isCurrentDevice: (endpoint: string | undefined) => boolean;
|
|
104
|
+
isCurrentSubscription: (subscription: PushSubscription) => boolean;
|
|
105
|
+
deletingId: string | null;
|
|
106
|
+
confirmId: string | null;
|
|
107
|
+
setConfirmId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
108
|
+
status: SettingsStatus;
|
|
109
|
+
clearStatus: () => void;
|
|
110
|
+
remove: (subscription: PushSubscription) => Promise<void>;
|
|
111
|
+
};
|