@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.
- 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/groups/GroupHeader.js +2 -1
- package/dist/components/groups/GroupNotificationSettingsModal.d.ts +9 -0
- package/dist/components/groups/GroupNotificationSettingsModal.js +57 -0
- package/dist/components/groups/GroupShareMenu.js +30 -8
- package/dist/components/groups/index.d.ts +2 -0
- package/dist/components/groups/index.js +1 -0
- 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/notifications/TypedNotification.js +46 -4
- package/dist/components/post/Markdown.d.ts +2 -2
- package/dist/components/post/Markdown.js +1 -1
- package/dist/components/post/attachmentPreview.js +1 -1
- package/dist/components/post/pieces/Attachments.js +23 -17
- package/dist/components/post/pieces/EventRsvpButton.js +37 -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/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/EventForm.js +10 -2
- package/dist/components/post/types/Article.js +1 -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 +21 -11
- package/dist/components/post/types/event/ProfileEventRelationship.js +8 -0
- 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 +6 -0
- package/dist/components/profile/Avatar.js +2 -2
- package/dist/components/profile/ProfileFromId.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 +11 -2
- package/dist/hooks/events/useEventRsvp.js +46 -5
- package/dist/hooks/events/useEventsCalendar.d.ts +174 -76
- package/dist/hooks/groups/useGroupNotificationLevel.d.ts +9 -0
- package/dist/hooks/groups/useGroupNotificationLevel.js +57 -0
- package/dist/hooks/groups/useNewGroup.js +22 -2
- package/dist/hooks/index.d.ts +6 -1
- package/dist/hooks/index.js +5 -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 +93 -41
- package/dist/hooks/posts/useResourceComposer.js +4 -2
- package/dist/hooks/posts/useShareMenu.d.ts +2 -0
- package/dist/hooks/posts/useShareMenu.js +7 -0
- package/dist/hooks/resources/useResourceLibrary.d.ts +176 -78
- package/dist/hooks/settings/useNotificationPreferences.d.ts +1 -1
- package/dist/hooks/useWelcomePreview.d.ts +13 -0
- package/dist/hooks/useWelcomePreview.js +39 -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/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/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/admin/configurationSsoShared.d.ts +4 -0
- package/dist/pages/auth/Register.js +30 -8
- package/dist/pages/conversations/Show.js +11 -0
- package/dist/pages/groups/Show.js +22 -19
- 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/settings/PublicProfile.js +15 -3
- package/dist/pwa/sw.d.ts +0 -1
- package/dist/react-native.d.ts +2 -1
- package/dist/react-native.js +2 -1
- package/dist/stores/newPosts.d.ts +4 -2
- package/dist/stores/newPosts.js +6 -1
- package/package.json +11 -6
- 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/groups/GroupHeader.tsx +2 -0
- package/src/components/groups/GroupNotificationSettingsModal.tsx +163 -0
- package/src/components/groups/GroupShareMenu.tsx +77 -12
- package/src/components/groups/index.ts +5 -0
- 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/notifications/TypedNotification.tsx +81 -9
- package/src/components/post/Markdown.tsx +8 -2
- package/src/components/post/attachmentPreview.ts +1 -3
- package/src/components/post/pieces/Attachments.tsx +93 -78
- package/src/components/post/pieces/EventRsvpButton.tsx +107 -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/PostActions.tsx +73 -42
- package/src/components/post/pieces/ShareMenu.tsx +67 -9
- package/src/components/post/post-form/EventForm.tsx +26 -0
- package/src/components/post/post-form/VisibilitySelector.tsx +1 -2
- package/src/components/post/types/Article.tsx +1 -1
- 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 +47 -29
- 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/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 +36 -0
- package/src/components/profile/Avatar.tsx +6 -2
- package/src/components/profile/ProfileFromId.tsx +1 -5
- package/src/components/resources/ResourceCard.tsx +0 -1
- 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 +51 -7
- package/src/hooks/groups/useGroupNotificationLevel.ts +57 -0
- package/src/hooks/groups/useNewGroup.ts +28 -3
- package/src/hooks/index.ts +9 -1
- package/src/hooks/jams/useCanDiagnoseLivekit.ts +5 -0
- package/src/hooks/posts/useResourceComposer.ts +8 -6
- package/src/hooks/posts/useShareMenu.ts +9 -0
- package/src/hooks/useWelcomePreview.ts +57 -0
- package/src/i18n/I18nProvider.tsx +1 -4
- package/src/lib/groupFormErrors.ts +9 -2
- package/src/lib/threadHelpers.ts +1 -5
- 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/CommunityRoles.tsx +2 -2
- package/src/pages/admin/components/EditInviteLinkModal.tsx +263 -0
- package/src/pages/auth/Register.tsx +33 -4
- package/src/pages/conversations/Show.tsx +11 -0
- package/src/pages/groups/Show.tsx +60 -53
- package/src/pages/index.ts +3 -0
- package/src/pages/jams/Index.tsx +2 -6
- 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 +2 -1
- 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
|
@@ -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') {
|
|
@@ -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;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { useNavigate, useParams } from 'react-router-dom';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Link, useLocation, useNavigate, useParams } from 'react-router-dom';
|
|
4
|
+
import { groupSectionFromHash } from '@openpeepshq/common/lib';
|
|
4
5
|
import { useT, useOpenpeeps } from '../../index.js';
|
|
5
6
|
import { EventsView, Feed, GroupFeed, GroupHeader, NewEventButton, NewResourceButton, PostMarkdown, useCurrentProfile, } from '../../components/index.js';
|
|
6
7
|
import { routeHandleParam } from '../../lib/routeHandles.js';
|
|
@@ -9,13 +10,25 @@ import { ResourceLibrary } from '../../components/resources/ResourceLibrary.js';
|
|
|
9
10
|
export function GroupShow() {
|
|
10
11
|
const t = useT();
|
|
11
12
|
const navigate = useNavigate();
|
|
13
|
+
const location = useLocation();
|
|
12
14
|
const { handle: handleParam = '' } = useParams();
|
|
13
15
|
const handle = routeHandleParam(handleParam);
|
|
14
16
|
const { openpeepsApi } = useOpenpeeps();
|
|
15
17
|
const groupQuery = openpeepsApi.useGroupByHandle(handle);
|
|
16
18
|
const group = groupQuery.data;
|
|
17
19
|
const currentProfile = useCurrentProfile();
|
|
18
|
-
const
|
|
20
|
+
const tab = groupSectionFromHash(location.hash);
|
|
21
|
+
// Raw anchors (shared links, markdown) change the hash without going
|
|
22
|
+
// through the router. Mirror that into the location so the tab follows.
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const syncHash = () => {
|
|
25
|
+
if (window.location.hash === location.hash)
|
|
26
|
+
return;
|
|
27
|
+
navigate({ pathname: location.pathname, hash: window.location.hash }, { replace: true });
|
|
28
|
+
};
|
|
29
|
+
window.addEventListener('hashchange', syncHash);
|
|
30
|
+
return () => window.removeEventListener('hashchange', syncHash);
|
|
31
|
+
}, [location.hash, location.pathname, navigate]);
|
|
19
32
|
const upcomingEvents = openpeepsApi.useGroupUpcomingEventsFeed(group?.id ?? '');
|
|
20
33
|
const pastEvents = openpeepsApi.useGroupPastEventsFeed(group?.id ?? '');
|
|
21
34
|
const [eventsTab, setEventsTab] = useState('upcoming');
|
|
@@ -47,22 +60,12 @@ export function GroupShow() {
|
|
|
47
60
|
}
|
|
48
61
|
return (_jsxs("div", { children: [_jsx(GroupHeader, { group: group }), _jsxs("nav", { "aria-label": t('groups.sections.label', {
|
|
49
62
|
defaultValue: 'Group sections',
|
|
50
|
-
}), className: "border-border flex border-b", "data-testid": "tab-group", children: [_jsx(
|
|
51
|
-
setTab('posts');
|
|
52
|
-
window.history.replaceState(null, '', window.location.pathname);
|
|
53
|
-
}, children: t('groups.sections.posts', { defaultValue: 'Posts' }) }), _jsx(TabButton, { active: tab === 'events', onClick: () => {
|
|
54
|
-
setTab('events');
|
|
55
|
-
window.history.replaceState(null, '', `${window.location.pathname}#events`);
|
|
56
|
-
}, testId: "groups-tab-events", children: t('groups.sections.events', { defaultValue: 'Events' }) }), _jsx(TabButton, { active: tab === 'resources', onClick: () => {
|
|
57
|
-
setTab('resources');
|
|
58
|
-
window.history.replaceState(null, '', `${window.location.pathname}#resources`);
|
|
59
|
-
}, testId: "groups-tab-resources", children: t('groups.sections.resources', { defaultValue: 'Resources' }) }), _jsx(TabButton, { active: tab === 'description', onClick: () => {
|
|
60
|
-
setTab('description');
|
|
61
|
-
window.history.replaceState(null, '', `${window.location.pathname}#description`);
|
|
62
|
-
}, testId: "groups-tab-description", children: t('groups.sections.description', { defaultValue: 'Description' }) })] }), tab === 'posts' && _jsx(GroupFeed, { group: group }), tab === 'events' && (_jsxs("div", { children: [_jsx(NewEventButton, { visibility: "group", currentProfile: currentProfile, group: group, onNavigate: () => navigate('/events/new') }), _jsxs("nav", { "aria-label": t('groups.eventsTabs.label', {
|
|
63
|
+
}), className: "border-border flex border-b", "data-testid": "tab-group", children: [_jsx(TabLink, { active: tab === 'posts', hash: "", children: t('groups.sections.posts', { defaultValue: 'Posts' }) }), _jsx(TabLink, { active: tab === 'events', hash: "#events", testId: "groups-tab-events", children: t('groups.sections.events', { defaultValue: 'Events' }) }), _jsx(TabLink, { active: tab === 'resources', hash: "#resources", testId: "groups-tab-resources", children: t('groups.sections.resources', { defaultValue: 'Resources' }) }), _jsx(TabLink, { active: tab === 'description', hash: "#description", testId: "groups-tab-description", children: t('groups.sections.description', { defaultValue: 'Description' }) })] }), tab === 'posts' && _jsx(GroupFeed, { group: group }), tab === 'events' && (_jsxs("div", { children: [_jsx(NewEventButton, { visibility: "group", currentProfile: currentProfile, group: group, onNavigate: () => navigate('/events/new') }), _jsxs("nav", { "aria-label": t('groups.eventsTabs.label', {
|
|
63
64
|
defaultValue: 'Event timeframe',
|
|
64
65
|
}), className: "border-border flex border-b", children: [_jsx(TabButton, { active: eventsTab === 'upcoming', onClick: () => setEventsTab('upcoming'), children: t('events.feed.upcoming', { defaultValue: 'Upcoming' }) }), _jsx(TabButton, { active: eventsTab === 'past', onClick: () => setEventsTab('past'), children: t('events.feed.past', { defaultValue: 'Past' }) })] }), _jsx(EventsView, { query: eventsTab === 'upcoming' ? upcomingEvents : pastEvents, agenda: eventsTab, list: _jsx(Feed, { query: eventsTab === 'upcoming' ? upcomingEvents : pastEvents, formatSwitch: false }) })] })), tab === 'resources' && (_jsxs("div", { children: [_jsx(NewResourceButton, { visibility: "group", currentProfile: currentProfile, group: group }), _jsx(ResourceLibrary, { groupId: group.id })] })), tab === 'description' && (_jsxs("div", { className: "space-y-2 p-4", children: [_jsxs("section", { className: "border-b py-2", children: [_jsx("h3", { className: "text-lg font-semibold", children: "Description" }), _jsx(PostMarkdown, { source: group.description || 'No description yet' })] }), _jsxs("section", { className: "space-y-2 border-b py-2", children: [_jsx("h3", { className: "text-lg font-semibold", children: "Details" }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: "Created" }), _jsx("p", { children: new Date(group.createdAt).toLocaleDateString() })] }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t('groups.visibility.title') }), _jsx("p", { children: t(`groups.visibility.${visibilityValue}.description`) })] }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t('groups.whoCanJoin.title') }), _jsx("p", { children: t(`groups.whoCanJoin.${whoCanJoinValue}.description`) })] }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t('groups.whoCanPost.title') }), _jsxs("p", { children: [t(`groups.whoCanPost.${whoCanPostValue}.description`), ".", ' ', t(`groups.whoCanPostEvents.${whoCanPostEventsValue}.description`)] })] }), _jsxs("div", { children: [_jsx("h4", { className: "font-semibold", children: t('groups.postsVisibility.title') }), _jsx("p", { children: t(`groups.postsVisibility.${postsVisibilityValue}.description`) })] })] }), _jsxs("section", { className: "border-b py-2", children: [_jsx("h3", { className: "text-lg font-semibold", children: "Rules" }), _jsx(PostMarkdown, { source: group.rules || 'No rules yet' })] })] }))] }));
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
67
|
+
const TabLink = ({ active, hash, children, testId, }) => {
|
|
68
|
+
const location = useLocation();
|
|
69
|
+
return (_jsx(Link, { replace: true, to: { pathname: location.pathname, hash }, "data-testid": testId, "aria-current": active ? 'page' : undefined, className: `px-4 py-2 text-sm no-underline ${active ? 'border-primary border-b-2 font-semibold' : 'text-muted-foreground hover:text-foreground'}`, children: children }));
|
|
70
|
+
};
|
|
71
|
+
const TabButton = ({ active, onClick, children, }) => (_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 }));
|
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 }));
|
|
@@ -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
|
@@ -11,7 +11,7 @@ export * from './lib/unseenCountsOptimistic';
|
|
|
11
11
|
export * from './lib/postUnread';
|
|
12
12
|
export * from './lib/notificationBadge';
|
|
13
13
|
export { getInitials, hueFromHandle, initialsBackground, } from './lib/initialsAvatar';
|
|
14
|
-
export { svgCoverSrc } from './lib/svgCover';
|
|
14
|
+
export { isSvgUrl, svgCoverSrc } from './lib/svgCover';
|
|
15
15
|
export * from './lib/capabilityMatrix';
|
|
16
16
|
export * from './lib/groupFormErrors';
|
|
17
17
|
export * from './lib/passwordStrength';
|
|
@@ -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
|
@@ -11,7 +11,7 @@ export * from './lib/unseenCountsOptimistic.js';
|
|
|
11
11
|
export * from './lib/postUnread.js';
|
|
12
12
|
export * from './lib/notificationBadge.js';
|
|
13
13
|
export { getInitials, hueFromHandle, initialsBackground, } from './lib/initialsAvatar.js';
|
|
14
|
-
export { svgCoverSrc } from './lib/svgCover.js';
|
|
14
|
+
export { isSvgUrl, svgCoverSrc } from './lib/svgCover.js';
|
|
15
15
|
export * from './lib/capabilityMatrix.js';
|
|
16
16
|
export * from './lib/groupFormErrors.js';
|
|
17
17
|
export * from './lib/passwordStrength.js';
|
|
@@ -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.7.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"uuidv7": "^1.0.2",
|
|
54
54
|
"@openpeepshq/client": "^0.2.1",
|
|
55
55
|
"@openpeepshq/greenscreen": "^0.2.1",
|
|
56
|
-
"@openpeepshq/common": "^0.
|
|
56
|
+
"@openpeepshq/common": "^0.4.0",
|
|
57
57
|
"@openpeepshq/react-ui": "^0.4.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
@@ -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",
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ZodObject,
|
|
4
|
+
type ZodRawShape,
|
|
5
|
+
ZodArray,
|
|
6
|
+
type ZodType,
|
|
7
|
+
} from '@openpeepshq/common/zod';
|
|
3
8
|
import type { ConfigTree } from '@openpeepshq/common/types';
|
|
4
9
|
import { capitalizeFirstLetter } from '@openpeepshq/common';
|
|
5
10
|
import { ExpandableBox } from '@openpeepshq/react-ui';
|
|
@@ -36,8 +41,8 @@ export function ConfigurationCategory({
|
|
|
36
41
|
}: ConfigurationCategoryProps) {
|
|
37
42
|
const t = useT();
|
|
38
43
|
const disabled = disabledProp ?? schema.description === 'fixed';
|
|
39
|
-
const [value, setValue] = useState<Record<string, unknown>>(
|
|
40
|
-
|
|
44
|
+
const [value, setValue] = useState<Record<string, unknown>>(() =>
|
|
45
|
+
structuredClone(valueProp ?? config),
|
|
41
46
|
);
|
|
42
47
|
|
|
43
48
|
useEffect(() => {
|
|
@@ -51,10 +56,10 @@ export function ConfigurationCategory({
|
|
|
51
56
|
|
|
52
57
|
const dirty = !equal(config as ConfigTree, value as ConfigTree);
|
|
53
58
|
const dirtyPaths = useMemo(() => {
|
|
54
|
-
const diff = diffConfigTrees(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
>;
|
|
59
|
+
const diff = diffConfigTrees(
|
|
60
|
+
config as ConfigTree,
|
|
61
|
+
value as ConfigTree,
|
|
62
|
+
) as Record<string, unknown>;
|
|
58
63
|
return Object.keys(diff).flatMap((key) => [...path.map(String), key]);
|
|
59
64
|
}, [config, value, path]);
|
|
60
65
|
|
|
@@ -110,11 +115,18 @@ export function ConfigurationCategory({
|
|
|
110
115
|
/>
|
|
111
116
|
);
|
|
112
117
|
return collapsible ? (
|
|
113
|
-
<ExpandableBox
|
|
118
|
+
<ExpandableBox
|
|
119
|
+
key={String(field.key)}
|
|
120
|
+
title={title}
|
|
121
|
+
initialOpen={false}
|
|
122
|
+
>
|
|
114
123
|
{nested}
|
|
115
124
|
</ExpandableBox>
|
|
116
125
|
) : (
|
|
117
|
-
<div key={String(field.key)}>
|
|
126
|
+
<div key={String(field.key)}>
|
|
127
|
+
{title}
|
|
128
|
+
{nested}
|
|
129
|
+
</div>
|
|
118
130
|
);
|
|
119
131
|
}
|
|
120
132
|
|
|
@@ -152,7 +164,8 @@ export function ConfigurationCategory({
|
|
|
152
164
|
<div className={collapsible ? 'mt-4 pl-4' : ''}>
|
|
153
165
|
{collapsible && (
|
|
154
166
|
<p className={dirty ? 'font-bold' : ''}>
|
|
155
|
-
{pathName ||
|
|
167
|
+
{pathName ||
|
|
168
|
+
t('configuration.title', { defaultValue: 'Configuration' })}
|
|
156
169
|
</p>
|
|
157
170
|
)}
|
|
158
171
|
{body}
|