diff --git a/src/components/chat/settings/settings.tsx b/src/components/chat/settings/settings.tsx index 78f81edbe..68cc77828 100644 --- a/src/components/chat/settings/settings.tsx +++ b/src/components/chat/settings/settings.tsx @@ -33,6 +33,18 @@ const FormSchema = z.object({ enabled: z.boolean(), send_email: z.boolean(), send_notification: z.boolean(), + redirect: z + .object({ + login_uri: z.string().optional().default(''), + accept_uri: z.string().optional().default(''), + decline_uri: z.string().optional().default(''), + }) + .optional() + .default({ + login_uri: '', + accept_uri: '', + decline_uri: '', + }), }), }); @@ -52,7 +64,17 @@ export const Settings = ({ const { save, isSaving } = useSettingsSave('Chat'); const form = useForm>({ resolver: rhfZodResolver(FormSchema), - defaultValues: data, + defaultValues: { + ...data, + explicit_room_joins: { + ...data.explicit_room_joins, + redirect: { + login_uri: data.explicit_room_joins?.redirect?.login_uri ?? '', + accept_uri: data.explicit_room_joins?.redirect?.accept_uri ?? '', + decline_uri: data.explicit_room_joins?.redirect?.decline_uri ?? '', + }, + }, + }, }); useEffect(() => { @@ -73,7 +95,9 @@ export const Settings = ({ const handleSwitchChange = () => { addAlert({ title: 'Chat Module', - description: `Are you sure you want to ${chatModule ? 'disable' : 'enable'} Chat module?`, + description: `Are you sure you want to ${ + chatModule ? 'disable' : 'enable' + } Chat module?`, cancelText: 'Cancel', actionText: 'Proceed', onDecision: cancel => { diff --git a/src/components/chat/settings/settingsForm.tsx b/src/components/chat/settings/settingsForm.tsx index f2200b567..e657d7a11 100644 --- a/src/components/chat/settings/settingsForm.tsx +++ b/src/components/chat/settings/settingsForm.tsx @@ -1,10 +1,12 @@ import { FormControl, + FormDescription, FormField, FormItem, FormLabel, FormMessage, } from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; import { Switch } from '@/components/ui/switch'; import { useFormContext, useWatch } from 'react-hook-form'; import { cn } from '@/lib/utils'; @@ -180,6 +182,98 @@ export const SettingsForm = ({ /> +
+

+ Invitation Redirects +

+
+ ( + + + Login Redirect URI + + + + + + Absolute login page URL for unauthenticated email-link + clicks. Hook appends + ?redirectUri=...&answer=...&invitationToken=... Empty means + email clicks fail until configured. + + + + )} + /> + ( + + + Accept Redirect URI + + + + + + Post-accept destination. Supports {'{roomId}'} placeholder. + If empty, returns a JSON result. + + + + )} + /> + ( + + + Decline Redirect URI + + + + + + Post-decline destination. Supports {'{roomId}'} placeholder. + If empty, returns a JSON result. + + + + )} + /> +
+