@openpeepshq/react 0.6.3 → 0.7.1

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.
Files changed (204) hide show
  1. package/dist/components/configuration/ConfigurationCategory.js +3 -2
  2. package/dist/components/configuration/ConfigurationList.js +1 -1
  3. package/dist/components/form/LocationInput.js +1 -1
  4. package/dist/components/groups/GroupHeader.js +2 -1
  5. package/dist/components/groups/GroupNotificationSettingsModal.d.ts +9 -0
  6. package/dist/components/groups/GroupNotificationSettingsModal.js +57 -0
  7. package/dist/components/groups/GroupShareMenu.js +30 -8
  8. package/dist/components/groups/index.d.ts +2 -0
  9. package/dist/components/groups/index.js +1 -0
  10. package/dist/components/jams/JamCapacityGate.js +1 -1
  11. package/dist/components/jams/JamConference.js +2 -0
  12. package/dist/components/jams/JamParticipantConference.js +2 -0
  13. package/dist/components/jams/JamRoom.js +2 -3
  14. package/dist/components/jams/LiveJamsSection.js +8 -2
  15. package/dist/components/jams/LivekitUnavailableNotice.d.ts +9 -0
  16. package/dist/components/jams/LivekitUnavailableNotice.js +19 -0
  17. package/dist/components/jams/dropLateAudio.d.ts +22 -0
  18. package/dist/components/jams/dropLateAudio.js +115 -0
  19. package/dist/components/jams/index.d.ts +1 -0
  20. package/dist/components/jams/index.js +1 -0
  21. package/dist/components/notifications/TypedNotification.js +46 -4
  22. package/dist/components/post/Markdown.d.ts +2 -2
  23. package/dist/components/post/Markdown.js +1 -1
  24. package/dist/components/post/attachmentPreview.js +1 -1
  25. package/dist/components/post/pieces/Attachments.js +23 -17
  26. package/dist/components/post/pieces/EventRsvpButton.js +37 -7
  27. package/dist/components/post/pieces/EventRsvpList.js +23 -3
  28. package/dist/components/post/pieces/EventRsvpScopeDialog.d.ts +1 -1
  29. package/dist/components/post/pieces/EventRsvpScopeDialog.js +34 -22
  30. package/dist/components/post/pieces/EventWaitlistJoinDialog.d.ts +10 -0
  31. package/dist/components/post/pieces/EventWaitlistJoinDialog.js +26 -0
  32. package/dist/components/post/pieces/ParticipantsCard.d.ts +1 -1
  33. package/dist/components/post/pieces/ParticipantsCard.js +1 -1
  34. package/dist/components/post/pieces/PostActions.d.ts +1 -1
  35. package/dist/components/post/pieces/PostActions.js +20 -12
  36. package/dist/components/post/pieces/ShareMenu.d.ts +6 -1
  37. package/dist/components/post/pieces/ShareMenu.js +40 -7
  38. package/dist/components/post/post-form/EventForm.js +10 -2
  39. package/dist/components/post/types/Article.js +1 -1
  40. package/dist/components/post/types/article/FullArticle.js +1 -1
  41. package/dist/components/post/types/event/CardEvent.js +2 -1
  42. package/dist/components/post/types/event/FullEvent.js +21 -11
  43. package/dist/components/post/types/event/ProfileEventRelationship.js +8 -0
  44. package/dist/components/preview-link/LocalPreviewLink.js +4 -2
  45. package/dist/components/preview-link/PreviewLink.js +1 -1
  46. package/dist/components/preview-link/helpers.d.ts +5 -0
  47. package/dist/components/preview-link/helpers.js +27 -1
  48. package/dist/components/preview-link/local/WelcomePreview.d.ts +1 -0
  49. package/dist/components/preview-link/local/WelcomePreview.js +6 -0
  50. package/dist/components/profile/Avatar.js +2 -2
  51. package/dist/components/profile/ProfileFromId.js +1 -1
  52. package/dist/components/server-data/context.d.ts +1 -0
  53. package/dist/contexts/openpeeps/hooks/accounts.d.ts +5 -5
  54. package/dist/contexts/openpeeps/hooks/accounts.js +1 -3
  55. package/dist/contexts/openpeeps/hooks/admin.d.ts +165 -66
  56. package/dist/contexts/openpeeps/hooks/admin.js +11 -3
  57. package/dist/contexts/openpeeps/hooks/auth.d.ts +2 -2
  58. package/dist/contexts/openpeeps/hooks/groups.d.ts +8 -8
  59. package/dist/contexts/openpeeps/hooks/jams.d.ts +73 -24
  60. package/dist/contexts/openpeeps/hooks/other.d.ts +7 -6
  61. package/dist/contexts/openpeeps/hooks/payments.d.ts +2 -2
  62. package/dist/contexts/openpeeps/hooks/posts.d.ts +368 -170
  63. package/dist/contexts/openpeeps/hooks/streaming.d.ts +1 -1
  64. package/dist/hooks/admin/useCanAccessAdminSection.d.ts +13 -0
  65. package/dist/hooks/admin/useCanAccessAdminSection.js +21 -0
  66. package/dist/hooks/events/useEventComposer.d.ts +94 -41
  67. package/dist/hooks/events/useEventForm.d.ts +1 -0
  68. package/dist/hooks/events/useEventRsvp.d.ts +11 -2
  69. package/dist/hooks/events/useEventRsvp.js +46 -5
  70. package/dist/hooks/events/useEventsCalendar.d.ts +174 -76
  71. package/dist/hooks/groups/useGroupNotificationLevel.d.ts +9 -0
  72. package/dist/hooks/groups/useGroupNotificationLevel.js +57 -0
  73. package/dist/hooks/groups/useNewGroup.js +22 -2
  74. package/dist/hooks/index.d.ts +6 -1
  75. package/dist/hooks/index.js +5 -1
  76. package/dist/hooks/jams/useCanDiagnoseLivekit.d.ts +2 -0
  77. package/dist/hooks/jams/useCanDiagnoseLivekit.js +3 -0
  78. package/dist/hooks/jams/useCreateNewJamForm.d.ts +3 -1
  79. package/dist/hooks/jams/useJamDetails.d.ts +87 -38
  80. package/dist/hooks/jams/useJamLobby.d.ts +1 -0
  81. package/dist/hooks/jams/useJamRoom.d.ts +175 -76
  82. package/dist/hooks/posts/useArticleComposer.d.ts +93 -41
  83. package/dist/hooks/posts/useFeedPostPresentation.d.ts +174 -76
  84. package/dist/hooks/posts/usePostDetailTitle.d.ts +87 -38
  85. package/dist/hooks/posts/useResourceComposer.d.ts +93 -41
  86. package/dist/hooks/posts/useResourceComposer.js +4 -2
  87. package/dist/hooks/posts/useShareMenu.d.ts +2 -0
  88. package/dist/hooks/posts/useShareMenu.js +7 -0
  89. package/dist/hooks/resources/useResourceLibrary.d.ts +176 -78
  90. package/dist/hooks/settings/useNotificationPreferences.d.ts +1 -1
  91. package/dist/hooks/useWelcomePreview.d.ts +13 -0
  92. package/dist/hooks/useWelcomePreview.js +39 -0
  93. package/dist/lib/groupFormErrors.d.ts +1 -0
  94. package/dist/lib/groupFormErrors.js +5 -2
  95. package/dist/lib/threadHelpers.js +1 -5
  96. package/dist/pages/admin/ConfigurationCommunity.js +1 -1
  97. package/dist/pages/admin/Diagnostics.js +1 -1
  98. package/dist/pages/admin/DiagnosticsLivekit.d.ts +1 -0
  99. package/dist/pages/admin/DiagnosticsLivekit.js +50 -0
  100. package/dist/pages/admin/Invites.js +5 -3
  101. package/dist/pages/admin/Media.d.ts +1 -0
  102. package/dist/pages/admin/Media.js +135 -0
  103. package/dist/pages/admin/community/CommunityForbiddenUsernames.d.ts +1 -0
  104. package/dist/pages/admin/community/CommunityForbiddenUsernames.js +106 -0
  105. package/dist/pages/admin/community/CommunityRoles.js +1 -1
  106. package/dist/pages/admin/community/useCommunityConfig.d.ts +2 -0
  107. package/dist/pages/admin/components/EditInviteLinkModal.d.ts +5 -0
  108. package/dist/pages/admin/components/EditInviteLinkModal.js +131 -0
  109. package/dist/pages/admin/configurationSsoShared.d.ts +4 -0
  110. package/dist/pages/auth/Register.js +30 -8
  111. package/dist/pages/conversations/Show.js +11 -0
  112. package/dist/pages/groups/Show.js +22 -19
  113. package/dist/pages/index.d.ts +3 -0
  114. package/dist/pages/index.js +3 -0
  115. package/dist/pages/jams/Index.js +2 -4
  116. package/dist/pages/settings/PublicProfile.js +15 -3
  117. package/dist/pwa/sw.d.ts +0 -1
  118. package/dist/react-native.d.ts +2 -1
  119. package/dist/react-native.js +2 -1
  120. package/dist/stores/newPosts.d.ts +4 -2
  121. package/dist/stores/newPosts.js +6 -1
  122. package/package.json +11 -6
  123. package/src/components/configuration/ConfigurationCategory.tsx +23 -10
  124. package/src/components/configuration/ConfigurationList.tsx +6 -1
  125. package/src/components/form/LocationInput.tsx +7 -1
  126. package/src/components/groups/GroupHeader.tsx +2 -0
  127. package/src/components/groups/GroupNotificationSettingsModal.tsx +163 -0
  128. package/src/components/groups/GroupShareMenu.tsx +77 -12
  129. package/src/components/groups/index.ts +5 -0
  130. package/src/components/jams/JamCapacityGate.tsx +1 -1
  131. package/src/components/jams/JamConference.tsx +2 -0
  132. package/src/components/jams/JamParticipantConference.tsx +2 -0
  133. package/src/components/jams/JamRoom.tsx +2 -6
  134. package/src/components/jams/LiveJamsSection.tsx +16 -2
  135. package/src/components/jams/LivekitUnavailableNotice.tsx +40 -0
  136. package/src/components/jams/dropLateAudio.ts +153 -0
  137. package/src/components/jams/index.ts +1 -0
  138. package/src/components/notifications/TypedNotification.tsx +81 -9
  139. package/src/components/post/Markdown.tsx +8 -2
  140. package/src/components/post/attachmentPreview.ts +1 -3
  141. package/src/components/post/pieces/Attachments.tsx +93 -78
  142. package/src/components/post/pieces/EventRsvpButton.tsx +107 -7
  143. package/src/components/post/pieces/EventRsvpList.tsx +64 -0
  144. package/src/components/post/pieces/EventRsvpScopeDialog.tsx +39 -27
  145. package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +77 -0
  146. package/src/components/post/pieces/ParticipantsCard.tsx +4 -1
  147. package/src/components/post/pieces/PostActions.tsx +73 -42
  148. package/src/components/post/pieces/ShareMenu.tsx +67 -9
  149. package/src/components/post/post-form/EventForm.tsx +26 -0
  150. package/src/components/post/post-form/VisibilitySelector.tsx +1 -2
  151. package/src/components/post/types/Article.tsx +1 -1
  152. package/src/components/post/types/article/FullArticle.tsx +2 -2
  153. package/src/components/post/types/event/CardEvent.tsx +26 -14
  154. package/src/components/post/types/event/FullEvent.tsx +47 -29
  155. package/src/components/post/types/event/ProfileEventRelationship.tsx +8 -0
  156. package/src/components/post/types/note/FullNote.tsx +1 -4
  157. package/src/components/post/types/poll/FullPoll.tsx +1 -4
  158. package/src/components/preview-link/LocalPreviewLink.tsx +4 -1
  159. package/src/components/preview-link/PreviewLink.tsx +2 -7
  160. package/src/components/preview-link/helpers.ts +32 -1
  161. package/src/components/preview-link/local/GroupPreview.tsx +1 -1
  162. package/src/components/preview-link/local/JamPreview.tsx +1 -1
  163. package/src/components/preview-link/local/WelcomePreview.tsx +36 -0
  164. package/src/components/profile/Avatar.tsx +6 -2
  165. package/src/components/profile/ProfileFromId.tsx +1 -5
  166. package/src/components/resources/ResourceCard.tsx +0 -1
  167. package/src/contexts/openpeeps/hooks/accounts.ts +1 -3
  168. package/src/contexts/openpeeps/hooks/admin.ts +11 -3
  169. package/src/contexts/openpeeps/hooks/other.ts +9 -12
  170. package/src/contexts/openpeeps/hooks/streaming.ts +3 -3
  171. package/src/css.d.ts +4 -0
  172. package/src/hooks/admin/useCanAccessAdminSection.ts +27 -0
  173. package/src/hooks/events/useEventRsvp.ts +51 -7
  174. package/src/hooks/groups/useGroupNotificationLevel.ts +57 -0
  175. package/src/hooks/groups/useNewGroup.ts +28 -3
  176. package/src/hooks/index.ts +9 -1
  177. package/src/hooks/jams/useCanDiagnoseLivekit.ts +5 -0
  178. package/src/hooks/posts/useResourceComposer.ts +8 -6
  179. package/src/hooks/posts/useShareMenu.ts +9 -0
  180. package/src/hooks/useWelcomePreview.ts +57 -0
  181. package/src/i18n/I18nProvider.tsx +1 -4
  182. package/src/lib/groupFormErrors.ts +9 -2
  183. package/src/lib/threadHelpers.ts +1 -5
  184. package/src/pages/admin/ConfigurationCommunity.tsx +5 -0
  185. package/src/pages/admin/Diagnostics.tsx +4 -0
  186. package/src/pages/admin/DiagnosticsLivekit.tsx +147 -0
  187. package/src/pages/admin/Invites.tsx +23 -1
  188. package/src/pages/admin/Media.tsx +290 -0
  189. package/src/pages/admin/community/CommunityForbiddenUsernames.tsx +223 -0
  190. package/src/pages/admin/community/CommunityRoles.tsx +2 -2
  191. package/src/pages/admin/components/EditInviteLinkModal.tsx +263 -0
  192. package/src/pages/auth/Register.tsx +33 -4
  193. package/src/pages/conversations/Show.tsx +11 -0
  194. package/src/pages/groups/Show.tsx +60 -53
  195. package/src/pages/index.ts +3 -0
  196. package/src/pages/jams/Index.tsx +2 -6
  197. package/src/pages/settings/PublicProfile.tsx +20 -2
  198. package/src/pwa/sw.ts +6 -3
  199. package/src/pwa/useNotificationBadgeSync.ts +3 -1
  200. package/src/react-native.ts +2 -1
  201. package/src/stores/newPosts.ts +6 -1
  202. package/src/streaming.ts +3 -3
  203. package/dist/setupTests.d.ts +0 -1
  204. package/dist/setupTests.js +0 -5
@@ -7,7 +7,7 @@ export declare const useNotificationPreferences: ({ ensurePush, }?: UseNotificat
7
7
  me: import("@openpeepshq/common").ProfileWithMeta | undefined;
8
8
  types: {
9
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-create-resource-local" | "core-posts-create-resource-public" | "core-posts-create-resource-direct" | "core-posts-create-resource-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;
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-create-resource-local" | "core-posts-create-resource-public" | "core-posts-create-resource-direct" | "core-posts-create-resource-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-media-read" | "core-media-delete" | "core-inviteLinks-create" | "core-inviteLinks-read" | "core-inviteLinks-update" | "core-inviteLinks-delete" | "core-serviceTokens-update" | "core-plugins-manage")[] | undefined;
11
11
  defaultSettings?: {
12
12
  create: boolean;
13
13
  push: boolean;
@@ -0,0 +1,13 @@
1
+ export type WelcomePreviewContent = {
2
+ /** Short label above the title. Omitted when it would repeat the title. */
3
+ eyebrow?: string;
4
+ title: string;
5
+ description: string;
6
+ imageUrl?: string;
7
+ imageFit: 'cover' | 'contain';
8
+ };
9
+ /**
10
+ * Shared welcome-link card. Native passes the device color scheme because
11
+ * `getTheme` cannot read it from `window` there.
12
+ */
13
+ export declare const useWelcomePreview: (systemScheme?: "dark" | "light") => WelcomePreviewContent;
@@ -0,0 +1,39 @@
1
+ import { getTheme } from '@openpeepshq/common';
2
+ import { useCurrentProfileSettings } from '../components/layout/IdentityContext.js';
3
+ import { firstMarkdownImage, welcomePreviewExcerpt, } from '../components/preview-link/helpers.js';
4
+ import { useServerInfo } from '../components/server-data/context.js';
5
+ import { useT } from '../i18n/context.js';
6
+ /**
7
+ * Shared welcome-link card. Native passes the device color scheme because
8
+ * `getTheme` cannot read it from `window` there.
9
+ */
10
+ export const useWelcomePreview = (systemScheme) => {
11
+ const t = useT();
12
+ const serverInfo = useServerInfo();
13
+ const profileSettings = useCurrentProfileSettings();
14
+ const config = serverInfo.communityConfig;
15
+ const configured = config.content.welcomePage?.trim() ?? '';
16
+ const markdownImage = firstMarkdownImage(configured);
17
+ const logo = (systemScheme
18
+ ? getTheme(config, profileSettings, systemScheme)
19
+ : getTheme(config, profileSettings)).logoSmall;
20
+ const label = t('welcome.previewLabel', { defaultValue: 'Welcome page' });
21
+ const name = config.info.name.trim();
22
+ const title = name
23
+ ? t('welcome.heading', {
24
+ name,
25
+ defaultValue: 'Welcome to {{name}}',
26
+ })
27
+ : label;
28
+ return {
29
+ eyebrow: title === label ? undefined : label,
30
+ title,
31
+ description: configured
32
+ ? welcomePreviewExcerpt(configured)
33
+ : t('welcome.defaultIntro', {
34
+ defaultValue: 'Welcome to this community, hosted on AllPeep.',
35
+ }),
36
+ imageUrl: markdownImage || logo || undefined,
37
+ imageFit: markdownImage ? 'cover' : 'contain',
38
+ };
39
+ };
@@ -9,6 +9,7 @@ export declare const groupFormFieldErrors: (data: {
9
9
  handle?: string;
10
10
  }, t: TFunction, options?: {
11
11
  skipHandle?: boolean;
12
+ additionalForbiddenHandles?: readonly string[];
12
13
  }) => GroupFormFieldErrors;
13
14
  /** Server conflict when a group/profile handle is already taken. */
14
15
  export declare const isDuplicateHandleError: (err: unknown) => boolean;
@@ -1,10 +1,10 @@
1
- import { accountNameSchema, GROUP_DISPLAY_NAME_MAX_LENGTH, } from '@openpeepshq/common/types';
1
+ import { accountNameSchema, GROUP_DISPLAY_NAME_MAX_LENGTH, HANDLE_RESERVED_MESSAGE, isForbiddenHandle, } from '@openpeepshq/common/types';
2
2
  export const hasGroupFormFieldErrors = (errors) => Boolean(errors.displayName || errors.handle);
3
3
  const displayNameMaxLengthMessage = (t) => t('groups.form.displayNameMaxLength', {
4
4
  defaultValue: `Group name should be ${GROUP_DISPLAY_NAME_MAX_LENGTH} characters or fewer`,
5
5
  max: GROUP_DISPLAY_NAME_MAX_LENGTH,
6
6
  });
7
- const handleErrorMessage = (issue, t) => issue === 'Handle is reserved'
7
+ const handleErrorMessage = (issue, t) => issue === HANDLE_RESERVED_MESSAGE
8
8
  ? t('profile.form.handleReserved', {
9
9
  defaultValue: 'That handle is reserved. Please choose another.',
10
10
  })
@@ -26,6 +26,9 @@ export const groupFormFieldErrors = (data, t, options) => {
26
26
  if (!result.success) {
27
27
  errors.handle = handleErrorMessage(result.error.issues[0]?.message, t);
28
28
  }
29
+ else if (isForbiddenHandle(handle, options?.additionalForbiddenHandles)) {
30
+ errors.handle = handleErrorMessage(HANDLE_RESERVED_MESSAGE, t);
31
+ }
29
32
  }
30
33
  else if (!displayName && !errors.displayName) {
31
34
  errors.displayName = t('handle.validation.error', {
@@ -15,9 +15,5 @@ export const lastLongestPathSelector = (thread) => {
15
15
  export const collectPath = (thread, currentPath = []) => {
16
16
  if (!thread)
17
17
  return currentPath;
18
- return [
19
- ...currentPath,
20
- thread,
21
- ...collectPath(thread.children[0]),
22
- ];
18
+ return [...currentPath, thread, ...collectPath(thread.children[0])];
23
19
  };
@@ -3,5 +3,5 @@ import { useSetPageHeader } from '../../index.js';
3
3
  import { ConfigMenuButton } from '../../components/index.js';
4
4
  export function AdminConfigurationCommunity() {
5
5
  useSetPageHeader('Community Customization');
6
- return (_jsxs("div", { className: "p-4", children: [_jsx(ConfigMenuButton, { translationPrefix: "configuration.community.info", action: "/admin/configuration/community/info" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.favicons", action: "/admin/configuration/community/favicons" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.theme", action: "/admin/configuration/community/theme" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.welcomePage", action: "/admin/configuration/community/welcome-page" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.codeOfConduct", action: "/admin/configuration/community/code-of-conduct" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.welcomeEmail", action: "/admin/configuration/community/welcome-email" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.aboutPage", action: "/admin/configuration/community/about-page" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.links", action: "/admin/configuration/community/links" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.profileFields", action: "/admin/configuration/community/profile-fields" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.roles", action: "/admin/configuration/community/roles" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.language", action: "/admin/configuration/community/language" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.timezone", action: "/admin/configuration/community/timezone" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.feed", action: "/admin/configuration/community/feed" })] }));
6
+ return (_jsxs("div", { className: "p-4", children: [_jsx(ConfigMenuButton, { translationPrefix: "configuration.community.info", action: "/admin/configuration/community/info" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.favicons", action: "/admin/configuration/community/favicons" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.theme", action: "/admin/configuration/community/theme" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.welcomePage", action: "/admin/configuration/community/welcome-page" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.codeOfConduct", action: "/admin/configuration/community/code-of-conduct" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.welcomeEmail", action: "/admin/configuration/community/welcome-email" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.aboutPage", action: "/admin/configuration/community/about-page" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.links", action: "/admin/configuration/community/links" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.profileFields", action: "/admin/configuration/community/profile-fields" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.forbiddenUsernames", action: "/admin/configuration/community/forbidden-usernames", testId: "admin-community-forbidden-usernames" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.roles", action: "/admin/configuration/community/roles" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.language", action: "/admin/configuration/community/language" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.timezone", action: "/admin/configuration/community/timezone" }), _jsx(ConfigMenuButton, { translationPrefix: "configuration.community.feed", action: "/admin/configuration/community/feed" })] }));
7
7
  }
@@ -4,5 +4,5 @@ import { ConfigMenuButton } from '../../components/index.js';
4
4
  export function AdminDiagnostics() {
5
5
  const t = useT();
6
6
  useSetPageHeader(t('diagnostics.title', { defaultValue: 'Diagnostics' }));
7
- return (_jsxs("div", { className: "p-4", children: [_jsx(ConfigMenuButton, { translationPrefix: "diagnostics.email", action: "/admin/diagnostics/email" }), _jsx(ConfigMenuButton, { translationPrefix: "diagnostics.logs", action: "/admin/diagnostics/logs" }), _jsx(ConfigMenuButton, { translationPrefix: "diagnostics.performance", action: "/admin/diagnostics/performance" })] }));
7
+ return (_jsxs("div", { className: "p-4", children: [_jsx(ConfigMenuButton, { translationPrefix: "diagnostics.email", action: "/admin/diagnostics/email" }), _jsx(ConfigMenuButton, { translationPrefix: "diagnostics.livekit", action: "/admin/diagnostics/livekit" }), _jsx(ConfigMenuButton, { translationPrefix: "diagnostics.logs", action: "/admin/diagnostics/logs" }), _jsx(ConfigMenuButton, { translationPrefix: "diagnostics.performance", action: "/admin/diagnostics/performance" })] }));
8
8
  }
@@ -0,0 +1 @@
1
+ export declare const AdminDiagnosticsLivekit: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
3
+ import { Button } from '@openpeepshq/react-ui';
4
+ const checkLabelKey = {
5
+ url: 'diagnostics.livekit.url',
6
+ apiKey: 'diagnostics.livekit.apiKey',
7
+ apiSecret: 'diagnostics.livekit.apiSecret',
8
+ reachable: 'diagnostics.livekit.reachable',
9
+ };
10
+ export const AdminDiagnosticsLivekit = () => {
11
+ const t = useT();
12
+ const { openpeepsApi } = useOpenpeeps();
13
+ const diagnosisQuery = openpeepsApi.admin.useLivekitDiagnosis();
14
+ useSetPageHeader(t('diagnostics.livekit.title', { defaultValue: 'LiveKit' }));
15
+ const diagnosis = diagnosisQuery.data;
16
+ return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: t('diagnostics.livekit.description', {
17
+ defaultValue: 'Check whether jams can reach the LiveKit server. Missing or invalid credentials disable live jams.',
18
+ }) }), _jsx(Button, { variant: "outline", title: t('diagnostics.livekit.refresh', { defaultValue: 'Refresh' }), action: () => void diagnosisQuery.refetch(), children: t('diagnostics.livekit.refresh', { defaultValue: 'Refresh' }) }), diagnosisQuery.isPending ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('common.form.loading', { defaultValue: 'Loading…' }) })) : null, diagnosisQuery.isError ? (_jsx("p", { className: "text-error text-sm", children: t('diagnostics.livekit.loadError', {
19
+ defaultValue: 'Could not load the LiveKit diagnosis.',
20
+ }) })) : null, diagnosis ? _jsx(DiagnosisReport, { diagnosis: diagnosis }) : null] }));
21
+ };
22
+ const DiagnosisReport = ({ diagnosis }) => {
23
+ const t = useT();
24
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx("p", { className: `font-medium ${diagnosis.connected ? 'text-success' : 'text-error'}`, role: "status", children: diagnosis.connected
25
+ ? t('diagnostics.livekit.connected', { defaultValue: 'Connected' })
26
+ : t('diagnostics.livekit.notConnected', {
27
+ defaultValue: 'Not connected',
28
+ }) }), _jsx("ul", { className: "border-border divide-border divide-y rounded-md border", children: diagnosis.checks.map((check) => {
29
+ const status = check.id === 'reachable'
30
+ ? check.ok
31
+ ? t('diagnostics.livekit.ok', { defaultValue: 'OK' })
32
+ : t('diagnostics.livekit.failed', { defaultValue: 'Failed' })
33
+ : check.ok
34
+ ? t('diagnostics.livekit.set', { defaultValue: 'Set' })
35
+ : t('diagnostics.livekit.missing', {
36
+ defaultValue: 'Missing',
37
+ });
38
+ return (_jsxs("li", { className: "flex items-start justify-between gap-4 p-3 text-sm", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: t(checkLabelKey[check.id], {
39
+ defaultValue: check.id,
40
+ }) }), check.id === 'url' && diagnosis.url ? (_jsx("p", { className: "text-muted-foreground font-mono text-xs", children: diagnosis.url })) : null] }), _jsx("span", { className: `rounded px-2 py-0.5 text-xs font-medium ${check.ok ? 'bg-success/20 text-success' : 'bg-error/20 text-error'}`, children: status })] }, check.id));
41
+ }) }), _jsxs("p", { className: "text-sm", children: [t('diagnostics.livekit.recording', { defaultValue: 'Recording' }), ': ', _jsx("strong", { children: diagnosis.recordingEnabled
42
+ ? t('diagnostics.livekit.recordingOn', {
43
+ defaultValue: 'Enabled',
44
+ })
45
+ : t('diagnostics.livekit.recordingOff', {
46
+ defaultValue: 'Disabled',
47
+ }) })] }), diagnosis.error ? (_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: t('diagnostics.livekit.error', { defaultValue: 'Last error' }) }), _jsx("pre", { className: "bg-surface mt-2 overflow-x-auto whitespace-pre-wrap break-words rounded-md p-3 font-mono text-xs", children: diagnosis.error })] })) : null, !diagnosis.connected ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('diagnostics.livekit.envHint', {
48
+ defaultValue: 'Set JAMS_LIVEKIT_URL, JAMS_LIVEKIT_API_KEY, and JAMS_LIVEKIT_API_SECRET on the server, then refresh.',
49
+ }) })) : null] }));
50
+ };
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from 'react';
3
- import { CheckCheck, Copy, MoreVertical, QrCode, Users, X } from 'lucide-react';
3
+ import { CheckCheck, Copy, MoreVertical, Pencil, QrCode, Users, X, } from 'lucide-react';
4
4
  import { inviteLinkMatchesQuery } from '@openpeepshq/common/lib';
5
5
  import { useT, useOpenpeeps, useServerInfo, useSetPageHeader, } from '../../index.js';
6
6
  import { Avatar } from '../../components/index.js';
7
7
  import { UpdatingDate } from '@openpeepshq/react-ui';
8
8
  import { Dialog, DialogContent, DialogHeader, DialogTitle, Input, PopupMenu, PopupMenuButton, } from '@openpeepshq/react-ui';
9
9
  import { AdminInviteActions } from './components/AdminInviteActions.js';
10
+ import { EditInviteLinkModal } from './components/EditInviteLinkModal.js';
10
11
  import { communityQrLogoSrc, downloadInviteQr, inviteUrl, } from './components/inviteQr.js';
11
12
  export function AdminInvites() {
12
13
  const t = useT();
@@ -49,13 +50,14 @@ function InvitesTablePopup({ invite }) {
49
50
  const activate = openpeepsApi.admin.activateInviteAction();
50
51
  const deactivate = openpeepsApi.admin.deactivateInviteAction();
51
52
  const [showInvited, setShowInvited] = useState(false);
53
+ const [showEdit, setShowEdit] = useState(false);
52
54
  const active = invite.active && new Date(invite.expiresAt) > new Date();
53
55
  const expired = new Date(invite.expiresAt) <= new Date();
54
56
  return (_jsxs(_Fragment, { children: [_jsxs(PopupMenu, { placement: "bottom-end", width: "w-56", icon: MoreVertical, children: [_jsx(PopupMenuButton, { icon: Users, title: t('admin.invites.seeInvitedAccounts', {
55
57
  defaultValue: 'See invited accounts',
56
58
  }), text: t('admin.invites.seeInvitedAccounts', {
57
59
  defaultValue: 'See invited accounts',
58
- }), action: () => setShowInvited(true) }), active ? (_jsxs(_Fragment, { children: [_jsx(PopupMenuButton, { icon: Copy, title: t('admin.invites.copyLink', {
60
+ }), action: () => setShowInvited(true) }), _jsx(PopupMenuButton, { icon: Pencil, title: t('admin.invites.edit', { defaultValue: 'Edit' }), text: t('admin.invites.edit', { defaultValue: 'Edit' }), action: () => setShowEdit(true) }), active ? (_jsxs(_Fragment, { children: [_jsx(PopupMenuButton, { icon: Copy, title: t('admin.invites.copyLink', {
59
61
  defaultValue: 'Copy link',
60
62
  }), text: t('admin.invites.copyLink', { defaultValue: 'Copy link' }), action: () => void navigator.clipboard.writeText(inviteUrl(invite.slug)) }), _jsx(PopupMenuButton, { icon: QrCode, title: t('admin.invites.saveAsQrCode', {
61
63
  defaultValue: 'Save as QR code',
@@ -65,7 +67,7 @@ function InvitesTablePopup({ invite }) {
65
67
  defaultValue: 'Deactivate',
66
68
  }), text: t('admin.invites.deactivate', {
67
69
  defaultValue: 'Deactivate',
68
- }), action: () => deactivate({ id: invite.id }) })] })) : !expired ? (_jsx(PopupMenuButton, { icon: CheckCheck, title: t('admin.invites.activate', { defaultValue: 'Activate' }), text: t('admin.invites.activate', { defaultValue: 'Activate' }), action: () => activate({ id: invite.id }) })) : null] }), showInvited ? (_jsx(ListOfInvitedMembers, { invite: invite, onClose: () => setShowInvited(false) })) : null] }));
70
+ }), action: () => deactivate({ id: invite.id }) })] })) : !expired ? (_jsx(PopupMenuButton, { icon: CheckCheck, title: t('admin.invites.activate', { defaultValue: 'Activate' }), text: t('admin.invites.activate', { defaultValue: 'Activate' }), action: () => activate({ id: invite.id }) })) : null] }), showInvited ? (_jsx(ListOfInvitedMembers, { invite: invite, onClose: () => setShowInvited(false) })) : null, showEdit ? (_jsx(EditInviteLinkModal, { invite: invite, onClose: () => setShowEdit(false) })) : null] }));
69
71
  }
70
72
  function ListOfInvitedMembers({ invite, onClose, }) {
71
73
  const t = useT();
@@ -0,0 +1 @@
1
+ export declare const AdminMedia: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,135 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
3
+ import { Images } from 'lucide-react';
4
+ import { checkRoleCapabilities } from '@openpeepshq/common';
5
+ import { Button, Dialog, DialogActions, DialogContent, DialogHeader, DialogTitle, } from '@openpeepshq/react-ui';
6
+ import { useOpenpeeps, useSetPageHeader, useT } from '../../index.js';
7
+ import { useCurrentProfile } from '../../components/index.js';
8
+ const formatBytes = (size) => {
9
+ if (size < 1024)
10
+ return `${size} B`;
11
+ if (size < 1024 * 1024)
12
+ return `${(size / 1024).toFixed(1)} KB`;
13
+ if (size < 1024 * 1024 * 1024) {
14
+ return `${(size / (1024 * 1024)).toFixed(1)} MB`;
15
+ }
16
+ return `${(size / (1024 * 1024 * 1024)).toFixed(1)} GB`;
17
+ };
18
+ const formatWhen = (iso) => iso ? new Date(iso).toLocaleString() : '';
19
+ export const AdminMedia = () => {
20
+ const t = useT();
21
+ const { openpeepsApi } = useOpenpeeps();
22
+ const me = useCurrentProfile();
23
+ const canDeleteMedia = checkRoleCapabilities(me?.roles ?? [], [
24
+ 'core-media-delete',
25
+ ]).success;
26
+ const mediaQuery = openpeepsApi.admin.useMediaList();
27
+ const deleteMedia = openpeepsApi.admin.deleteMediaAction();
28
+ const [filter, setFilter] = useState('all');
29
+ const [query, setQuery] = useState('');
30
+ const [pending, setPending] = useState(null);
31
+ const [deleting, setDeleting] = useState(false);
32
+ const [deleteError, setDeleteError] = useState(null);
33
+ const files = mediaQuery.data?.files ?? [];
34
+ const graceDays = Math.round((mediaQuery.data?.graceMs ?? 0) / 86_400_000);
35
+ const needle = query.trim().toLowerCase();
36
+ const visible = useMemo(() => files.filter((file) => {
37
+ if (filter === 'unused' && file.status === 'referenced')
38
+ return false;
39
+ if (filter === 'referenced' && file.status !== 'referenced') {
40
+ return false;
41
+ }
42
+ return (needle.length === 0 || file.storageId.toLowerCase().includes(needle));
43
+ }), [files, filter, needle]);
44
+ const unusedCount = files.filter((file) => file.status !== 'referenced').length;
45
+ useSetPageHeader(t('admin.media.title', { defaultValue: 'Media' }));
46
+ const statusLabel = (status) => t(`admin.media.status.${status}`, {
47
+ defaultValue: status === 'referenced'
48
+ ? 'In use'
49
+ : status === 'due'
50
+ ? 'Ready to collect'
51
+ : 'Unused',
52
+ });
53
+ const collectionLabel = (file) => {
54
+ if (file.status === 'referenced') {
55
+ return t('admin.media.collects.referenced', {
56
+ defaultValue: 'Kept — still linked',
57
+ });
58
+ }
59
+ if (file.status === 'pending') {
60
+ return t('admin.media.collects.pending', {
61
+ defaultValue: 'Deletes {{date}}',
62
+ date: formatWhen(file.deletesAt),
63
+ });
64
+ }
65
+ if (file.status === 'due') {
66
+ return t('admin.media.collects.due', {
67
+ defaultValue: 'Deletes on the next run',
68
+ });
69
+ }
70
+ return t('admin.media.collects.unseen', {
71
+ defaultValue: 'Recorded on the next run',
72
+ });
73
+ };
74
+ const confirmDelete = async () => {
75
+ if (!pending)
76
+ return;
77
+ setDeleting(true);
78
+ setDeleteError(null);
79
+ try {
80
+ await deleteMedia({ storageId: pending.storageId });
81
+ setPending(null);
82
+ void mediaQuery.refetch();
83
+ }
84
+ catch (error) {
85
+ setDeleteError(error.message);
86
+ }
87
+ finally {
88
+ setDeleting(false);
89
+ }
90
+ };
91
+ const filters = [
92
+ { id: 'all', label: t('admin.media.filter.all', { defaultValue: 'All' }) },
93
+ {
94
+ id: 'unused',
95
+ label: t('admin.media.filter.unused', { defaultValue: 'Unused' }),
96
+ },
97
+ {
98
+ id: 'referenced',
99
+ label: t('admin.media.filter.inUse', { defaultValue: 'In use' }),
100
+ },
101
+ ];
102
+ return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsx("div", { className: "rounded-md border p-4 text-sm", children: t('admin.media.description', {
103
+ defaultValue: 'Removing a post or jam recording leaves the file on the server, because another post, the welcome page, the about page, the code of conduct, a profile, or a custom field may still link to it. Garbage collection deletes a file {{days}} days after it first has no live link. Delete now removes a file immediately.',
104
+ days: graceDays || 7,
105
+ }) }), _jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.media.counts', {
106
+ defaultValue: '{{total}} files · {{unused}} unused · {{inUse}} in use',
107
+ total: files.length,
108
+ unused: unusedCount,
109
+ inUse: files.length - unusedCount,
110
+ }) }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [filters.map((item) => (_jsx(Button, { title: item.label, variant: filter === item.id ? 'default' : 'outline', action: () => setFilter(item.id), children: item.label }, item.id))), _jsx("input", { value: query, onChange: (event) => setQuery(event.target.value), placeholder: t('admin.media.search', {
111
+ defaultValue: 'Search by file id',
112
+ }), className: "border-border bg-background min-w-48 flex-1 rounded-md border px-3 py-2 text-sm" })] }), mediaQuery.isLoading ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.media.loading', { defaultValue: 'Loading…' }) })) : null, mediaQuery.isError ? (_jsx("p", { className: "text-error text-sm", children: t('admin.media.error', {
113
+ defaultValue: 'Could not load media files',
114
+ }) })) : null, !mediaQuery.isLoading && !mediaQuery.isError && visible.length === 0 ? (_jsxs("div", { className: "text-muted-foreground flex flex-col items-center pt-16", children: [_jsx(Images, { size: 48 }), _jsx("p", { className: "mt-2 text-sm", children: t('admin.media.empty', { defaultValue: 'No media files' }) })] })) : null, visible.length > 0 ? (_jsx("ul", { className: "space-y-2", children: visible.map((file) => (_jsx("li", { className: "rounded-md border p-3", children: _jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "break-all font-mono text-xs", children: file.storageId }), _jsxs("p", { className: "text-muted-foreground mt-1 text-sm", children: [formatBytes(file.size), " \u00B7 ", formatWhen(file.modifiedAt)] }), _jsxs("p", { className: "mt-1 text-sm", children: [_jsx("span", { className: "font-medium", children: statusLabel(file.status) }), _jsxs("span", { className: "text-muted-foreground", children: [' ', "\u00B7 ", collectionLabel(file)] })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("a", { href: file.url, target: "_blank", rel: "noreferrer", className: "text-primary text-sm", children: t('admin.media.open', { defaultValue: 'Open' }) }), canDeleteMedia ? (_jsx(Button, { title: t('admin.media.delete', {
115
+ defaultValue: 'Delete now',
116
+ }), variant: "outline", action: () => {
117
+ setDeleteError(null);
118
+ setPending(file);
119
+ }, children: t('admin.media.delete', { defaultValue: 'Delete now' }) })) : null] })] }) }, file.storageId))) })) : null, pending ? (_jsx(Dialog, { open: true, onOpenChange: (open) => {
120
+ if (!open && !deleting)
121
+ setPending(null);
122
+ }, children: _jsxs(DialogContent, { className: "max-w-md", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('admin.media.confirm.title', {
123
+ defaultValue: 'Delete this file?',
124
+ }) }) }), _jsx("p", { className: "px-1 text-sm", children: pending.status === 'referenced'
125
+ ? t('admin.media.confirm.referenced', {
126
+ defaultValue: 'This file is still linked from a post, page, or profile. Deleting it now removes it from the server, and those links will stop working.',
127
+ })
128
+ : t('admin.media.confirm.unused', {
129
+ defaultValue: 'This file is unused. Deleting it now removes it from the server instead of waiting for garbage collection.',
130
+ }) }), deleteError ? (_jsx("p", { className: "border-error/40 text-error rounded-md border p-2 text-sm", children: deleteError })) : null, _jsx(DialogActions, { cancelLabel: t('admin.media.confirm.cancel', {
131
+ defaultValue: 'Cancel',
132
+ }), onCancel: () => setPending(null), actionLabel: t('admin.media.confirm.action', {
133
+ defaultValue: 'Delete file',
134
+ }), onAction: confirmDelete, disabled: deleting })] }) })) : null] }));
135
+ };
@@ -0,0 +1 @@
1
+ export declare function AdminConfigurationCommunityForbiddenUsernames(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,106 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { Lock, X } from 'lucide-react';
4
+ import { classifyAdditionalForbiddenHandle, collectAdditionalForbiddenHandles, forbiddenHandles, normalizeForbiddenHandle, } from '@openpeepshq/common/types';
5
+ import { useT, useSetPageHeader, useOpenpeeps } from '../../../index.js';
6
+ import { Button, Input, Toast } from '@openpeepshq/react-ui';
7
+ const sameHandles = (left, right) => left.length === right.length &&
8
+ left.every((handle, i) => handle === right[i]);
9
+ export function AdminConfigurationCommunityForbiddenUsernames() {
10
+ const t = useT();
11
+ const { openpeepsApi } = useOpenpeeps();
12
+ const configQuery = openpeepsApi.admin.useConfigRead('openpeeps', 'community');
13
+ const updateConfig = openpeepsApi.admin.updateConfigAction({
14
+ namespace: 'openpeeps',
15
+ name: 'community',
16
+ });
17
+ const [custom, setCustom] = useState([]);
18
+ const [draft, setDraft] = useState('');
19
+ const [fieldError, setFieldError] = useState(null);
20
+ const [saving, setSaving] = useState(false);
21
+ const [status, setStatus] = useState(null);
22
+ useSetPageHeader(t('configuration.community.forbiddenUsernames.title', {
23
+ defaultValue: 'Forbidden usernames',
24
+ }));
25
+ const base = configQuery.data?.config;
26
+ const saved = collectAdditionalForbiddenHandles(base?.settings?.additionalForbiddenHandles ?? []).handles;
27
+ const savedKey = saved.join('\n');
28
+ useEffect(() => {
29
+ setCustom(savedKey ? savedKey.split('\n') : []);
30
+ }, [savedKey]);
31
+ const issueMessage = (issue) => {
32
+ if (issue === 'empty') {
33
+ return t('configuration.community.forbiddenUsernames.empty', {
34
+ defaultValue: 'Enter a username to add.',
35
+ });
36
+ }
37
+ if (issue === 'invalid') {
38
+ return t('configuration.community.forbiddenUsernames.invalid', {
39
+ defaultValue: 'Usernames must be 1–16 characters: letters, numbers, underscores, or hyphens.',
40
+ });
41
+ }
42
+ if (issue === 'builtIn') {
43
+ return t('configuration.community.forbiddenUsernames.builtInError', {
44
+ defaultValue: 'Built-in usernames are always reserved and cannot be changed.',
45
+ });
46
+ }
47
+ return t('configuration.community.forbiddenUsernames.duplicate', {
48
+ defaultValue: 'That username is already on the list.',
49
+ });
50
+ };
51
+ const addUsername = () => {
52
+ const issue = classifyAdditionalForbiddenHandle(draft, custom);
53
+ if (issue) {
54
+ setFieldError(issueMessage(issue));
55
+ return;
56
+ }
57
+ setCustom((prev) => [...prev, normalizeForbiddenHandle(draft)]);
58
+ setDraft('');
59
+ setFieldError(null);
60
+ };
61
+ const save = async () => {
62
+ setStatus(null);
63
+ setSaving(true);
64
+ try {
65
+ await updateConfig({
66
+ config: { settings: { additionalForbiddenHandles: custom } },
67
+ });
68
+ setStatus({
69
+ type: 'success',
70
+ message: t('configuration.community.updateSuccess', {
71
+ defaultValue: 'Community settings updated',
72
+ }),
73
+ });
74
+ }
75
+ catch (err) {
76
+ setStatus({ type: 'error', message: err.message });
77
+ }
78
+ finally {
79
+ setSaving(false);
80
+ }
81
+ };
82
+ if (configQuery.isLoading) {
83
+ return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: t('common.form.loading', { defaultValue: 'Loading…' }) }));
84
+ }
85
+ return (_jsxs("div", { className: "flex flex-col gap-4 p-4", "data-testid": "admin-forbidden-usernames", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: t('configuration.community.forbiddenUsernames.description', {
86
+ defaultValue: 'Block usernames your community does not allow, such as slurs or hate speech. Each entry is a full username, ignoring capitalization. Built-in usernames stay reserved and cannot be removed.',
87
+ }) }), _jsxs("ul", { className: "border-border divide-border divide-y border", children: [forbiddenHandles.map((handle) => (_jsxs("li", { className: "flex items-center justify-between gap-3 px-3 py-2", "data-testid": `admin-forbidden-username-${handle}`, children: [_jsx("span", { children: handle }), _jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-xs", children: [_jsx(Lock, { className: "size-3", "aria-hidden": "true" }), t('configuration.community.forbiddenUsernames.builtIn', {
88
+ defaultValue: 'Built-in',
89
+ })] })] }, handle))), custom.map((handle) => (_jsxs("li", { className: "flex items-center justify-between gap-3 px-3 py-2", "data-testid": `admin-forbidden-username-${handle}`, children: [_jsx("span", { children: handle }), _jsxs(Button, { variant: "ghost", title: t('configuration.community.forbiddenUsernames.remove', {
90
+ defaultValue: 'Remove',
91
+ }), action: () => setCustom((prev) => prev.filter((item) => item !== handle)), "data-testid": `admin-forbidden-username-remove-${handle}`, children: [_jsx(X, { className: "size-4", "aria-hidden": "true" }), t('configuration.community.forbiddenUsernames.remove', {
92
+ defaultValue: 'Remove',
93
+ })] })] }, handle)))] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Input, { value: draft, placeholder: t('configuration.community.forbiddenUsernames.placeholder', { defaultValue: 'username' }), "aria-invalid": Boolean(fieldError), onChange: (event) => {
94
+ setDraft(event.target.value);
95
+ setFieldError(null);
96
+ }, onKeyDown: (event) => {
97
+ if (event.key !== 'Enter')
98
+ return;
99
+ event.preventDefault();
100
+ addUsername();
101
+ }, "data-testid": "admin-forbidden-usernames-input" }), _jsx(Button, { variant: "outline", title: t('configuration.community.forbiddenUsernames.add', {
102
+ defaultValue: 'Add username',
103
+ }), action: addUsername, "data-testid": "admin-forbidden-usernames-add", children: t('configuration.community.forbiddenUsernames.add', {
104
+ defaultValue: 'Add username',
105
+ }) })] }), fieldError ? (_jsx("p", { className: "text-error text-sm", role: "alert", children: fieldError })) : null] }), status ? (_jsx(Toast, { variant: status.type, onDismiss: () => setStatus(null), children: status.message })) : null, _jsx(Button, { variant: "default", action: save, disabled: saving || sameHandles(custom, saved), "data-testid": "admin-forbidden-usernames-save", children: t('common.form.save', { defaultValue: 'Save' }) })] }));
106
+ }
@@ -9,7 +9,7 @@ import { roleKeyFromName } from '../../../lib/capabilityMatrix.js';
9
9
  const TAB_DEFAULT_ROLE = 'default-role';
10
10
  const TAB_ROLES = 'roles';
11
11
  const TAB_RELATIONS = 'relations';
12
- const TAB_LIST = [TAB_DEFAULT_ROLE, TAB_ROLES, TAB_RELATIONS];
12
+ const _TAB_LIST = [TAB_DEFAULT_ROLE, TAB_ROLES, TAB_RELATIONS];
13
13
  function DefaultRoles({ base }) {
14
14
  const t = useT();
15
15
  const { openpeepsApi } = useOpenpeeps();
@@ -63,6 +63,7 @@ export declare function useCommunityConfig(): {
63
63
  defaultTimeZone?: string | undefined;
64
64
  defaultFeedFormat?: "threaded" | "linear" | undefined;
65
65
  indexProfiles?: boolean | undefined;
66
+ additionalForbiddenHandles?: string[] | undefined;
66
67
  };
67
68
  roles: {
68
69
  onRegistration: {
@@ -140,6 +141,7 @@ export declare function useCommunityConfig(): {
140
141
  defaultTimeZone?: string | undefined;
141
142
  defaultFeedFormat?: "threaded" | "linear" | undefined;
142
143
  indexProfiles?: boolean | undefined;
144
+ additionalForbiddenHandles?: string[] | undefined;
143
145
  };
144
146
  roles: {
145
147
  onRegistration: {
@@ -0,0 +1,5 @@
1
+ import type { InviteLinkWithMeta } from '@openpeepshq/common/types';
2
+ export declare const EditInviteLinkModal: ({ invite, onClose, }: {
3
+ invite: InviteLinkWithMeta;
4
+ onClose: () => void;
5
+ }) => import("react/jsx-runtime").JSX.Element;