@openpeepshq/react 0.7.0 → 0.8.0
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/configuration/ConfigurationCategory.js +3 -2
- package/dist/components/configuration/ConfigurationList.js +1 -1
- package/dist/components/form/LocationInput.js +1 -1
- package/dist/components/jams/JamCapacityGate.js +1 -1
- package/dist/components/jams/JamConference.js +2 -0
- package/dist/components/jams/JamParticipantConference.js +2 -0
- package/dist/components/jams/JamRoom.js +2 -3
- package/dist/components/jams/LiveJamsSection.js +8 -2
- package/dist/components/jams/LivekitUnavailableNotice.d.ts +9 -0
- package/dist/components/jams/LivekitUnavailableNotice.js +19 -0
- package/dist/components/jams/dropLateAudio.d.ts +22 -0
- package/dist/components/jams/dropLateAudio.js +115 -0
- package/dist/components/jams/index.d.ts +1 -0
- package/dist/components/jams/index.js +1 -0
- package/dist/components/markdown/compileMarkdown.js +1 -0
- package/dist/components/navigation/FooterMobile.js +4 -3
- package/dist/components/navigation/HeaderMobile.js +5 -2
- package/dist/components/navigation/MobileMenuItem.d.ts +3 -1
- package/dist/components/navigation/MobileMenuItem.js +7 -2
- package/dist/components/navigation/NavWithTooltip.d.ts +9 -0
- package/dist/components/navigation/NavWithTooltip.js +4 -0
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/index.js +1 -0
- package/dist/components/navigation/sideBarNavLinkClass.d.ts +6 -4
- package/dist/components/navigation/sideBarNavLinkClass.js +6 -2
- package/dist/components/notifications/TypedNotification.js +46 -4
- package/dist/components/post/CompactReplyParent.js +5 -6
- package/dist/components/post/Markdown.d.ts +2 -2
- package/dist/components/post/Markdown.js +1 -1
- package/dist/components/post/TruncatedMarkdown.d.ts +27 -0
- package/dist/components/post/TruncatedMarkdown.js +37 -0
- package/dist/components/post/attachmentPreview.js +1 -1
- package/dist/components/post/helpers.d.ts +2 -2
- package/dist/components/post/helpers.js +3 -16
- package/dist/components/post/index.d.ts +2 -0
- package/dist/components/post/index.js +1 -0
- package/dist/components/post/pieces/Attachments.js +23 -17
- package/dist/components/post/pieces/EventLocation.js +14 -0
- package/dist/components/post/pieces/EventRsvpButton.js +39 -7
- package/dist/components/post/pieces/EventRsvpList.js +23 -3
- package/dist/components/post/pieces/EventRsvpScopeDialog.d.ts +1 -1
- package/dist/components/post/pieces/EventRsvpScopeDialog.js +34 -22
- package/dist/components/post/pieces/EventWaitlistJoinDialog.d.ts +10 -0
- package/dist/components/post/pieces/EventWaitlistJoinDialog.js +26 -0
- package/dist/components/post/pieces/ParticipantsCard.d.ts +1 -1
- package/dist/components/post/pieces/ParticipantsCard.js +1 -1
- package/dist/components/post/pieces/PollContent.js +8 -2
- package/dist/components/post/pieces/PostActions.d.ts +1 -1
- package/dist/components/post/pieces/PostActions.js +20 -12
- package/dist/components/post/pieces/ShareMenu.d.ts +6 -1
- package/dist/components/post/pieces/ShareMenu.js +40 -7
- package/dist/components/post/post-form/ArticleForm.js +1 -1
- package/dist/components/post/post-form/EventForm.js +33 -5
- package/dist/components/post/post-form/ResourceForm.d.ts +3 -1
- package/dist/components/post/post-form/ResourceForm.js +48 -7
- package/dist/components/post/post-form/VisibilitySelector.js +9 -3
- package/dist/components/post/types/Article.js +2 -3
- package/dist/components/post/types/Event.js +10 -1
- package/dist/components/post/types/article/FullArticle.js +1 -1
- package/dist/components/post/types/event/CardEvent.js +2 -1
- package/dist/components/post/types/event/FullEvent.js +22 -13
- package/dist/components/post/types/event/ProfileEventRelationship.js +8 -0
- package/dist/components/post/types/resource/FullResource.js +3 -3
- package/dist/components/preview-link/LocalPreviewLink.js +4 -2
- package/dist/components/preview-link/PreviewLink.js +1 -1
- package/dist/components/preview-link/helpers.d.ts +5 -0
- package/dist/components/preview-link/helpers.js +27 -1
- package/dist/components/preview-link/local/WelcomePreview.d.ts +1 -0
- package/dist/components/preview-link/local/WelcomePreview.js +8 -0
- package/dist/components/profile/Avatar.js +2 -2
- package/dist/components/profile/ProfileFromId.js +1 -1
- package/dist/components/resources/ResourceCard.d.ts +5 -1
- package/dist/components/resources/ResourceCard.js +29 -5
- package/dist/components/resources/ResourceCard.test.d.ts +1 -0
- package/dist/components/resources/ResourceCard.test.js +75 -0
- package/dist/components/resources/ResourceLibrary.js +1 -1
- package/dist/components/server-data/context.d.ts +1 -0
- package/dist/contexts/openpeeps/hooks/accounts.d.ts +5 -5
- package/dist/contexts/openpeeps/hooks/accounts.js +1 -3
- package/dist/contexts/openpeeps/hooks/admin.d.ts +165 -66
- package/dist/contexts/openpeeps/hooks/admin.js +11 -3
- package/dist/contexts/openpeeps/hooks/auth.d.ts +2 -2
- package/dist/contexts/openpeeps/hooks/groups.d.ts +8 -8
- package/dist/contexts/openpeeps/hooks/jams.d.ts +73 -24
- package/dist/contexts/openpeeps/hooks/other.d.ts +7 -6
- package/dist/contexts/openpeeps/hooks/payments.d.ts +2 -2
- package/dist/contexts/openpeeps/hooks/posts.d.ts +368 -170
- package/dist/contexts/openpeeps/hooks/streaming.d.ts +1 -1
- package/dist/hooks/admin/useCanAccessAdminSection.d.ts +13 -0
- package/dist/hooks/admin/useCanAccessAdminSection.js +21 -0
- package/dist/hooks/events/useEventComposer.d.ts +94 -41
- package/dist/hooks/events/useEventForm.d.ts +1 -0
- package/dist/hooks/events/useEventRsvp.d.ts +12 -2
- package/dist/hooks/events/useEventRsvp.js +59 -10
- package/dist/hooks/events/useEventsCalendar.d.ts +174 -76
- package/dist/hooks/groups/useNewGroup.js +22 -2
- package/dist/hooks/index.d.ts +5 -1
- package/dist/hooks/index.js +4 -1
- package/dist/hooks/jams/useCanDiagnoseLivekit.d.ts +2 -0
- package/dist/hooks/jams/useCanDiagnoseLivekit.js +3 -0
- package/dist/hooks/jams/useCreateNewJamForm.d.ts +3 -1
- package/dist/hooks/jams/useJamDetails.d.ts +87 -38
- package/dist/hooks/jams/useJamLobby.d.ts +1 -0
- package/dist/hooks/jams/useJamRoom.d.ts +175 -76
- package/dist/hooks/posts/useArticleComposer.d.ts +93 -41
- package/dist/hooks/posts/useFeedPostPresentation.d.ts +174 -76
- package/dist/hooks/posts/usePostDetailTitle.d.ts +87 -38
- package/dist/hooks/posts/useResourceComposer.d.ts +95 -41
- package/dist/hooks/posts/useResourceComposer.js +135 -27
- package/dist/hooks/posts/useShareMenu.d.ts +2 -0
- package/dist/hooks/posts/useShareMenu.js +7 -0
- package/dist/hooks/resources/useResourceLibrary.d.ts +177 -79
- package/dist/hooks/resources/useResourceLibrary.js +6 -2
- package/dist/hooks/settings/useNotificationPreferences.d.ts +1 -1
- package/dist/hooks/useWelcomePreview.d.ts +16 -0
- package/dist/hooks/useWelcomePreview.js +40 -0
- package/dist/lib/groupFormErrors.d.ts +1 -0
- package/dist/lib/groupFormErrors.js +5 -2
- package/dist/lib/threadHelpers.js +1 -5
- package/dist/navigation/menuItems.js +15 -0
- package/dist/navigation/targets.d.ts +2 -0
- package/dist/pages/admin/ConfigurationCommunity.js +1 -1
- package/dist/pages/admin/Diagnostics.js +1 -1
- package/dist/pages/admin/DiagnosticsLivekit.d.ts +1 -0
- package/dist/pages/admin/DiagnosticsLivekit.js +50 -0
- package/dist/pages/admin/Invites.js +5 -3
- package/dist/pages/admin/Media.d.ts +1 -0
- package/dist/pages/admin/Media.js +135 -0
- package/dist/pages/admin/community/CommunityForbiddenUsernames.d.ts +1 -0
- package/dist/pages/admin/community/CommunityForbiddenUsernames.js +106 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.js +2 -1
- package/dist/pages/admin/community/CommunityRoles.js +1 -1
- package/dist/pages/admin/community/useCommunityConfig.d.ts +2 -0
- package/dist/pages/admin/components/EditInviteLinkModal.d.ts +5 -0
- package/dist/pages/admin/components/EditInviteLinkModal.js +131 -0
- package/dist/pages/auth/Register.js +33 -9
- package/dist/pages/conversations/Show.js +11 -0
- package/dist/pages/index.d.ts +3 -0
- package/dist/pages/index.js +3 -0
- package/dist/pages/jams/Index.js +2 -4
- package/dist/pages/resources/Edit.js +3 -3
- package/dist/pages/resources/New.js +2 -2
- package/dist/pages/settings/Account.js +30 -2
- package/dist/pages/settings/PublicProfile.js +15 -3
- package/dist/pwa/sw.d.ts +0 -1
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js +1 -0
- package/dist/stores/newPosts.d.ts +4 -2
- package/dist/stores/newPosts.js +6 -1
- package/package.json +12 -7
- package/src/components/configuration/ConfigurationCategory.tsx +23 -10
- package/src/components/configuration/ConfigurationList.tsx +6 -1
- package/src/components/form/LocationInput.tsx +7 -1
- package/src/components/jams/JamCapacityGate.tsx +1 -1
- package/src/components/jams/JamConference.tsx +2 -0
- package/src/components/jams/JamParticipantConference.tsx +2 -0
- package/src/components/jams/JamRoom.tsx +2 -6
- package/src/components/jams/LiveJamsSection.tsx +16 -2
- package/src/components/jams/LivekitUnavailableNotice.tsx +40 -0
- package/src/components/jams/dropLateAudio.ts +153 -0
- package/src/components/jams/index.ts +1 -0
- package/src/components/markdown/compileMarkdown.ts +1 -0
- package/src/components/navigation/FooterMobile.tsx +41 -33
- package/src/components/navigation/HeaderMobile.tsx +55 -41
- package/src/components/navigation/MobileMenuItem.tsx +15 -2
- package/src/components/navigation/NavWithTooltip.tsx +26 -0
- package/src/components/navigation/index.ts +2 -0
- package/src/components/navigation/sideBarNavLinkClass.ts +9 -6
- package/src/components/notifications/TypedNotification.tsx +81 -9
- package/src/components/post/CompactReplyParent.tsx +17 -10
- package/src/components/post/Markdown.tsx +8 -2
- package/src/components/post/TruncatedMarkdown.tsx +91 -0
- package/src/components/post/attachmentPreview.ts +1 -3
- package/src/components/post/helpers.ts +4 -18
- package/src/components/post/index.ts +2 -0
- package/src/components/post/pieces/Attachments.tsx +93 -78
- package/src/components/post/pieces/EventLocation.tsx +27 -0
- package/src/components/post/pieces/EventRsvpButton.tsx +110 -7
- package/src/components/post/pieces/EventRsvpList.tsx +64 -0
- package/src/components/post/pieces/EventRsvpScopeDialog.tsx +39 -27
- package/src/components/post/pieces/EventWaitlistJoinDialog.tsx +77 -0
- package/src/components/post/pieces/ParticipantsCard.tsx +4 -1
- package/src/components/post/pieces/PollContent.tsx +8 -2
- package/src/components/post/pieces/PostActions.tsx +73 -42
- package/src/components/post/pieces/ShareMenu.tsx +67 -9
- package/src/components/post/post-form/ArticleForm.tsx +1 -1
- package/src/components/post/post-form/EventForm.tsx +69 -15
- package/src/components/post/post-form/ResourceForm.tsx +132 -4
- package/src/components/post/post-form/VisibilitySelector.tsx +12 -5
- package/src/components/post/types/Article.tsx +6 -6
- package/src/components/post/types/Event.tsx +68 -7
- package/src/components/post/types/article/FullArticle.tsx +2 -2
- package/src/components/post/types/event/CardEvent.tsx +26 -14
- package/src/components/post/types/event/FullEvent.tsx +48 -35
- package/src/components/post/types/event/ProfileEventRelationship.tsx +8 -0
- package/src/components/post/types/note/FullNote.tsx +1 -4
- package/src/components/post/types/poll/FullPoll.tsx +1 -4
- package/src/components/post/types/resource/FullResource.tsx +9 -1
- package/src/components/preview-link/LocalPreviewLink.tsx +4 -1
- package/src/components/preview-link/PreviewLink.tsx +2 -7
- package/src/components/preview-link/helpers.ts +32 -1
- package/src/components/preview-link/local/GroupPreview.tsx +1 -1
- package/src/components/preview-link/local/JamPreview.tsx +1 -1
- package/src/components/preview-link/local/WelcomePreview.tsx +45 -0
- package/src/components/profile/Avatar.tsx +6 -2
- package/src/components/profile/ProfileFromId.tsx +1 -5
- package/src/components/resources/ResourceCard.tsx +68 -11
- package/src/components/resources/ResourceLibrary.tsx +2 -2
- package/src/contexts/openpeeps/hooks/accounts.ts +1 -3
- package/src/contexts/openpeeps/hooks/admin.ts +11 -3
- package/src/contexts/openpeeps/hooks/other.ts +9 -12
- package/src/contexts/openpeeps/hooks/streaming.ts +3 -3
- package/src/css.d.ts +4 -0
- package/src/hooks/admin/useCanAccessAdminSection.ts +27 -0
- package/src/hooks/events/useEventRsvp.ts +69 -13
- package/src/hooks/groups/useNewGroup.ts +28 -3
- package/src/hooks/index.ts +8 -1
- package/src/hooks/jams/useCanDiagnoseLivekit.ts +5 -0
- package/src/hooks/posts/useResourceComposer.ts +165 -39
- package/src/hooks/posts/useShareMenu.ts +9 -0
- package/src/hooks/resources/useResourceLibrary.ts +6 -2
- package/src/hooks/useWelcomePreview.ts +61 -0
- package/src/i18n/I18nProvider.tsx +1 -4
- package/src/lib/groupFormErrors.ts +9 -2
- package/src/lib/threadHelpers.ts +1 -5
- package/src/navigation/menuItems.ts +16 -0
- package/src/navigation/targets.ts +2 -0
- package/src/pages/admin/ConfigurationCommunity.tsx +5 -0
- package/src/pages/admin/Diagnostics.tsx +4 -0
- package/src/pages/admin/DiagnosticsLivekit.tsx +147 -0
- package/src/pages/admin/Invites.tsx +23 -1
- package/src/pages/admin/Media.tsx +290 -0
- package/src/pages/admin/community/CommunityForbiddenUsernames.tsx +223 -0
- package/src/pages/admin/community/CommunityMarkdownPage.tsx +5 -1
- package/src/pages/admin/community/CommunityRoles.tsx +2 -2
- package/src/pages/admin/components/EditInviteLinkModal.tsx +263 -0
- package/src/pages/auth/Register.tsx +45 -4
- package/src/pages/conversations/Show.tsx +11 -0
- package/src/pages/index.ts +3 -0
- package/src/pages/jams/Index.tsx +2 -6
- package/src/pages/resources/Edit.tsx +3 -2
- package/src/pages/resources/New.tsx +6 -1
- package/src/pages/settings/Account.tsx +51 -1
- package/src/pages/settings/PublicProfile.tsx +20 -2
- package/src/pwa/sw.ts +6 -3
- package/src/pwa/useNotificationBadgeSync.ts +3 -1
- package/src/react-native.ts +1 -0
- package/src/stores/newPosts.ts +6 -1
- package/src/streaming.ts +3 -3
- package/dist/setupTests.d.ts +0 -1
- package/dist/setupTests.js +0 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { useT, useSetPageHeader } from '../../../index.js';
|
|
4
|
+
import { Markdown } from '../../../lib/Markdown.js';
|
|
4
5
|
import { OpenpeepsMarkdownInput } from '../../../components/index.js';
|
|
5
6
|
import { Button, Toast, deepGet, deepSet } from '@openpeepshq/react-ui';
|
|
6
7
|
import { useCommunityConfig } from './useCommunityConfig.js';
|
|
@@ -31,5 +32,5 @@ export function CommunityMarkdownPage({ path, titleKey, descriptionKey, }) {
|
|
|
31
32
|
if (isLoading || !draft) {
|
|
32
33
|
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: t('common.form.loading', { defaultValue: 'Loading…' }) }));
|
|
33
34
|
}
|
|
34
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 p-4", children: [_jsx(
|
|
35
|
+
return (_jsxs("div", { className: "flex flex-col gap-4 p-4", children: [_jsx(Markdown, { source: t(descriptionKey), className: "pb-2 pt-4 text-sm text-muted-foreground" }), _jsx(OpenpeepsMarkdownInput, { value: value, maxLength: 10000, rows: 18, className: "min-h-[30rem]", onChange: setContent }), _jsx(Button, { variant: "default", action: handleSubmit, title: t('configuration.community.save'), children: t('configuration.community.save') }), status ? (_jsx(Toast, { variant: status.type, onDismiss: () => setStatus(null), children: status.message })) : null] }));
|
|
35
36
|
}
|
|
@@ -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
|
|
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,131 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useOpenpeeps, useT } from '../../../index.js';
|
|
4
|
+
import { Dialog, DialogActions, DialogContent, DialogHeader, DialogTitle, Input, Label, } from '@openpeepshq/react-ui';
|
|
5
|
+
import { DAY_MS, EXPIRY_OPTIONS, UNLIMITED_USES } from './InviteWithLinkModal.js';
|
|
6
|
+
const NEVER_DAYS = EXPIRY_OPTIONS.find((option) => option.value === 'P100Y')?.days ?? 365 * 100;
|
|
7
|
+
const FAR_FUTURE_MS = 50 * 365 * DAY_MS;
|
|
8
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
9
|
+
const toDatetimeLocal = (iso) => {
|
|
10
|
+
const date = new Date(iso);
|
|
11
|
+
if (Number.isNaN(date.getTime()))
|
|
12
|
+
return '';
|
|
13
|
+
const day = [
|
|
14
|
+
date.getFullYear(),
|
|
15
|
+
pad(date.getMonth() + 1),
|
|
16
|
+
pad(date.getDate()),
|
|
17
|
+
].join('-');
|
|
18
|
+
const time = [pad(date.getHours()), pad(date.getMinutes())].join(':');
|
|
19
|
+
return `${day}T${time}`;
|
|
20
|
+
};
|
|
21
|
+
const isFarFuture = (iso) => new Date(iso).getTime() - Date.now() > FAR_FUTURE_MS;
|
|
22
|
+
const useChoices = (invite) => {
|
|
23
|
+
const floor = Math.max(invite.redemptions.length, 1);
|
|
24
|
+
const current = invite.maxUses < UNLIMITED_USES ? [invite.maxUses] : [];
|
|
25
|
+
return [...new Set([1, 5, 10, 15, 20, ...current])]
|
|
26
|
+
.filter((count) => count >= floor)
|
|
27
|
+
.sort((a, b) => a - b);
|
|
28
|
+
};
|
|
29
|
+
const initialUses = (invite) => {
|
|
30
|
+
if (invite.maxUses >= UNLIMITED_USES ||
|
|
31
|
+
invite.maxUses < invite.redemptions.length) {
|
|
32
|
+
return 'unlimited';
|
|
33
|
+
}
|
|
34
|
+
return String(invite.maxUses);
|
|
35
|
+
};
|
|
36
|
+
const errorMessage = (err, fallback) => {
|
|
37
|
+
if (err &&
|
|
38
|
+
typeof err === 'object' &&
|
|
39
|
+
'message' in err &&
|
|
40
|
+
typeof err.message === 'string' &&
|
|
41
|
+
err.message) {
|
|
42
|
+
return err.message;
|
|
43
|
+
}
|
|
44
|
+
return fallback;
|
|
45
|
+
};
|
|
46
|
+
export const EditInviteLinkModal = ({ invite, onClose, }) => {
|
|
47
|
+
const t = useT();
|
|
48
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
49
|
+
const updateInvite = openpeepsApi.admin.updateInviteAction({
|
|
50
|
+
id: invite.id,
|
|
51
|
+
});
|
|
52
|
+
const used = invite.redemptions.length;
|
|
53
|
+
const choices = useChoices(invite);
|
|
54
|
+
const startsNever = isFarFuture(invite.expiresAt);
|
|
55
|
+
const [maxUses, setMaxUses] = useState(() => initialUses(invite));
|
|
56
|
+
const [never, setNever] = useState(startsNever);
|
|
57
|
+
const [expiresLocal, setExpiresLocal] = useState(() => toDatetimeLocal(startsNever
|
|
58
|
+
? new Date(Date.now() + 7 * DAY_MS).toISOString()
|
|
59
|
+
: invite.expiresAt));
|
|
60
|
+
const [submitting, setSubmitting] = useState(false);
|
|
61
|
+
const [error, setError] = useState(null);
|
|
62
|
+
const parsedExpiry = new Date(expiresLocal);
|
|
63
|
+
const expiresInPast = !never &&
|
|
64
|
+
expiresLocal !== '' &&
|
|
65
|
+
!Number.isNaN(parsedExpiry.getTime()) &&
|
|
66
|
+
parsedExpiry.getTime() <= Date.now();
|
|
67
|
+
const submit = async () => {
|
|
68
|
+
setError(null);
|
|
69
|
+
const unlimited = maxUses === 'unlimited';
|
|
70
|
+
const nextMaxUses = unlimited ? UNLIMITED_USES : Number(maxUses);
|
|
71
|
+
if (!unlimited && (!Number.isInteger(nextMaxUses) || nextMaxUses < used)) {
|
|
72
|
+
setError(t('admin.invites.maxUsesTooLow', {
|
|
73
|
+
defaultValue: 'Number of uses cannot be lower than {{count}}, the number of accounts that already joined.',
|
|
74
|
+
count: used,
|
|
75
|
+
}));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const patch = {};
|
|
79
|
+
if (nextMaxUses !== invite.maxUses)
|
|
80
|
+
patch.maxUses = nextMaxUses;
|
|
81
|
+
if (never) {
|
|
82
|
+
if (!startsNever) {
|
|
83
|
+
patch.expiresAt = new Date(Date.now() + NEVER_DAYS * DAY_MS).toISOString();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (toDatetimeLocal(invite.expiresAt) !== expiresLocal) {
|
|
87
|
+
if (!expiresLocal || Number.isNaN(parsedExpiry.getTime())) {
|
|
88
|
+
setError(t('admin.invites.expiresRequired', {
|
|
89
|
+
defaultValue: 'Choose an expiration date.',
|
|
90
|
+
}));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
patch.expiresAt = parsedExpiry.toISOString();
|
|
94
|
+
}
|
|
95
|
+
if (patch.maxUses == null && patch.expiresAt == null) {
|
|
96
|
+
onClose();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
setSubmitting(true);
|
|
100
|
+
try {
|
|
101
|
+
await updateInvite(patch);
|
|
102
|
+
onClose();
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
setError(errorMessage(err, t('admin.invites.updateError', {
|
|
106
|
+
defaultValue: 'Failed to update invite link',
|
|
107
|
+
})));
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
setSubmitting(false);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(DialogContent, { className: "max-w-md", "data-testid": "edit-invite-link", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t('admin.invites.editTitle', {
|
|
114
|
+
defaultValue: 'Edit invite link',
|
|
115
|
+
}) }) }), _jsxs("div", { className: "space-y-4 px-1", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: t('admin.invites.editDescription', {
|
|
116
|
+
defaultValue: 'Update how many times this link can be used, or when it expires.',
|
|
117
|
+
}) }), _jsx("p", { className: "font-mono text-xs", children: invite.slug }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "edit-invite-uses", children: t('admin.inviteLink.numberOfUses', {
|
|
118
|
+
defaultValue: 'Number of Uses',
|
|
119
|
+
}) }), _jsxs("select", { id: "edit-invite-uses", className: "border-input bg-background w-full rounded-md border p-2 text-sm", value: maxUses, onChange: (e) => setMaxUses(e.target.value), children: [choices.map((count) => (_jsx("option", { value: String(count), children: count }, count))), _jsx("option", { value: "unlimited", children: t('admin.inviteLink.unlimited', {
|
|
120
|
+
defaultValue: 'Unlimited',
|
|
121
|
+
}) })] }), used > 0 ? (_jsx("p", { className: "text-muted-foreground text-xs", children: t('admin.invites.alreadyJoined', {
|
|
122
|
+
defaultValue: 'Already joined: {{count}}',
|
|
123
|
+
count: used,
|
|
124
|
+
}) })) : null] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "edit-invite-expiry", children: t('admin.invites.expirationDate', {
|
|
125
|
+
defaultValue: 'Expiration date',
|
|
126
|
+
}) }), _jsx(Input, { id: "edit-invite-expiry", type: "datetime-local", value: expiresLocal, disabled: never, onChange: (e) => setExpiresLocal(e.target.value) }), _jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx("input", { type: "checkbox", className: "size-4", checked: never, onChange: (e) => setNever(e.target.checked) }), _jsx("span", { children: t('admin.invites.neverExpires', {
|
|
127
|
+
defaultValue: 'Never expires',
|
|
128
|
+
}) })] }), expiresInPast ? (_jsx("p", { className: "text-muted-foreground text-xs", children: t('admin.invites.pastExpiration', {
|
|
129
|
+
defaultValue: 'This date is in the past, so the link will be inactive.',
|
|
130
|
+
}) })) : null] }), error ? (_jsx("p", { className: "border-error/40 text-error rounded-md border p-2 text-sm", children: error })) : null] }), _jsx(DialogActions, { cancelLabel: t('common.cancel', { defaultValue: 'Cancel' }), onCancel: onClose, actionLabel: t('common.save', { defaultValue: 'Save' }), onAction: submit, disabled: submitting })] }) }));
|
|
131
|
+
};
|
|
@@ -4,7 +4,7 @@ import { Link as RouterLink, useNavigate, useSearchParams, } from 'react-router-
|
|
|
4
4
|
import { Eye, EyeOff } from 'lucide-react';
|
|
5
5
|
import { useForm } from 'react-hook-form';
|
|
6
6
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
7
|
-
import { registerRequestSchema, } from '@openpeepshq/common/types';
|
|
7
|
+
import { accountNameSchema, HANDLE_RESERVED_MESSAGE, isForbiddenHandle, registerRequestSchema, } from '@openpeepshq/common/types';
|
|
8
8
|
import { Button, Form, FormControl, FormField, FormItem, FormLabel, FormMessage, Input, Link, Toast, } from '@openpeepshq/react-ui';
|
|
9
9
|
import { useT, useOpenpeeps } from '../../index.js';
|
|
10
10
|
import { AuthLayout, useServerInfo, useToast } from '../../components/index.js';
|
|
@@ -15,7 +15,7 @@ const INVITE_INACTIVE_MESSAGES = new Set([
|
|
|
15
15
|
'Max Uses Reached',
|
|
16
16
|
'Invalid Invite Code',
|
|
17
17
|
]);
|
|
18
|
-
const buildRegisterFormSchema = (t) => registerRequestSchema
|
|
18
|
+
const buildRegisterFormSchema = (t, additionalForbiddenHandles = []) => registerRequestSchema
|
|
19
19
|
.refine((d) => d.password === d.confirmPassword, {
|
|
20
20
|
message: t('auth.register.passwordsDoNotMatch', {
|
|
21
21
|
defaultValue: 'Passwords do not match',
|
|
@@ -27,12 +27,33 @@ const buildRegisterFormSchema = (t) => registerRequestSchema
|
|
|
27
27
|
defaultValue: 'You must agree to the privacy policy',
|
|
28
28
|
}),
|
|
29
29
|
path: ['privacyPolicyAccepted'],
|
|
30
|
+
})
|
|
31
|
+
.superRefine((data, ctx) => {
|
|
32
|
+
if (!isForbiddenHandle(data.handle, additionalForbiddenHandles))
|
|
33
|
+
return;
|
|
34
|
+
// Built-in names already fail accountNameSchema.
|
|
35
|
+
if (!accountNameSchema.safeParse(data.handle).success)
|
|
36
|
+
return;
|
|
37
|
+
ctx.addIssue({
|
|
38
|
+
code: 'custom',
|
|
39
|
+
path: ['handle'],
|
|
40
|
+
message: t('profile.form.handleReserved', {
|
|
41
|
+
defaultValue: 'That handle is reserved. Please choose another.',
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
30
44
|
});
|
|
31
|
-
const registerErrorCopy = (raw, t) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
const registerErrorCopy = (raw, t) => {
|
|
46
|
+
if (raw === HANDLE_RESERVED_MESSAGE) {
|
|
47
|
+
return t('profile.form.handleReserved', {
|
|
48
|
+
defaultValue: 'That handle is reserved. Please choose another.',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return INVITE_INACTIVE_MESSAGES.has(raw)
|
|
52
|
+
? t('auth.register.inviteInactive', {
|
|
53
|
+
defaultValue: 'This invite link is expired or no longer active.',
|
|
54
|
+
})
|
|
55
|
+
: t(raw);
|
|
56
|
+
};
|
|
36
57
|
export function Register({ invite = false }) {
|
|
37
58
|
const t = useT();
|
|
38
59
|
const navigate = useNavigate();
|
|
@@ -42,7 +63,8 @@ export function Register({ invite = false }) {
|
|
|
42
63
|
const { register } = useRegisterAccount();
|
|
43
64
|
const serverInfo = useServerInfo();
|
|
44
65
|
const { success, error: toastError } = useToast();
|
|
45
|
-
const
|
|
66
|
+
const additionalForbiddenHandles = serverInfo.communityConfig?.settings?.additionalForbiddenHandles;
|
|
67
|
+
const registerFormSchema = useMemo(() => buildRegisterFormSchema(t, additionalForbiddenHandles ?? []), [t, additionalForbiddenHandles]);
|
|
46
68
|
const paymentParam = searchParams.get('payment');
|
|
47
69
|
useEffect(() => {
|
|
48
70
|
if (paymentParam === 'success') {
|
|
@@ -125,7 +147,9 @@ export function Register({ invite = false }) {
|
|
|
125
147
|
defaultValue: 'Show password',
|
|
126
148
|
}) })] })] }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "confirmPassword", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: t('auth.register.confirmPassword', {
|
|
127
149
|
defaultValue: 'Confirm Password',
|
|
128
|
-
}) }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "password", "data-testid": "auth-register-confirm-password" }) }), _jsx(FormMessage, { "data-testid": "auth-register-confirm-password-error" })] })) }),
|
|
150
|
+
}) }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: "password", "data-testid": "auth-register-confirm-password" }) }), _jsx(FormMessage, { "data-testid": "auth-register-confirm-password-error" })] })) }), password && password.length > 0 && (_jsx("p", { "data-testid": "auth-register-password-rules", className: "text-xs text-muted-foreground", children: t('auth.register.passwordRules', {
|
|
151
|
+
defaultValue: '8+ characters, with an uppercase letter, lowercase letter, number, and symbol',
|
|
152
|
+
}) })), (password ?? '').length > 0 &&
|
|
129
153
|
(confirmPassword ?? '').length === 0 && (_jsx("div", { className: "bg-surface border-border flex w-full justify-center rounded py-2", children: _jsx("p", { children: getStrengthMessage(calculatePasswordStrength(password)) }) })), _jsx(FormField, { control: form.control, name: "privacyPolicyAccepted", render: ({ field }) => (_jsxs(FormItem, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FormControl, { children: _jsx(Input, { type: "checkbox", checked: field.value, onChange: (e) => field.onChange(e.target.checked), "data-testid": "auth-register-privacy-checkbox" }) }), _jsxs("p", { children: [t('auth.register.privacyPolicyAgreement', {
|
|
130
154
|
defaultValue: 'I have read and agree to the',
|
|
131
155
|
}), ' ', _jsx("a", { href: privacyPolicyLink, target: "_blank", rel: "noopener noreferrer", className: "anchor text-sm", children: t('auth.register.privacyPolicy', {
|
|
@@ -85,6 +85,17 @@ export function ConversationShow() {
|
|
|
85
85
|
void flushPostViews();
|
|
86
86
|
};
|
|
87
87
|
}, [id, client, queryClient, flushPostViews]);
|
|
88
|
+
// The URL may point at any root of a merged 1:1 conversation (e.g.
|
|
89
|
+
// notification links); unseen counts are merged under the pair's oldest
|
|
90
|
+
// root, so clear that key once the conversation's first message is known.
|
|
91
|
+
const firstMessageId = messages[0]?.id;
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (!id || !firstMessageId || firstMessageId === id)
|
|
94
|
+
return;
|
|
95
|
+
adjustUnseenCounts(queryClient, client, {
|
|
96
|
+
clearConversation: firstMessageId,
|
|
97
|
+
});
|
|
98
|
+
}, [id, firstMessageId, client, queryClient]);
|
|
88
99
|
useEffect(() => {
|
|
89
100
|
if (!id || !me || conversationQuery.isLoading)
|
|
90
101
|
return;
|
package/dist/pages/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export { AnalyticsGroupsPage } from './admin/Analytics';
|
|
|
56
56
|
export { AnalyticsPluginPage } from './admin/Analytics';
|
|
57
57
|
export { AnalyticsReportSettingsPage } from './admin/Analytics';
|
|
58
58
|
export { AdminBackups } from './admin/Backups';
|
|
59
|
+
export { AdminMedia } from './admin/Media';
|
|
59
60
|
export { AdminGroups } from './admin/Groups';
|
|
60
61
|
export { AdminInvites } from './admin/Invites';
|
|
61
62
|
export { AdminMembers } from './admin/Members';
|
|
@@ -81,6 +82,7 @@ export { CommunityMarkdownPage } from './admin/community/CommunityMarkdownPage';
|
|
|
81
82
|
export { AdminConfigurationCommunityFavicons } from './admin/community/CommunityFavicons';
|
|
82
83
|
export { AdminConfigurationCommunityTheme } from './admin/community/CommunityTheme';
|
|
83
84
|
export { AdminConfigurationCommunityProfileFields } from './admin/community/CommunityProfileFields';
|
|
85
|
+
export { AdminConfigurationCommunityForbiddenUsernames } from './admin/community/CommunityForbiddenUsernames';
|
|
84
86
|
export { AdminConfigurationCommunityRoles } from './admin/community/CommunityRoles';
|
|
85
87
|
export { AdminGroupMembers } from './admin/GroupMembers';
|
|
86
88
|
export { AdminReports } from './admin/Reports';
|
|
@@ -88,6 +90,7 @@ export { AdminApiKeys } from './admin/ApiKeys';
|
|
|
88
90
|
export { AdminPlugins } from './admin/Plugins';
|
|
89
91
|
export { AdminDiagnostics } from './admin/Diagnostics';
|
|
90
92
|
export { AdminDiagnosticsEmail } from './admin/DiagnosticsEmail';
|
|
93
|
+
export { AdminDiagnosticsLivekit } from './admin/DiagnosticsLivekit';
|
|
91
94
|
export { AdminDiagnosticsLogs } from './admin/DiagnosticsLogs';
|
|
92
95
|
export { AdminConfigurationEmail } from './admin/ConfigurationEmail';
|
|
93
96
|
export { AdminConfigurationSso } from './admin/ConfigurationSso';
|
package/dist/pages/index.js
CHANGED
|
@@ -56,6 +56,7 @@ export { AnalyticsGroupsPage } from './admin/Analytics.js';
|
|
|
56
56
|
export { AnalyticsPluginPage } from './admin/Analytics.js';
|
|
57
57
|
export { AnalyticsReportSettingsPage } from './admin/Analytics.js';
|
|
58
58
|
export { AdminBackups } from './admin/Backups.js';
|
|
59
|
+
export { AdminMedia } from './admin/Media.js';
|
|
59
60
|
export { AdminGroups } from './admin/Groups.js';
|
|
60
61
|
export { AdminInvites } from './admin/Invites.js';
|
|
61
62
|
export { AdminMembers } from './admin/Members.js';
|
|
@@ -81,6 +82,7 @@ export { CommunityMarkdownPage } from './admin/community/CommunityMarkdownPage.j
|
|
|
81
82
|
export { AdminConfigurationCommunityFavicons } from './admin/community/CommunityFavicons.js';
|
|
82
83
|
export { AdminConfigurationCommunityTheme } from './admin/community/CommunityTheme.js';
|
|
83
84
|
export { AdminConfigurationCommunityProfileFields } from './admin/community/CommunityProfileFields.js';
|
|
85
|
+
export { AdminConfigurationCommunityForbiddenUsernames } from './admin/community/CommunityForbiddenUsernames.js';
|
|
84
86
|
export { AdminConfigurationCommunityRoles } from './admin/community/CommunityRoles.js';
|
|
85
87
|
export { AdminGroupMembers } from './admin/GroupMembers.js';
|
|
86
88
|
export { AdminReports } from './admin/Reports.js';
|
|
@@ -88,6 +90,7 @@ export { AdminApiKeys } from './admin/ApiKeys.js';
|
|
|
88
90
|
export { AdminPlugins } from './admin/Plugins.js';
|
|
89
91
|
export { AdminDiagnostics } from './admin/Diagnostics.js';
|
|
90
92
|
export { AdminDiagnosticsEmail } from './admin/DiagnosticsEmail.js';
|
|
93
|
+
export { AdminDiagnosticsLivekit } from './admin/DiagnosticsLivekit.js';
|
|
91
94
|
export { AdminDiagnosticsLogs } from './admin/DiagnosticsLogs.js';
|
|
92
95
|
export { AdminConfigurationEmail } from './admin/ConfigurationEmail.js';
|
|
93
96
|
export { AdminConfigurationSso } from './admin/ConfigurationSso.js';
|
package/dist/pages/jams/Index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useMemo, useState } from 'react';
|
|
|
3
3
|
import { Link } from 'react-router-dom';
|
|
4
4
|
import { ChevronRight, MoreHorizontal, PhoneCall } from 'lucide-react';
|
|
5
5
|
import { useT, useOpenpeeps, useSetPlusButtonActions, useSetPageHeader, } from '../../index.js';
|
|
6
|
-
import { EventsFeed, LiveJamsSection, useCreateNewJam, useServerInfo, } from '../../components/index.js';
|
|
6
|
+
import { EventsFeed, LiveJamsSection, LivekitUnavailableNotice, useCreateNewJam, useServerInfo, } from '../../components/index.js';
|
|
7
7
|
import { PopupMenu, PopupMenuButton } from '@openpeepshq/react-ui';
|
|
8
8
|
export function JamsIndex({ my = false }) {
|
|
9
9
|
const t = useT();
|
|
@@ -37,9 +37,7 @@ export function JamsIndex({ my = false }) {
|
|
|
37
37
|
? openpeepsApi.useMyPastJamsFeed()
|
|
38
38
|
: openpeepsApi.usePastJamsFeed();
|
|
39
39
|
const activeQuery = tab === 'upcoming' ? upcoming : past;
|
|
40
|
-
return (_jsxs("div", { className: "p-4", children: [!serverInfo.jams.livekit.enabled ? (_jsx("
|
|
41
|
-
defaultValue: 'Jams are unavailable because LiveKit is not connected.',
|
|
42
|
-
}) })) : null, !my && serverInfo.jams.livekit.enabled ? _jsx(LiveJamsSection, {}) : null, _jsxs("nav", { "aria-label": t('jams.feed.label', { defaultValue: 'Jam timeframe' }), className: "border-border mb-4 flex border-b", children: [_jsx(TabButton, { active: tab === 'upcoming', onClick: () => setTab('upcoming'), children: t('jams.feed.upcoming', { defaultValue: 'Upcoming' }) }), _jsx(TabButton, { active: tab === 'past', onClick: () => setTab('past'), children: t('jams.feed.past', { defaultValue: 'Past' }) })] }), _jsx(EventsFeed, { query: activeQuery })] }));
|
|
40
|
+
return (_jsxs("div", { className: "p-4", children: [!serverInfo.jams.livekit.enabled ? (_jsx(LivekitUnavailableNotice, { className: "text-destructive mb-4 text-sm" })) : null, !my && serverInfo.jams.livekit.enabled ? _jsx(LiveJamsSection, {}) : null, _jsxs("nav", { "aria-label": t('jams.feed.label', { defaultValue: 'Jam timeframe' }), className: "border-border mb-4 flex border-b", children: [_jsx(TabButton, { active: tab === 'upcoming', onClick: () => setTab('upcoming'), children: t('jams.feed.upcoming', { defaultValue: 'Upcoming' }) }), _jsx(TabButton, { active: tab === 'past', onClick: () => setTab('past'), children: t('jams.feed.past', { defaultValue: 'Past' }) })] }), _jsx(EventsFeed, { query: activeQuery })] }));
|
|
43
41
|
}
|
|
44
42
|
function TabButton({ active, onClick, children, }) {
|
|
45
43
|
return (_jsx("button", { type: "button", onClick: onClick, className: `px-4 py-2 text-sm ${active ? 'border-primary border-b-2 font-semibold' : 'text-muted-foreground hover:text-foreground'}`, children: children }));
|
|
@@ -9,10 +9,10 @@ import { Button, LoadingSpinner, Toast } from '@openpeepshq/react-ui';
|
|
|
9
9
|
export const EditResource = () => {
|
|
10
10
|
const t = useT();
|
|
11
11
|
const { resourceId = '' } = useParams();
|
|
12
|
-
const { postQuery, postData, setPostData, resourceTitle, submitting, error, clearError, submit, } = useEditResource(resourceId);
|
|
13
|
-
const headerActions = useMemo(() => (_jsx(Button, { title: t('resources.update.title', { defaultValue: 'Update resource' }), variant: "default", action: submit, disabled: submitting, children: submitting
|
|
12
|
+
const { postQuery, postData, setPostData, resourceTitle, canSubmit, submitting, error, clearError, submit, } = useEditResource(resourceId);
|
|
13
|
+
const headerActions = useMemo(() => (_jsx(Button, { title: t('resources.update.title', { defaultValue: 'Update resource' }), variant: "default", action: submit, disabled: submitting || !canSubmit, children: submitting
|
|
14
14
|
? t('common.saving', { defaultValue: 'Saving…' })
|
|
15
|
-
: t('resources.update.title', { defaultValue: 'Update resource' }) })), [submit, submitting, t]);
|
|
15
|
+
: t('resources.update.title', { defaultValue: 'Update resource' }) })), [canSubmit, submit, submitting, t]);
|
|
16
16
|
useSetPageHeader(resourceTitle
|
|
17
17
|
? `${t('resources.edit', { defaultValue: 'Edit resource' })} ${truncateText(resourceTitle)}`
|
|
18
18
|
: t('resources.edit', { defaultValue: 'Edit resource' }), headerActions);
|
|
@@ -6,10 +6,10 @@ import { useNewResource } from '../../hooks/index.js';
|
|
|
6
6
|
import { Button, Toast } from '@openpeepshq/react-ui';
|
|
7
7
|
export const NewResource = () => {
|
|
8
8
|
const t = useT();
|
|
9
|
-
const { postData, setPostData, canSubmit, submitting, error, clearError, submit, } = useNewResource();
|
|
9
|
+
const { postData, setPostData, canSubmit, groupOnly, submitting, error, clearError, submit, } = useNewResource();
|
|
10
10
|
const headerActions = useMemo(() => (_jsx(Button, { title: t('resources.create.title', { defaultValue: 'Create resource' }), variant: "default", action: submit, disabled: submitting || !canSubmit, "data-testid": "resources-submit", children: submitting
|
|
11
11
|
? t('common.submitting', { defaultValue: 'Publishing…' })
|
|
12
12
|
: t('resources.create.title', { defaultValue: 'Create resource' }) })), [canSubmit, submit, submitting, t]);
|
|
13
13
|
useSetPageHeader(t('resources.new', { defaultValue: 'New resource' }), headerActions);
|
|
14
|
-
return (_jsxs("div", { className: "pb-12", children: [_jsx(ResourceForm, { postData: postData, onChange: setPostData }), error ? (_jsx("div", { className: "px-3", children: _jsx(Toast, { variant: "error", onDismiss: clearError, children: error }) })) : null] }));
|
|
14
|
+
return (_jsxs("div", { className: "pb-12", children: [_jsx(ResourceForm, { postData: postData, onChange: setPostData, groupOnly: groupOnly }), error ? (_jsx("div", { className: "px-3", children: _jsx(Toast, { variant: "error", onDismiss: clearError, children: error }) })) : null] }));
|
|
15
15
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
4
|
-
import { useCurrentAccount } from '../../components/index.js';
|
|
4
|
+
import { useCurrentAccount, useToast } from '../../components/index.js';
|
|
5
5
|
import { Button, Input, Label, Toast } from '@openpeepshq/react-ui';
|
|
6
6
|
export function AccountSettings() {
|
|
7
7
|
const t = useT();
|
|
8
8
|
const { openpeepsApi, client } = useOpenpeeps();
|
|
9
|
+
const { success, error: toastError } = useToast();
|
|
9
10
|
const account = useCurrentAccount();
|
|
10
11
|
const updateAccount = openpeepsApi.updateCurrentAccountAction();
|
|
11
12
|
useSetPageHeader(t('settings.account.title', { defaultValue: 'Account' }));
|
|
@@ -60,6 +61,25 @@ export function AccountSettings() {
|
|
|
60
61
|
setSubmitting(false);
|
|
61
62
|
}
|
|
62
63
|
};
|
|
64
|
+
const validateEmail = openpeepsApi.validationEmailAction();
|
|
65
|
+
const [verifying, setVerifying] = useState(false);
|
|
66
|
+
const handleVerifyEmail = async () => {
|
|
67
|
+
setVerifying(true);
|
|
68
|
+
try {
|
|
69
|
+
await validateEmail();
|
|
70
|
+
success(t('settings.account.verifyEmailSent', {
|
|
71
|
+
defaultValue: 'Verification email sent',
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
toastError(t('settings.account.verifyEmailError', {
|
|
76
|
+
defaultValue: 'Failed to send verification email',
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
setVerifying(false);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
63
83
|
const exportAccount = async () => {
|
|
64
84
|
setExporting(true);
|
|
65
85
|
try {
|
|
@@ -98,7 +118,15 @@ export function AccountSettings() {
|
|
|
98
118
|
defaultValue: 'Required to change your email or password.',
|
|
99
119
|
}) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "email", children: t('settings.account.email', { defaultValue: 'Email' }) }), _jsx(Input, { id: "email", type: "email", value: email, placeholder: t('settings.account.emailPlaceholder', {
|
|
100
120
|
defaultValue: 'Enter your email',
|
|
101
|
-
}), onChange: (e) => setEmail(e.target.value), "data-testid": "settings-email-input" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(
|
|
121
|
+
}), onChange: (e) => setEmail(e.target.value), "data-testid": "settings-email-input" })] }), !account?.emailValidated ? (_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: t('settings.account.verifyEmailDescription', {
|
|
122
|
+
defaultValue: 'Your email is not verified. Resend a verification email.',
|
|
123
|
+
}) }), _jsx(Button, { title: t('settings.account.verifyEmailButton', {
|
|
124
|
+
defaultValue: 'Verify email',
|
|
125
|
+
}), variant: "outline", action: handleVerifyEmail, loading: verifying, "data-testid": "settings-verify-email-button", children: verifying
|
|
126
|
+
? t('common.submitting', { defaultValue: 'Sending...' })
|
|
127
|
+
: t('settings.account.verifyEmailButton', {
|
|
128
|
+
defaultValue: 'Verify email',
|
|
129
|
+
}) })] })) : null, _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "newPassword", children: t('settings.account.newPassword', {
|
|
102
130
|
defaultValue: 'New password',
|
|
103
131
|
}) }), _jsx(Input, { id: "newPassword", type: "password", autoComplete: "new-password", value: newPassword, placeholder: t('settings.account.newPasswordPlaceholder', {
|
|
104
132
|
defaultValue: 'Enter your new password',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { accountNameSchema, profileDataSchema, } from '@openpeepshq/common/types';
|
|
3
|
+
import { accountNameSchema, HANDLE_RESERVED_MESSAGE, isForbiddenHandle, profileDataSchema, } from '@openpeepshq/common/types';
|
|
4
4
|
import { useT, useOpenpeeps, useSetPageHeader } from '../../index.js';
|
|
5
5
|
import { HeaderAvatarInput, LocationInput, useCurrentProfile, useServerInfo, useToast, } from '../../components/index.js';
|
|
6
6
|
import { Button, Input, Label, Textarea } from '@openpeepshq/react-ui';
|
|
@@ -41,12 +41,18 @@ export function PublicProfileSettings() {
|
|
|
41
41
|
}, [me?.id, additionalFieldDefs]);
|
|
42
42
|
if (!me)
|
|
43
43
|
return null;
|
|
44
|
+
const additionalForbiddenHandles = serverInfo.communityConfig?.settings?.additionalForbiddenHandles;
|
|
44
45
|
const validateHandle = (value) => {
|
|
46
|
+
if (isForbiddenHandle(value, additionalForbiddenHandles)) {
|
|
47
|
+
return t('profile.form.handleReserved', {
|
|
48
|
+
defaultValue: 'That handle is reserved. Please choose another.',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
45
51
|
const result = accountNameSchema.safeParse(value);
|
|
46
52
|
if (result.success)
|
|
47
53
|
return null;
|
|
48
54
|
const message = firstZodMessage(result.error);
|
|
49
|
-
if (message ===
|
|
55
|
+
if (message === HANDLE_RESERVED_MESSAGE) {
|
|
50
56
|
return t('profile.form.handleReserved', {
|
|
51
57
|
defaultValue: 'That handle is reserved. Please choose another.',
|
|
52
58
|
});
|
|
@@ -88,7 +94,7 @@ export function PublicProfileSettings() {
|
|
|
88
94
|
if (err instanceof ZodError) {
|
|
89
95
|
const message = firstZodMessage(err);
|
|
90
96
|
if (message?.toLowerCase().includes('handle')) {
|
|
91
|
-
setHandleError(message ===
|
|
97
|
+
setHandleError(message === HANDLE_RESERVED_MESSAGE
|
|
92
98
|
? t('profile.form.handleReserved', {
|
|
93
99
|
defaultValue: 'That handle is reserved. Please choose another.',
|
|
94
100
|
})
|
|
@@ -98,6 +104,12 @@ export function PublicProfileSettings() {
|
|
|
98
104
|
return;
|
|
99
105
|
}
|
|
100
106
|
}
|
|
107
|
+
if (err.message === HANDLE_RESERVED_MESSAGE) {
|
|
108
|
+
setHandleError(t('profile.form.handleReserved', {
|
|
109
|
+
defaultValue: 'That handle is reserved. Please choose another.',
|
|
110
|
+
}));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
101
113
|
if (isDuplicateHandleError(err)) {
|
|
102
114
|
const msg = t('profiles.handleExists', {
|
|
103
115
|
defaultValue: 'This handle is already in use by someone else.',
|
package/dist/pwa/sw.d.ts
CHANGED
package/dist/react-native.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export type { JamEventsContextValue } from './components/jams/JamEventsContext';
|
|
|
52
52
|
export { mentionProfilesFromParticipants, parseJamEventPayload, parseParticipantMetadata, sendAttendance, sendJamEvent, sendReaction, toggleHand, } from './components/jams/jamEventActions';
|
|
53
53
|
export type { JamParticipantMetadata } from './components/jams/jamEventActions';
|
|
54
54
|
export { useRaisedHands } from './components/jams/useJamHands';
|
|
55
|
+
export { useDropLateAudio } from './components/jams/dropLateAudio';
|
|
55
56
|
export { calculateRecordingState, calculateRtmpStreamState, formatRecordingElapsed, useJamRecordingElapsed, useJamRecordingState, useJamRtmpStreamState, } from './components/jams/jamRecordingState';
|
|
56
57
|
export { shouldReconnectAfterDisconnect } from './components/jams/disconnectReason';
|
|
57
58
|
export { JAM_EMOJIS, defaultRoomOptions, emojis, } from './components/jams/constants';
|
package/dist/react-native.js
CHANGED
|
@@ -40,6 +40,7 @@ export { JamProvider, useJamContext, useJamObserver, } from './components/jams/J
|
|
|
40
40
|
export { JamEventsProvider, useJamEventsContext, useMaybeJamEventsContext, } from './components/jams/JamEventsContext.js';
|
|
41
41
|
export { mentionProfilesFromParticipants, parseJamEventPayload, parseParticipantMetadata, sendAttendance, sendJamEvent, sendReaction, toggleHand, } from './components/jams/jamEventActions.js';
|
|
42
42
|
export { useRaisedHands } from './components/jams/useJamHands.js';
|
|
43
|
+
export { useDropLateAudio } from './components/jams/dropLateAudio.js';
|
|
43
44
|
export { calculateRecordingState, calculateRtmpStreamState, formatRecordingElapsed, useJamRecordingElapsed, useJamRecordingState, useJamRtmpStreamState, } from './components/jams/jamRecordingState.js';
|
|
44
45
|
export { shouldReconnectAfterDisconnect } from './components/jams/disconnectReason.js';
|
|
45
46
|
export { JAM_EMOJIS, defaultRoomOptions, emojis, } from './components/jams/constants.js';
|
|
@@ -126,6 +126,7 @@ export declare const getReplyStore: (inReplyToId: string) => import("./createSto
|
|
|
126
126
|
image?: string | undefined;
|
|
127
127
|
end?: string | undefined;
|
|
128
128
|
maxAttendees?: number | undefined;
|
|
129
|
+
waitlistOfferMinutes?: number | undefined;
|
|
129
130
|
attendeeListPublic?: boolean | undefined;
|
|
130
131
|
moderators?: string[] | undefined;
|
|
131
132
|
jam?: {
|
|
@@ -208,7 +209,7 @@ export declare const getReplyStore: (inReplyToId: string) => import("./createSto
|
|
|
208
209
|
} | {
|
|
209
210
|
type: "resource";
|
|
210
211
|
title: string;
|
|
211
|
-
resourceKind: "
|
|
212
|
+
resourceKind: "file" | "link" | "video" | "gallery" | "audio";
|
|
212
213
|
content?: string | undefined;
|
|
213
214
|
sensitive?: boolean | undefined;
|
|
214
215
|
spoilerText?: string | undefined;
|
|
@@ -487,6 +488,7 @@ export declare const useReplyStore: (inReplyToId: string) => import("./createSto
|
|
|
487
488
|
image?: string | undefined;
|
|
488
489
|
end?: string | undefined;
|
|
489
490
|
maxAttendees?: number | undefined;
|
|
491
|
+
waitlistOfferMinutes?: number | undefined;
|
|
490
492
|
attendeeListPublic?: boolean | undefined;
|
|
491
493
|
moderators?: string[] | undefined;
|
|
492
494
|
jam?: {
|
|
@@ -569,7 +571,7 @@ export declare const useReplyStore: (inReplyToId: string) => import("./createSto
|
|
|
569
571
|
} | {
|
|
570
572
|
type: "resource";
|
|
571
573
|
title: string;
|
|
572
|
-
resourceKind: "
|
|
574
|
+
resourceKind: "file" | "link" | "video" | "gallery" | "audio";
|
|
573
575
|
content?: string | undefined;
|
|
574
576
|
sensitive?: boolean | undefined;
|
|
575
577
|
spoilerText?: string | undefined;
|
package/dist/stores/newPosts.js
CHANGED
|
@@ -79,7 +79,12 @@ export const eventSanitizer = (publicContent = false) => {
|
|
|
79
79
|
end: event.data.end,
|
|
80
80
|
attendeeListPublic: event.data.attendeeListPublic,
|
|
81
81
|
...(event.data.maxAttendees != null
|
|
82
|
-
? {
|
|
82
|
+
? {
|
|
83
|
+
maxAttendees: event.data.maxAttendees,
|
|
84
|
+
...(event.data.waitlistOfferMinutes != null
|
|
85
|
+
? { waitlistOfferMinutes: event.data.waitlistOfferMinutes }
|
|
86
|
+
: {}),
|
|
87
|
+
}
|
|
83
88
|
: {}),
|
|
84
89
|
},
|
|
85
90
|
mentions: event.mentions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"simple-icons": "^16.31.0",
|
|
53
53
|
"uuidv7": "^1.0.2",
|
|
54
54
|
"@openpeepshq/client": "^0.2.1",
|
|
55
|
-
"@openpeepshq/react-ui": "^0.4.1",
|
|
56
55
|
"@openpeepshq/common": "^0.4.0",
|
|
57
|
-
"@openpeepshq/greenscreen": "^0.2.1"
|
|
56
|
+
"@openpeepshq/greenscreen": "^0.2.1",
|
|
57
|
+
"@openpeepshq/react-ui": "^0.4.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": "^18.3.0 || ^19.0.0",
|
|
@@ -66,18 +66,23 @@
|
|
|
66
66
|
"@types/qrcode": "^1.5.6",
|
|
67
67
|
"@types/react": "19.2.14",
|
|
68
68
|
"@types/react-dom": "19.2.3",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^8.72.0",
|
|
70
|
+
"@typescript-eslint/parser": "^8.72.0",
|
|
69
71
|
"concurrently": "^9.1.2",
|
|
70
|
-
"eslint": "^
|
|
72
|
+
"eslint": "^10.1.0",
|
|
73
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
71
74
|
"jsdom": "^25.0.1",
|
|
72
75
|
"react-router-dom": "^7.0.0",
|
|
73
76
|
"tsc-alias": "^1.8.10",
|
|
74
|
-
"typescript": "^
|
|
77
|
+
"typescript": "^6.0.2",
|
|
75
78
|
"vitest": "^2.1.8",
|
|
79
|
+
"eslint-config-prettier": "^9.1.0",
|
|
80
|
+
"@eslint/js": "^9.17.0",
|
|
76
81
|
"@openpeepshq/fetch-client": "^0.2.1"
|
|
77
82
|
},
|
|
78
83
|
"scripts": {
|
|
79
|
-
"lint": "
|
|
80
|
-
"format": "prettier --write .",
|
|
84
|
+
"lint": "eslint .",
|
|
85
|
+
"format": "prettier --write --ignore-path ../../.prettierignore .",
|
|
81
86
|
"clean": "rm -rf tsconfig.tsbuildinfo dist",
|
|
82
87
|
"typecheck": "tsc --noEmit",
|
|
83
88
|
"build": "tsc && tsc-alias",
|