"use client" import { useEffect, useState } from "react" import { OrgSettingsSection } from "@/components/admin/settings/org-settings-form" import { SettingsCard, SettingsField, SettingsGrid, SettingsToggleRow, } from "@/components/settings/settings-kit" import { AutomationTabMasonry } from "@/components/gmail/settings/automation/automation-tab-masonry" import { useOrgSettingsStore } from "@/lib/admin-settings/org-settings-store" import { MEET_EMAIL_RECIPIENTS_LABELS, MEET_EXTERNAL_API_PROVIDER_LABELS, MEET_TRANSCRIPTION_ENGINE_LABELS, MEET_TRANSCRIPTION_MODE_LABELS, type MeetOrgPolicySettings, } from "@/lib/meet/meet-settings-types" import { Input } from "@/components/ui/input" import { Switch } from "@/components/ui/switch" import { Textarea } from "@/components/ui/textarea" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" import { TechBrandSelectLabel } from "@/components/admin/settings/tech-brand-select-label" export function UltimeetSection() { const meet = useOrgSettingsStore((s) => s.meet) const llmProviders = useOrgSettingsStore((s) => s.llm.providers) const setMeet = useOrgSettingsStore((s) => s.setMeet) const effective = useOrgSettingsStore((s) => s.meta?.effective.jitsi) const [draft, setDraft] = useState(meet) useEffect(() => { setDraft(meet) }, [meet]) const patch = (next: Partial) => setDraft((prev) => ({ ...prev, ...next })) const patchPost = (next: Partial) => setDraft((prev) => ({ ...prev, post_actions: { ...prev.post_actions, ...next }, })) return ( setMeet(draft)} > Jitsi {effective?.enabled ? "actif" : "inactif"} {effective?.public_url ? ` — ${effective.public_url}` : ""} } /> patch({ transcription_enabled: v })} /> } > {draft.transcription_enabled ? ( <> patch({ auto_start_transcription: v })} /> {draft.transcription_engine === "faster_whisper_local" ? ( patch({ skynet_url: e.target.value })} placeholder="http://skynet:8000" /> patch({ whisper_model: e.target.value })} placeholder="tiny, base, small…" /> ) : ( patch({ external_api_url: e.target.value })} placeholder="https://api.openai.com/v1/audio/transcriptions" /> patch({ external_api_key: e.target.value })} placeholder="Laisser vide pour conserver la clé enregistrée" autoComplete="off" /> )} ) : null} {draft.transcription_enabled ? ( patchPost({ drive_enabled: v })} /> {draft.post_actions.drive_enabled ? ( patchPost({ drive_folder_path: e.target.value })} placeholder="/UltiMeet/Transcripts" /> ) : null} patchPost({ email_enabled: v })} /> {draft.post_actions.email_enabled ? ( {draft.post_actions.email_recipients === "custom" ? ( patchPost({ email_custom_addresses: e.target.value })} /> ) : null} ) : null} patchPost({ llm_enabled: v })} /> {draft.post_actions.llm_enabled ? (