From 4b1d608b839769052634b4facc345b891d468926 Mon Sep 17 00:00:00 2001 From: soryu Date: Wed, 29 Apr 2026 01:10:11 +0100 Subject: feat: document-mode directive UI proof of concept (Lexical) (#101) * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Backend: feature flag + goal-edit interrupt messaging * WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Frontend: Lexical document editor with step blocks, context menu, countdown --- makima/frontend/src/lib/api.ts | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'makima/frontend/src/lib/api.ts') diff --git a/makima/frontend/src/lib/api.ts b/makima/frontend/src/lib/api.ts index d597b44..8896f2c 100644 --- a/makima/frontend/src/lib/api.ts +++ b/makima/frontend/src/lib/api.ts @@ -1695,6 +1695,52 @@ export async function deleteAccount( return res.json(); } +// ============================================================================= +// User Settings (per-user feature flags) +// ============================================================================= + +/** Per-user settings / feature flags. */ +export interface UserSettings { + /** Whether the new "document mode" UI is enabled for this user. */ + documentModeEnabled: boolean; +} + +/** Request body for updating user settings. */ +export interface UpdateUserSettingsRequest { + documentModeEnabled: boolean; +} + +/** + * Get the authenticated user's settings (feature flags). + */ +export async function getUserSettings(): Promise { + const res = await authFetch(`${API_BASE}/api/v1/users/me/settings`); + if (!res.ok) { + const errorData = await res.json().catch(() => null); + const errorMessage = errorData?.message || res.statusText; + throw new Error(errorMessage); + } + return res.json(); +} + +/** + * Replace the authenticated user's settings (feature flags). + */ +export async function updateUserSettings( + req: UpdateUserSettingsRequest +): Promise { + const res = await authFetch(`${API_BASE}/api/v1/users/me/settings`, { + method: "PUT", + body: JSON.stringify(req), + }); + if (!res.ok) { + const errorData = await res.json().catch(() => null); + const errorMessage = errorData?.message || res.statusText; + throw new Error(errorMessage); + } + return res.json(); +} + // ============================================================================= // Contract Types for Workflow Management // ============================================================================= -- cgit v1.2.3